@zeniai/web-app-ui 5.3.94-dev → 5.3.95-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/assets/{AccountMappingScreen-DaAsvWlG.js → AccountMappingScreen-CJpxPjym.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-DsOtbvkM.js → ActualMatchingMatchDetailScreen-BI1Xbj3L.js} +1 -1
  3. package/dist/assets/AddressRoutes-27wvZSFH.js +1 -0
  4. package/dist/assets/{AddressScreen-C0JLhAcE.js → AddressScreen-Ce6wpOqL.js} +1 -1
  5. package/dist/assets/{AiCfoScreen-BUHwXAf6.js → AiCfoScreen-baKqq38G.js} +1 -1
  6. package/dist/assets/{AppDrawer-vbC-QV57.js → AppDrawer-BAy3i2Dk.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-DzF0eyUE.js → BillPayApprovalRoutes-BLLQGNfF.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-Bi056p3z.js → BillPayRoutes-BF0qZi8Q.js} +1 -1
  9. package/dist/assets/{BusinessVerificationPageScreen-D1nbOYUs.js → BusinessVerificationPageScreen-B6gKgGKZ.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-CfZl8Gyx.js → CardsAiCfoScreen-495-iwbX.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-S3N8oI1a.js → ChargeCardRoutes-CsLMN32g.js} +6 -6
  12. package/dist/assets/{CompanyPassportScreen-Cb0WDItw.js → CompanyPassportScreen-DFOWHlG6.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-DscrSY_4.js → ConnectionAuthScreen-DcGlWxyf.js} +1 -1
  14. package/dist/assets/CustomerOnboardingAuthScreen-Da1wSVu0.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-Q5YqE-pG.js → CustomerOnboardingRoutes-7Bwv09dV.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-CHLUwZtv.js → DashboardRoutes-s3deN1Di.js} +1 -1
  17. package/dist/assets/{DefaultTenantHome-BSW3FKbq.js → DefaultTenantHome-Bi2eWO-I.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-BqNLFPCz.js → DomesticWireDetailScreen-CVJejZP9.js} +3 -3
  19. package/dist/assets/{DrawerScreen-CjvLDWWa.js → DrawerScreen-Bev9sxN6.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-CiuhVFP6.js → EntityDetailRoutes-DTd2OX4g.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-yHkHWhCB.js → ExpenseAutomationRoutes-BNvZ1Bwi.js} +1 -1
  22. package/dist/assets/{FeaturePreviewScreen-t6-81tB3.js → FeaturePreviewScreen-DETqyCpy.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-6v8VBEj0.js → HubSpotOAuthCallbackScreen-LgF5qdxr.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider--Aami2sh.js → InboxNotificationsProvider-LdTK3V9o.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-DYvbJYG6.js → InvoicingRoutes-Mbynj2-j.js} +1 -1
  26. package/dist/assets/{MagicLinkRoutes-C2OazRqD.js → MagicLinkRoutes-BAL4OpO8.js} +2 -2
  27. package/dist/assets/{MagicLinkSignInScreen-Cn6GsNEp.js → MagicLinkSignInScreen-BIY2mGLo.js} +1 -1
  28. package/dist/assets/{MobileAppDrawer-CPwvCIYa.js → MobileAppDrawer-CsfNveW9.js} +1 -1
  29. package/dist/assets/NotFoundScreen-DDA41Ig7.js +1 -0
  30. package/dist/assets/{NotificationRoutes-aekj_lXX.js → NotificationRoutes-_8GAMr1Q.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-xUzU6tqX.js → OAuthConsentScreen-DrAajreS.js} +1 -1
  32. package/dist/assets/{PandLWithForecastRoutes-DbBbI4iD.js → PandLWithForecastRoutes-BoihVLwz.js} +1 -1
  33. package/dist/assets/{PaymentLinkScreen-wDbMp6EU.js → PaymentLinkScreen-QPSeahMe.js} +1 -1
  34. package/dist/assets/{PeopleRoutes-DLFd4iV8.js → PeopleRoutes-BJ_Rsbpd.js} +3 -3
  35. package/dist/assets/{PerformanceRoutes-DgAZpNgm.js → PerformanceRoutes-BU_ssv__.js} +1 -1
  36. package/dist/assets/{Preview-9JjGFG_v.js → Preview-S6mtKRFK.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-Dn2zy1VD.js → QBOConnectionScreen-DMcsRcZG.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-y4qFEQsq.js → ReimbursementApprovalRoutes-c_eicF80.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-D0_gOHEu.js → ReimbursementApprovalRuleDetailScreen-NQbCpzYz.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-BnId3F39.js → ReimbursementRoutes-BVOB8GHt.js} +4 -4
  41. package/dist/assets/{ReportsRoutes-DbeoJpVK.js → ReportsRoutes-BaXWnnZZ.js} +1 -1
  42. package/dist/assets/RewardsRoutes-Dr_V6CBY.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-ISVWQj5Q.js → ScheduleDetailsPrepaidExpensesScreen-OdknWRFf.js} +1 -1
  44. package/dist/assets/ScreenRoutes-MAHnboyU.js +2 -0
  45. package/dist/assets/{SettingsRoutes-tCVJI0Fg.js → SettingsRoutes-CwikuwVk.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-fiQdFdcd.js → SetupPagesScreen-B0b-Fgla.js} +1 -1
  47. package/dist/assets/{SignInScreen-DiXsocpm.js → SignInScreen-DYTURHhx.js} +1 -1
  48. package/dist/assets/{SignOutScreen-BiwH5m6t.js → SignOutScreen-Be_uJc5B.js} +1 -1
  49. package/dist/assets/{TaskListScreen-BgIlrtZe.js → TaskListScreen-adKZru26.js} +2 -2
  50. package/dist/assets/{TaskRoutes-BNd4w4Bb.js → TaskRoutes-B74sfUtJ.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-DRKjV_CD.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-BkV8Yidz.js → TransactionDetailScreen-CS9DS32g.js} +1 -1
  53. package/dist/assets/{TransactionListRoutes-Dy1QqSzY.js → TransactionListRoutes-BIufDhIc.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-Caywh1RR.js → TreasuryRoutes-Bt27xnQK.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-g-EHYY2y.js → VendorsRoutes-ZMV0CecT.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-C46GF-q1.js → WiseConfirmationScreen-ZJ4gewaT.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-B6_vZk4u.js → ZeniAccountRoutes-DV3rsGFn.js} +9 -9
  58. package/dist/assets/{ZeniAccountStatementScreen-BjT0Ja6v.js → ZeniAccountStatementScreen-B-L8iMJL.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-jzkx0QiS.js → accountMappingHelper-1wM-u5pk.js} +1 -1
  60. package/dist/assets/{analytics-BE49_JfE.js → analytics-DhotUQIQ.js} +1 -1
  61. package/dist/assets/{analyticsHelper-DZVn8KPX.js → analyticsHelper-BkudU6tc.js} +1 -1
  62. package/dist/assets/{core-R1zvmcG1.js → core-B1R51LGS.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-D4d600vS.js → decodeURIComponentSafe-sNmSv15A.js} +1 -1
  64. package/dist/assets/{dnd-LSyMQh_7.js → dnd-CBDtHD8g.js} +1 -1
  65. package/dist/assets/{empty-BfAyW5rR.js → empty-1ZFG33kK.js} +1 -1
  66. package/dist/assets/{empty-CtFP9XJw.js → empty-DDVSRnUK.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-DYu9DRPv.js → emptyVideoElement-Cmgjsfjv.js} +1 -1
  68. package/dist/assets/{epic-DI5821Fd.js → epic--rTGN1ZF.js} +2 -2
  69. package/dist/assets/{expenseAutomationHelper-BlCRyV8f.js → expenseAutomationHelper-Bb1c_nBx.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-DZAPKjbH.js → getLocaleForTenant-Nj4zPyxj.js} +1 -1
  71. package/dist/assets/{index-IzH6rGRi.js → index-4kuDVIdn.js} +1 -1
  72. package/dist/assets/{index-ARkELHLC.js → index-B4fRbcqK.js} +1 -1
  73. package/dist/assets/{index-LeoAhFsn.js → index-BgCxp-PW.js} +1 -1
  74. package/dist/assets/{index-CooR7eTi.js → index-C5-029-z.js} +1 -1
  75. package/dist/assets/{index-D7BxdwHb.js → index-CmqWYVaK.js} +1 -1
  76. package/dist/assets/{index-DhHwwWlj.js → index-DUjhchTx.js} +1 -1
  77. package/dist/assets/{index-B-tyZK_L.js → index-DaxOKW2h.js} +2 -2
  78. package/dist/assets/{index-Cvus_VBr.js → index-Dp_Uc3gy.js} +1704 -1703
  79. package/dist/assets/{lexical-BG-nDmQN.js → lexical-Cft6chCX.js} +1 -1
  80. package/dist/assets/{liveblocks-DOdRxZ-H.js → liveblocks-BYqz0SWy.js} +1 -1
  81. package/dist/assets/{lottie-Z_NAxrmn.js → lottie-C4orech3.js} +1 -1
  82. package/dist/assets/{mui-ZKvbmPSP.js → mui-D-_RYGgU.js} +1 -1
  83. package/dist/assets/{pathToGoBack-DioXT2-t.js → pathToGoBack-DZ8Lgq0-.js} +1 -1
  84. package/dist/assets/{pdf-_w1KRTSP.js → pdf-DFgrdLB6.js} +3 -3
  85. package/dist/assets/{pdf-lib-Ctu1umZQ.js → pdf-lib-2bJZTByw.js} +1 -1
  86. package/dist/assets/{plaid-tDbexfSh.js → plaid-B0PWXAfV.js} +1 -1
  87. package/dist/assets/{pusher-9ZSIvZ4p.js → pusher-F6-lSe0Y.js} +1 -1
  88. package/dist/assets/{react-DofVj9Pu.js → react-BwTGo4yk.js} +1 -1
  89. package/dist/assets/{react-dAAwh8YD.js → react-CB4vP-t_.js} +1 -1
  90. package/dist/assets/{react-V1QPqCMR.js → react-CM16A7NA.js} +1 -1
  91. package/dist/assets/{react-DLfHBjuE.js → react-DUg8Ws81.js} +1 -1
  92. package/dist/assets/{react-CNq4EJHI.js → react-D_SPu3Ud.js} +1 -1
  93. package/dist/assets/{react-BwaH8vjo.js → react-DyLpv-r1.js} +1 -1
  94. package/dist/assets/{recharts-UmMlzZlF.js → recharts-By7FVN8f.js} +1 -1
  95. package/dist/assets/{routePaths-ME1g30cL.js → routePaths-BALvGXpp.js} +1 -1
  96. package/dist/assets/{sentry-DvoFEQx8.js → sentry-DjmIorbX.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-BaAbZcaB.js → stripSplatSuffix-B5IwbFj2.js} +1 -1
  98. package/dist/assets/{url-C4ptnP9R.js → url-B8llcdww.js} +1 -1
  99. package/dist/assets/{url-CxALZHMf.js → url-SyxPcinx.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-CuSDY9wd.js → useActualMatchingMatchDetail-CuDY29_K.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-B-4Cv_Hc.js → useAiCfoDashboardSuggestedQuestionsChips-B5pmnrb8.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-DWkTPomv.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-Cd0ovQSz.js → useChargeCardPusherEvents-Ce-wULUB.js} +1 -1
  104. package/dist/assets/{useDeviceId-DiDVtEd4.js → useDeviceId-D6nAUa-g.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-neeIEIrq.js → useEmailConnectResultRefresh-CQX3dx0q.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-mCNzqzEf.js → useInitialThreadRequest-BaIZPAUw.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-CFJAytRv.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-D1CY3bdf.js → useTaskManagerPusherEvents-B_vM_sss.js} +1 -1
  109. package/dist/assets/{utils-D06mHID-.js → utils-iOnDyQuG.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-LlSL3tvn.js → withTransactionSidePanel-BuJ7rAhb.js} +2 -2
  111. package/dist/assets/{zeni-epic-state-Mdu-dKQU.js → zeni-epic-state-M9sMLOaG.js} +5 -5
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-DYRqLyFY.js +0 -1
  115. package/dist/assets/CustomerOnboardingAuthScreen-DZSTKSts.js +0 -1
  116. package/dist/assets/NotFoundScreen-BR0tBeJN.js +0 -1
  117. package/dist/assets/RewardsRoutes-CbVAxJ_Q.js +0 -1
  118. package/dist/assets/ScreenRoutes-BxsiowEM.js +0 -2
  119. package/dist/assets/TransactionDetailRoutes-BYsmhufD.js +0 -1
  120. package/dist/assets/useAskAiCfoHostNavButtonProps-D5Ew-Qzm.js +0 -1
  121. package/dist/assets/useTaskManagerAccess-CcPTnvTg.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as B}from"./liveblocks-DOdRxZ-H.js";import{a as o}from"./sentry-DvoFEQx8.js";import{h as Y,g as Z,u as H,j as m,s as q,l as W}from"./core-R1zvmcG1.js";import{ag as X,Y as ee,$,z as te,r as G,ah as ne,l as ae,K as ce}from"./index-Cvus_VBr.js";import{bn as se,fI as oe,gZ as ie,oF as Q,Vh as re,ic as J,gk as le,ow as ue,Vi as de,Vj as pe,uh as ge,m3 as me,ou as Ae,oq as be,oB as Ie,ie as ye,Vk as fe,Vl as Se}from"./zeni-epic-state-Mdu-dKQU.js";import{n as he}from"./mui-ZKvbmPSP.js";import{M as Ee}from"./MobileAppDrawer-CPwvCIYa.js";import{q as R}from"./QBOConnectionScreen-Dn2zy1VD.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-jzkx0QiS.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]="7560995c-b573-4f8c-a3dc-d1e71970c072",a._sentryDebugIdIdentifier="sentry-dbid-7560995c-b573-4f8c-a3dc-d1e71970c072")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},we=he.div`
1
+ import{j as B}from"./liveblocks-BYqz0SWy.js";import{a as o}from"./sentry-DjmIorbX.js";import{h as Z,g as H,u as W,j as m,s as q,l as X}from"./core-B1R51LGS.js";import{ag as Y,c as ee,$,z as te,r as G,ah as ne,l as ae,K as ce}from"./index-Dp_Uc3gy.js";import{bn as se,fI as oe,gZ as ie,oF as Q,Vh as re,ic as J,gk as le,ow as ue,Vi as de,Vj as pe,uh as ge,m3 as me,ou as Ae,oq as be,oB as Ie,ie as ye,Vk as fe,Vl as Se}from"./zeni-epic-state-M9sMLOaG.js";import{n as he}from"./mui-D-_RYGgU.js";import{M as Ee}from"./MobileAppDrawer-CsfNveW9.js";import{q as R}from"./QBOConnectionScreen-DMcsRcZG.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-1wM-u5pk.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]="1f3d89ac-528b-4681-b166-27ca0c947944",a._sentryDebugIdIdentifier="sentry-dbid-1f3d89ac-528b-4681-b166-27ca0c947944")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},we=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as B}from"./liveblocks-DOdRxZ-H.js";import{a as o}from"./sentry-DvoFEQx
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${a=>a.theme.colors.grey4};
9
- `,ve=W((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:v,filing1099Section:C}=r,{incomeAccount:x,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=v,{bankAccount:k,expenseCategory1099:M}=C,b=h(e.accountMappingView.incomeAccountList,x.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),I=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,k.selectedOptions),f=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,M),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:I?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:D.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:f};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(fe())):a(J())},onSaveClick:()=>{a(ye()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(Ie(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=X(),e=Y(),i=Z(),c=H(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:w,isDynamicConfigLoading:v}=r("transaction_categorization_config"),C=!v&&w?.capitalization_enabled===!0,x=te.getSignedInUser(),F=se(x),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),k=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),M=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[U,N]of g)N===null?delete n[U]:n[U]=N;const[S,K]=g[0]??[];S!=null&&c(Q(s.companyId,S,K,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[I,_]=o.useState(!1),[P,D]=o.useState(!1);o.useEffect((()=>{I===!1&&(c(J()),_(!0))}),[I]);const y=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[y,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),f=t=>{D(t)};return B.jsxs(we,{children:[B.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:f}),B.jsx(ve,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:C,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:k,onSaveCapitalizationAccountThresholds:M,location:i,isSettings:G(i),onClickMenuIcon:()=>f(!0)})]})};export{l as P,_e as U,u as a};
9
+ `,ve=X((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:v,filing1099Section:C}=r,{incomeAccount:x,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=v,{bankAccount:k,expenseCategory1099:M}=C,b=h(e.accountMappingView.incomeAccountList,x.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),I=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,k.selectedOptions),f=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,M),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:I?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:D.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:f};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(fe())):a(J())},onSaveClick:()=>{a(ye()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(Ie(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Y(),e=Z(),i=H(),c=W(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:w,isDynamicConfigLoading:v}=r("transaction_categorization_config"),C=!v&&w?.capitalization_enabled===!0,x=te.getSignedInUser(),F=se(x),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),k=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),M=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[U,N]of g)N===null?delete n[U]:n[U]=N;const[S,K]=g[0]??[];S!=null&&c(Q(s.companyId,S,K,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[I,_]=o.useState(!1),[P,D]=o.useState(!1);o.useEffect((()=>{I===!1&&(c(J()),_(!0))}),[I]);const y=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[y,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),f=t=>{D(t)};return B.jsxs(we,{children:[B.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:f}),B.jsx(ve,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:C,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:k,onSaveCapitalizationAccountThresholds:M,location:i,isSettings:G(i),onClickMenuIcon:()=>f(!0)})]})};export{l as P,_e as U,u as a};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-DOdRxZ-H.js";import{a as y}from"./sentry-DvoFEQx8.js";import{a2 as A,dN as R}from"./index-Cvus_VBr.js";import"./mui-ZKvbmPSP.js";import{u as F}from"./useActualMatchingMatchDetail-CuSDY9wd.js";import b from"./NotFoundScreen-BR0tBeJN.js";import{i as P,h as U,g as w}from"./core-R1zvmcG1.js";import"./zeni-epic-state-Mdu-dKQU.js";import"./recharts-UmMlzZlF.js";import"./analytics-BE49_JfE.js";import"./plaid-tDbexfSh.js";import"./dnd-LSyMQh_7.js";import"./stripe-cKAAJElX.js";import"./lottie-Z_NAxrmn.js";import"./lexical-BG-nDmQN.js";import"./pdf-_w1KRTSP.js";import"./utils-D06mHID-.js";import"./stripSplatSuffix-BaAbZcaB.js";import"./decodeURIComponentSafe-D4d600vS.js";import"./routePaths-ME1g30cL.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="53b1ac0a-3c44-49f1-a57e-5c08d5625e5f",t._sentryDebugIdIdentifier="sentry-dbid-53b1ac0a-3c44-49f1-a57e-5c08d5625e5f")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:c,handleUndoReversal:h,handleApproveAndReverse:d,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g})}export{V as default};
1
+ import{j as s}from"./liveblocks-BYqz0SWy.js";import{a as y}from"./sentry-DjmIorbX.js";import{a2 as A,dN as R}from"./index-Dp_Uc3gy.js";import"./mui-D-_RYGgU.js";import{u as F}from"./useActualMatchingMatchDetail-CuDY29_K.js";import b from"./NotFoundScreen-DDA41Ig7.js";import{i as P,h as U,g as w}from"./core-B1R51LGS.js";import"./zeni-epic-state-M9sMLOaG.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";import"./stripSplatSuffix-B5IwbFj2.js";import"./decodeURIComponentSafe-sNmSv15A.js";import"./routePaths-BALvGXpp.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="53b1ac0a-3c44-49f1-a57e-5c08d5625e5f",t._sentryDebugIdIdentifier="sentry-dbid-53b1ac0a-3c44-49f1-a57e-5c08d5625e5f")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:c,handleUndoReversal:h,handleApproveAndReverse:d,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g})}export{V as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BYqz0SWy.js";import{A as i}from"./AddressScreen-Ce6wpOqL.js";import s from"./NotFoundScreen-DDA41Ig7.js";import"./sentry-DjmIorbX.js";import{n as d,o as r}from"./core-B1R51LGS.js";import"./zeni-epic-state-M9sMLOaG.js";import"./recharts-By7FVN8f.js";import"./index-Dp_Uc3gy.js";import"./mui-D-_RYGgU.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.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]="81cbb5c1-1b56-4d87-a240-ae6c03b91825",t._sentryDebugIdIdentifier="sentry-dbid-81cbb5c1-1b56-4d87-a240-ae6c03b91825")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-DOdRxZ-H.js";import{a as h}from"./sentry-DvoFEQx8.js";import{h as T,u as P,g as j,i as E,j as B,l as L}from"./core-R1zvmcG1.js";import{_ as M,z as V,V as $,a5 as D,a6 as K,l as _,K as S,a1 as z,Q as b,a2 as F}from"./index-Cvus_VBr.js";import{VY as C,it as N,fI as R,VZ as U,c9 as G,V_ as O,mL as q}from"./zeni-epic-state-Mdu-dKQU.js";import{u as H,n as Q}from"./mui-ZKvbmPSP.js";import Y from"./NotFoundScreen-BR0tBeJN.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]="a15d7886-130c-4aaf-921c-4a1935e34c24",e._sentryDebugIdIdentifier="sentry-dbid-a15d7886-130c-4aaf-921c-4a1935e34c24")}catch{}})();const Z=Q.div`
1
+ import{j as r}from"./liveblocks-BYqz0SWy.js";import{a as h}from"./sentry-DjmIorbX.js";import{h as T,u as P,g as j,i as E,j as B,l as L}from"./core-B1R51LGS.js";import{_ as M,z as V,V as $,a5 as D,a6 as K,l as _,K as S,a1 as z,Q as b,a2 as F}from"./index-Dp_Uc3gy.js";import{VY as C,it as N,fI as R,VZ as U,c9 as G,V_ as O,mL as q}from"./zeni-epic-state-M9sMLOaG.js";import{u as H,n as Q}from"./mui-D-_RYGgU.js";import Y from"./NotFoundScreen-DDA41Ig7.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]="a15d7886-130c-4aaf-921c-4a1935e34c24",e._sentryDebugIdIdentifier="sentry-dbid-a15d7886-130c-4aaf-921c-4a1935e34c24")}catch{}})();const Z=Q.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-DOdRxZ-H.js";import{a as n}from"./sentry-DvoFEQx8.js";import{u as Dt,h as Lt,i as Bt,g as Ft,j as v,l as Mt}from"./core-R1zvmcG1.js";import{e5 as $t,a as Nt,h as Vt,e6 as Gt,z as Ht,_ as zt,e7 as qt,e8 as Wt,e9 as Yt,bn as Be,ea as We,eb as Zt,bm as Ye,a2 as ge,a6 as ce,l as $,ec as me,ed as Jt,ee as Kt,as as Xt,K as es,w as ts,ef as ss,eg as ns,at as as,eh as os,ei as is,ej as rs,ek as ls,p as us,bi as Fe,el as ds}from"./index-Cvus_VBr.js";import{fH as M,gw as R,UG as cs,a2Y as ms,a2Z as Ss,jQ as hs,a2_ as ps,jN as fs,a2$ as Se,jt as Z,jW as J,jz as Ie,jg as he,je as gs,jY as Is,jI as Ze,UP as Me,gy as N,gN as Cs,UO as ks,Uz as $e,fI as bs,j7 as vs,a30 as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a31 as Rs,a32 as Ts,a33 as js,gx as Os,gr as Ne,k8 as Ve,gt as Ge,gz as As,a34 as He,jZ as _s,ji as Us,jC as Qs,jU as ze,jF as Ds,gA as Ls,gB as Bs,gC as Fs,gD as Ms}from"./zeni-epic-state-Mdu-dKQU.js";import{D as $s,n as V,S as Ns,v as Vs}from"./mui-ZKvbmPSP.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-B-4Cv_Hc.js";import{p as Hs}from"./pathToGoBack-DioXT2-t.js";import{j as zs}from"./routePaths-ME1g30cL.js";import{u as qs}from"./useTaskManagerPusherEvents-D1CY3bdf.js";import"./recharts-UmMlzZlF.js";import"./analytics-BE49_JfE.js";import"./plaid-tDbexfSh.js";import"./dnd-LSyMQh_7.js";import"./stripe-cKAAJElX.js";import"./lottie-Z_NAxrmn.js";import"./lexical-BG-nDmQN.js";import"./pdf-_w1KRTSP.js";import"./utils-D06mHID-.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="49bec57e-4f7e-492e-ad9f-27163ec3c877",t._sentryDebugIdIdentifier="sentry-dbid-49bec57e-4f7e-492e-ad9f-27163ec3c877")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Je="chat-response-generated";function Ys(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Zs=Mt((function(t,r){const h=M(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=js(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Ys(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:J(t).detail,skillDetailError:J(t).fetchState==="Error",skillDetailLoading:J(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Je&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,j=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:O,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Ye(g,E);j!=="answer"?$.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Fs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(a,o,c,j,E)=>{a&&Fe(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Ze())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(ze({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(ze({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{t(Us({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(_s({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t(N()),t(Ne()),Fe(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(He())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(As(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??Hs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t(N()),i!=null&&t(Ne());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=$t(),{setIsAiCfoOpen:h}=Nt(),s=Dt(),d=Lt(),{session_id:l}=Bt(),i=Ft(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=n.useState(void 0),[G,A]=n.useState(!1),[Ke,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=n.useCallback((e=>{O(e),A(!0)}),[]),tt=n.useCallback((()=>{O(void 0),A(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),O(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?Z({scheduleId:P}):Se())}),[s,P]);const F=ke?.macroId,at=v((e=>J(e))),be=F!=null&&F!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&F!=null&&s(Ie({macroId:F}))}),[s,be,F]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(Z({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(Z({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=n.useCallback((()=>{s(Ze()),s(Me())}),[s]),ct=n.useCallback((()=>{s(N())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),y=Ht.getSignedInUser();n.useEffect((()=>l==="routines"?(s(N()),void s(ks())):l==="skills"?(s(Se()),s($e()),void s(Me())):(T==null&&s(Se()),s($e()),void s(N()))),[s,T,g,l]);const ft=zt(),_=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,D=w!=null&&w!=="",ee=n.useCallback((e=>{D&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,w]),te=n.useCallback((()=>{D&&d(`/${w}/ai-cfo/routines`)}),[D,d,w]),se=n.useCallback(((e,m)=>{const U=e.sessionId??C.sessionId;U!=null&&D&&d(`/${w}/ai-cfo/${U}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,w]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:qt(k),skillName:k.isAdHoc===!0?void 0:K.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,K]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Yt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,z=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&z!=null&&z!==""){const e=i.state;ae(z),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[z,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const q=I.uiState.lastContextMessage;n.useEffect((()=>{q!=null&&q!==""&&u!=null&&(ae(q),oe(!0),ie(void 0),re(void 0),s(Es()))}),[q,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Zt(u),W=I.fetchState,Y=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Oe=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(_e,u),Tt=Rt.length===0;n.useEffect((()=>{x||_||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,d,i.state]);const jt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),Ue=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=l!==Ue.current,m=u!==Qe.current;Ue.current=l,Qe.current=u,l!==u&&(!e||l==null||zs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Je}`)),eventCallback:(e,m,U)=>U.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&Y&&s(ws())}),[W,Y,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&y!=null&&(l===u||W==="Completed"&&!Y)&&s(ys(u,y.userId))}),[Oe,W,Ae,Y,u,y,l,s]);const ue=y?.userId,At=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(Z({scheduleId:e}))}),[s,a,T,P]);qs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const U=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:Ws.find((Qt=>Qt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(m);U!=null&&De(U.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const _t=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:$,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(qe,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const Ut=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:$,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Js,{children:[S.jsx(ce,{analytics:$,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),_&&ne.drawerElement,S.jsx(Zs,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:_t,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:j,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:K,routines:o.routines,onRoutineCreate:Xe,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ke,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:w}),p&&_?S.jsx($s,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(qe,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!_?S.jsx(Jt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:Ut})}):null]})},qe=V(Ns)`
1
+ import{j as S}from"./liveblocks-BYqz0SWy.js";import{a as n}from"./sentry-DjmIorbX.js";import{u as Dt,h as Lt,i as Bt,g as Ft,j as v,l as Mt}from"./core-B1R51LGS.js";import{e5 as $t,a as Nt,Y as Vt,e6 as Gt,z as Ht,_ as zt,e7 as qt,e8 as Wt,e9 as Yt,bn as Be,ea as We,eb as Zt,bm as Ye,a2 as ge,a6 as ce,l as $,ec as me,ed as Jt,ee as Kt,as as Xt,K as es,w as ts,ef as ss,eg as ns,at as as,eh as os,ei as is,ej as rs,ek as ls,p as us,bi as Fe,el as ds}from"./index-Dp_Uc3gy.js";import{fH as M,gw as R,UG as cs,a2Y as ms,a2Z as Ss,jQ as hs,a2_ as ps,jN as fs,a2$ as Se,jt as Z,jW as J,jz as Ie,jg as he,je as gs,jY as Is,jI as Ze,UP as Me,gy as N,gN as Cs,UO as ks,Uz as $e,fI as bs,j7 as vs,a30 as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a31 as Rs,a32 as Ts,a33 as js,gx as Os,gr as Ne,k8 as Ve,gt as Ge,gz as As,a34 as He,jZ as _s,ji as Us,jC as Qs,jU as ze,jF as Ds,gA as Ls,gB as Bs,gC as Fs,gD as Ms}from"./zeni-epic-state-M9sMLOaG.js";import{D as $s,n as V,S as Ns,v as Vs}from"./mui-D-_RYGgU.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-B5pmnrb8.js";import{p as Hs}from"./pathToGoBack-DZ8Lgq0-.js";import{j as zs}from"./routePaths-BALvGXpp.js";import{u as qs}from"./useTaskManagerPusherEvents-B_vM_sss.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="785e224c-510d-4cea-b501-5ba8fb730c5e",t._sentryDebugIdIdentifier="sentry-dbid-785e224c-510d-4cea-b501-5ba8fb730c5e")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Je="chat-response-generated";function Ys(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Zs=Mt((function(t,r){const h=M(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=js(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Ys(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:J(t).detail,skillDetailError:J(t).fetchState==="Error",skillDetailLoading:J(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Je&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,j=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:O,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Ye(g,E);j!=="answer"?$.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Fs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(a,o,c,j,E)=>{a&&Fe(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Ze())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(ze({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(ze({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{t(Us({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(_s({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t(N()),t(Ne()),Fe(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(He())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(As(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??Hs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t(N()),i!=null&&t(Ne());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=$t(),{setIsAiCfoOpen:h}=Nt(),s=Dt(),d=Lt(),{session_id:l}=Bt(),i=Ft(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=n.useState(void 0),[G,A]=n.useState(!1),[Ke,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=n.useCallback((e=>{O(e),A(!0)}),[]),tt=n.useCallback((()=>{O(void 0),A(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),O(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?Z({scheduleId:P}):Se())}),[s,P]);const F=ke?.macroId,at=v((e=>J(e))),be=F!=null&&F!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&F!=null&&s(Ie({macroId:F}))}),[s,be,F]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(Z({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(Z({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=n.useCallback((()=>{s(Ze()),s(Me())}),[s]),ct=n.useCallback((()=>{s(N())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),y=Ht.getSignedInUser();n.useEffect((()=>l==="routines"?(s(N()),void s(ks())):l==="skills"?(s(Se()),s($e()),void s(Me())):(T==null&&s(Se()),s($e()),void s(N()))),[s,T,g,l]);const ft=zt(),_=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,D=w!=null&&w!=="",ee=n.useCallback((e=>{D&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,w]),te=n.useCallback((()=>{D&&d(`/${w}/ai-cfo/routines`)}),[D,d,w]),se=n.useCallback(((e,m)=>{const U=e.sessionId??C.sessionId;U!=null&&D&&d(`/${w}/ai-cfo/${U}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,w]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:qt(k),skillName:k.isAdHoc===!0?void 0:K.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,K]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Yt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,z=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&z!=null&&z!==""){const e=i.state;ae(z),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[z,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const q=I.uiState.lastContextMessage;n.useEffect((()=>{q!=null&&q!==""&&u!=null&&(ae(q),oe(!0),ie(void 0),re(void 0),s(Es()))}),[q,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Zt(u),W=I.fetchState,Y=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Oe=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(_e,u),Tt=Rt.length===0;n.useEffect((()=>{x||_||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,d,i.state]);const jt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),Ue=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=l!==Ue.current,m=u!==Qe.current;Ue.current=l,Qe.current=u,l!==u&&(!e||l==null||zs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Je}`)),eventCallback:(e,m,U)=>U.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&Y&&s(ws())}),[W,Y,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&y!=null&&(l===u||W==="Completed"&&!Y)&&s(ys(u,y.userId))}),[Oe,W,Ae,Y,u,y,l,s]);const ue=y?.userId,At=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(Z({scheduleId:e}))}),[s,a,T,P]);qs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const U=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:Ws.find((Qt=>Qt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(m);U!=null&&De(U.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const _t=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:$,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(qe,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const Ut=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:$,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Js,{children:[S.jsx(ce,{analytics:$,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),_&&ne.drawerElement,S.jsx(Zs,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:_t,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:j,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:K,routines:o.routines,onRoutineCreate:Xe,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ke,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:w}),p&&_?S.jsx($s,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(qe,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!_?S.jsx(Jt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:Ut})}):null]})},qe=V(Ns)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-DOdRxZ-H.js";import{a as o,R as Ta}from"./sentry-DvoFEQx8.js";import{u as Fe,j as r,g as $a,h as Ba,q as L}from"./core-R1zvmcG1.js";import{fI as Ge,Ux as xa,Uy as Re,gc as Aa,gy as Q,Uz as ee,jI as ve,jg as Te,UA as Da,UB as _a,gS as Ua,q3 as Ma,UC as Fa,UD as $e,gp as Ga,UE as x,fH as Ra,gw as Za,UF as Ha,UG as La,UH as ja,UI as Be,UJ as Pa,UK as xe,UL as Na,ED as Va,gq as Oa,h5 as qa,cW as za,UM as Ya,UN as Wa,qG as Ja,gb as Ka,ja as Xa,UO as Qa,UP as et,wL as at,gr as tt}from"./zeni-epic-state-Mdu-dKQU.js";import{w as nt,i as ot,a as st,k as rt,Y as it,$ as m,c as lt,u as dt,d as ct,e as ut,f as mt,g as Ct,U as pt,h as ht,j as ft,z as gt,l as j,p as h,m as Ae,n as bt,o as St,q as De,r as kt,Z as _e,s as Et,R as wt,v as te,x as ae,y as It,A as yt,B as vt,L as Tt,C as $t,D as Bt,E as xt,X as At}from"./index-Cvus_VBr.js";import{u as Dt,q as _t,r as Ut,I as Mt,p as Ue,t as Ft,D as Me,s as ne}from"./mui-ZKvbmPSP.js";import{u as Gt}from"./InboxNotificationsProvider--Aami2sh.js";import{u as Rt}from"./useTaskManagerAccess-CcPTnvTg.js";import{u as Zt}from"./expenseAutomationHelper-BlCRyV8f.js";import"./recharts-UmMlzZlF.js";import"./analytics-BE49_JfE.js";import"./plaid-tDbexfSh.js";import"./dnd-LSyMQh_7.js";import"./stripe-cKAAJElX.js";import"./lottie-Z_NAxrmn.js";import"./lexical-BG-nDmQN.js";import"./pdf-_w1KRTSP.js";import"./utils-D06mHID-.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="4175da4b-f19b-4a93-bc22-b9803979c417",a._sentryDebugIdIdentifier="sentry-dbid-4175da4b-f19b-4a93-bc22-b9803979c417")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ht=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Lt=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[P,D]=Ta.useState(!1),[k,Ze]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[He,Le]=o.useState(!1),N=Dt(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(Q()),n(ee()))}),[n,re]),o.useEffect((()=>{n(Q()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ge(e))),V=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:je}=dt(),w=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:Pe}=Rt(E),le=ut(),I=mt(),U=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const X=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(X)}const Z=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(Z)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ve()),n(Te()))}),[n,U,I,i.tenantId,w]);const[O,Ne]=o.useState(void 0),Ve=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:M}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>Da(e)));o.useEffect((()=>{const e=()=>{Le(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>_a(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:y}=g,We=L("/signout")!==null,F=L("/:tenantEmailDomain/dashboard")!==null,ce=L("/:tenantEmailDomain/reports")!==null,b=L("/:tenantEmailDomain/onboarding/*")!==null,ue=Zt();o.useEffect((()=>{U&&I&&M&&!b&&q.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Je=We||b,z=r((e=>e.tenantState)),Ke=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Xe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Ra(e))),la=r((e=>Za(e).skillsEnabled)),da=r((e=>Ha(e))),Ce=r((e=>La(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(ja),[v,W]=o.useState(void 0),J=Y.uiState.currentChatSessionId,G=v!=null?Y.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,he=ft(G),{inboxNotifications:K,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Gt(),R=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return he==="In-Progress"&&G==="Completed"?(n(Be({chatSessionId:v})),W(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:v})),W(void 0)))}),[n,t.state,s,G,v,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&K!=null){const e=`dashboard_${i.companyId}`;Ne(K.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,K]),o.useEffect((()=>{I&&_&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(Pa("task_manager","dashboard"))}),[I,_,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||R.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,R.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:O},"comments")))}}),[O,R.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Xe===!1&&T.push("accounts_payable_aging"),Qe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),M===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Na(e,T).fetchState)),ke=r((e=>Va(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{D(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,_),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(y.monthEndCloseChecks?.auditSummary!=null&&j.trackMonthCloseAuditPage(e.month,e.year,y.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",y.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Wa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,y.monthEndCloseChecks?.auditSummary,y.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Ke:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?_e("ai_cfo"):De(t)&&pe!=="completed"?_e("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:De(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ve,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=Pe?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{je(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&j.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return V?(n(Te()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return V?(n(ve()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(Q()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(j.trackAICFOChatScreenStateChanged("viewed","left_menu",J??null,null),!V)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const H=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:H,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,Z=At(B)&&B!=="command_center";if(B!=="command_center"&&!Z||f[i.tenantId]==null||j.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),Z&&f[i.tenantId]!=null){const H=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${H.month}-${H.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const X=yt(e.type);vt(e.type)?(J!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${X}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Xa(e)),J===e&&W(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:y,onPeriodChange:Ea,onCalendarOpen:Ze,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),ya=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:He?`1px solid ${N.colors.grey2}`:""},children:d.jsxs(Ut,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Pt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ye=Ue((e=>e.breakpoints.up("md"))),va=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ht,{className:c.root,children:[d.jsx(Ft,{}),Je===!1?d.jsxs(d.Fragment,{children:[ye||!F?null:ya,d.jsxs("nav",{className:c.drawer,children:[ye?null:d.jsx(Me,{container:window.document.body,variant:"temporary",open:P,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),va?null:d.jsx(Me,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((D=>Ge(D))),P={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(D,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Re({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Lt,{tenantEmailDomain:a,...P})},jt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
1
+ import{j as d}from"./liveblocks-BYqz0SWy.js";import{a as o,R as Ta}from"./sentry-DjmIorbX.js";import{u as Fe,j as r,g as $a,h as Ba,q as L}from"./core-B1R51LGS.js";import{fI as Ge,Ux as xa,Uy as Re,gc as Aa,gy as Q,Uz as ee,jI as ve,jg as Te,UA as Da,UB as _a,gS as Ua,q3 as Ma,UC as Fa,UD as $e,gp as Ga,UE as x,fH as Ra,gw as Za,UF as Ha,UG as La,UH as ja,UI as Be,UJ as Pa,UK as xe,UL as Na,ED as Va,gq as Oa,h5 as qa,cW as za,UM as Ya,UN as Wa,qG as Ja,gb as Ka,ja as Xa,UO as Qa,UP as et,wL as at,gr as tt}from"./zeni-epic-state-M9sMLOaG.js";import{w as nt,i as ot,a as st,k as rt,c as it,$ as m,d as lt,u as dt,e as ct,f as ut,g as mt,h as Ct,U as pt,Y as ht,j as ft,z as gt,l as j,p as h,m as Ae,n as bt,o as St,q as De,r as kt,Z as _e,s as Et,R as wt,v as te,x as ae,y as It,A as yt,B as vt,L as Tt,C as $t,D as Bt,E as xt,X as At}from"./index-Dp_Uc3gy.js";import{u as Dt,q as _t,r as Ut,I as Mt,p as Ue,t as Ft,D as Me,s as ne}from"./mui-D-_RYGgU.js";import{u as Gt}from"./InboxNotificationsProvider-LdTK3V9o.js";import{u as Rt}from"./useTaskManagerAccess-CFJAytRv.js";import{u as Zt}from"./expenseAutomationHelper-Bb1c_nBx.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="4f44d5cd-e4af-4f93-a40e-bc7351820c66",a._sentryDebugIdIdentifier="sentry-dbid-4f44d5cd-e4af-4f93-a40e-bc7351820c66")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ht=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Lt=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[P,D]=Ta.useState(!1),[k,Ze]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[He,Le]=o.useState(!1),N=Dt(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(Q()),n(ee()))}),[n,re]),o.useEffect((()=>{n(Q()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ge(e))),V=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:je}=dt(),w=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:Pe}=Rt(E),le=ut(),I=mt(),U=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const X=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(X)}const Z=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(Z)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ve()),n(Te()))}),[n,U,I,i.tenantId,w]);const[O,Ne]=o.useState(void 0),Ve=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:M}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>Da(e)));o.useEffect((()=>{const e=()=>{Le(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>_a(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:y}=g,We=L("/signout")!==null,F=L("/:tenantEmailDomain/dashboard")!==null,ce=L("/:tenantEmailDomain/reports")!==null,b=L("/:tenantEmailDomain/onboarding/*")!==null,ue=Zt();o.useEffect((()=>{U&&I&&M&&!b&&q.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Je=We||b,z=r((e=>e.tenantState)),Ke=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Xe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Ra(e))),la=r((e=>Za(e).skillsEnabled)),da=r((e=>Ha(e))),Ce=r((e=>La(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(ja),[v,W]=o.useState(void 0),J=Y.uiState.currentChatSessionId,G=v!=null?Y.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,he=ft(G),{inboxNotifications:K,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Gt(),R=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return he==="In-Progress"&&G==="Completed"?(n(Be({chatSessionId:v})),W(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:v})),W(void 0)))}),[n,t.state,s,G,v,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&K!=null){const e=`dashboard_${i.companyId}`;Ne(K.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,K]),o.useEffect((()=>{I&&_&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(Pa("task_manager","dashboard"))}),[I,_,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||R.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,R.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:O},"comments")))}}),[O,R.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Xe===!1&&T.push("accounts_payable_aging"),Qe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),M===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Na(e,T).fetchState)),ke=r((e=>Va(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{D(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,_),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(y.monthEndCloseChecks?.auditSummary!=null&&j.trackMonthCloseAuditPage(e.month,e.year,y.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",y.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Wa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,y.monthEndCloseChecks?.auditSummary,y.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Ke:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?_e("ai_cfo"):De(t)&&pe!=="completed"?_e("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:De(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ve,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=Pe?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{je(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&j.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return V?(n(Te()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return V?(n(ve()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(Q()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(j.trackAICFOChatScreenStateChanged("viewed","left_menu",J??null,null),!V)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const H=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:H,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,Z=At(B)&&B!=="command_center";if(B!=="command_center"&&!Z||f[i.tenantId]==null||j.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),Z&&f[i.tenantId]!=null){const H=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${H.month}-${H.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const X=yt(e.type);vt(e.type)?(J!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${X}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Xa(e)),J===e&&W(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:y,onPeriodChange:Ea,onCalendarOpen:Ze,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),ya=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:He?`1px solid ${N.colors.grey2}`:""},children:d.jsxs(Ut,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Pt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ye=Ue((e=>e.breakpoints.up("md"))),va=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ht,{className:c.root,children:[d.jsx(Ft,{}),Je===!1?d.jsxs(d.Fragment,{children:[ye||!F?null:ya,d.jsxs("nav",{className:c.drawer,children:[ye?null:d.jsx(Me,{container:window.document.body,variant:"temporary",open:P,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),va?null:d.jsx(Me,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((D=>Ge(D))),P={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(D,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Re({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Lt,{tenantEmailDomain:a,...P})},jt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
2
2
  height: 20px;
3
3
  width: 20px;
4
4
  color: ${a=>a.theme.colors.primary};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-DOdRxZ-H.js";import{a as d}from"./sentry-DvoFEQx8.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as Z,n as te,o as x}from"./core-R1zvmcG1.js";import{fI as P,Zz as w,Zg as R,Ib as E,I5 as q,I9 as A,H_ as z,Zi as K,I2 as ae,Id as oe,I1 as H,Ig as X,Ic as C}from"./zeni-epic-state-Mdu-dKQU.js";import{z as _,w as J,bX as pe,r as O,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-Cvus_VBr.js";import{u as M}from"./mui-ZKvbmPSP.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-D0_gOHEu.js";import ie from"./NotFoundScreen-BR0tBeJN.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]="3f0d875d-a6d8-4b1b-bee3-9cffbe5a0476",e._sentryDebugIdIdentifier="sentry-dbid-3f0d875d-a6d8-4b1b-bee3-9cffbe5a0476")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(z(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(z(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));Q();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(X(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=_.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(H(!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(G,{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=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(X(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Y(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=_.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Q(),d.useEffect((()=>{p||(f(!0),l(H(!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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
1
+ import{j as u}from"./liveblocks-BYqz0SWy.js";import{a as d}from"./sentry-DjmIorbX.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as Z,n as te,o as x}from"./core-B1R51LGS.js";import{fI as P,Zz as w,Zg as R,Ib as E,I5 as q,I9 as A,H_ as z,Zi as K,I2 as ae,Id as oe,I1 as H,Ig as X,Ic as C}from"./zeni-epic-state-M9sMLOaG.js";import{z as _,w as J,bX as pe,r as O,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-Dp_Uc3gy.js";import{u as M}from"./mui-D-_RYGgU.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-NQbCpzYz.js";import ie from"./NotFoundScreen-DDA41Ig7.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]="3f0d875d-a6d8-4b1b-bee3-9cffbe5a0476",e._sentryDebugIdIdentifier="sentry-dbid-3f0d875d-a6d8-4b1b-bee3-9cffbe5a0476")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(z(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(z(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));Q();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(X(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=_.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(H(!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(G,{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=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(X(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Y(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=_.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Q(),d.useEffect((()=>{p||(f(!0),l(H(!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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-DOdRxZ-H.js";import{h as Y,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-R1zvmcG1.js";import{fI as q,YS as _e,bq as It,SR as ia,bo as vt,bK as de,YT as kt,Hr as wt,IQ as Re,I2 as oa,bn as Be,YU as la,YV as sa,c9 as ra,YW as ca,m3 as xt,YX as At,YY as Bt,Ji as Ue,HK as xe,YZ as da,Hf as et,Y_ as ua,Na as pa,Hj as ma,Hp as Ct,Y$ as Se,Z0 as Ge,IR as Ze,HH as Dt,Z1 as ba,Z2 as ha,IU as Me,Z3 as ga,I_ as Sa,Z4 as Et,It as tt,Iy as ya,Z5 as fa,Z6 as ce,Z7 as Tt,Z8 as jt,Z9 as Pt,gZ as Ia,HP as Ve,cH as Ft,Za as va,gk as ka,Zb as wa,Zc as xa,e0 as Rt,d$ as Vt,Zd as Oe,Ze as Aa,Zf as Ba,Xq as Ne,Zg as Ca,Xr as ie,Xs as ze,Zh as Da,Zi as Ea,Zj as Ta,IA as at,Ix as ja,Zk as Pa,Zl as Fa,Zm as Ra,Ij as Va,Zn as $a,Zo as La,cv as $t,db as Lt,me as _a,bP as Ua,br as _t,bQ as Ut,Gv as Ga,Zp as Za,MZ as Ma,N3 as Oa,CA as Na,IS as za,Jp as Ha,mr as ge,Zq as Wa,Zr as Gt,mV as qa,ml as Zt,mG as Mt,mF as nt,bF as pe,bO as Ja,Zs as Ya,Zt as ye,kR as Ka,Zu as it,Zv as Xa,kV as Qa,le as en,JD as tn,Zw as an,mO as nn,Jt as on,Zx as ot,Jx as ln,JC as sn,JA as rn,Jr as cn,Zy as Ot,HA as dn,Zz as un,ZA as pn,gJ as mn,gI as bn,gH as hn,mu as gn,mM as lt,mX as Sn,v2 as yn,mD as fn,Jv as In,k$ as vn,n0 as kn,ZB as wn,kT as xn,uV as An,ZC as Bn,Ip as Cn,bL as Dn,bu as En,UR as Tn,de as jn,dd as Pn,cG as Fn,cN as Rn}from"./zeni-epic-state-Mdu-dKQU.js";import{z as V,V as fe,aq as He,Y as oe,$ as f,bg as We,a5 as se,E as C,a6 as Ce,l as E,bt as Vn,a2 as W,at as qe,p as D,_ as Ie,bu as st,bv as rt,bw as $n,ax as Ln,ad as _n,aQ as Un,a9 as Nt,G as De,ae as Je,bx as Gn,ac as zt,by as Zn,ao as Mn,K as Ht,w as On,bz as Nn,bA as zn,bB as Hn,bC as Wn,bD as qn,bE as Jn,bF as Yn,bG as Kn,bH as Xn,k as Qn,bI as ei,bq as ti,bJ as ai,ag as ni,bK as ii,g as oi}from"./index-Cvus_VBr.js";import{u as ue,n as _,S as li}from"./mui-ZKvbmPSP.js";import{A as ct}from"./AddressScreen-C0JLhAcE.js";import{g as ne,a as Ee,i as Wt,V as Ye,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-BqNLFPCz.js";import{a as g}from"./sentry-DvoFEQx8.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-D5Ew-Qzm.js";import{u as qt}from"./useInitialThreadRequest-mCNzqzEf.js";import{u as di}from"./BusinessVerificationPageScreen-D1nbOYUs.js";import Ae from"./NotFoundScreen-BR0tBeJN.js";import{D as ui}from"./DrawerScreen-CjvLDWWa.js";import{M as Jt}from"./MobileAppDrawer-CPwvCIYa.js";import{F as Yt}from"./FeaturePreviewScreen-t6-81tB3.js";import{S as Te}from"./SetupPagesScreen-fiQdFdcd.js";import{B as pi}from"./BillPayApprovalRoutes-DzF0eyUE.js";import{F as mi}from"./ScreenRoutes-BxsiowEM.js";import"./recharts-UmMlzZlF.js";import"./analytics-BE49_JfE.js";import"./plaid-tDbexfSh.js";import"./dnd-LSyMQh_7.js";import"./stripe-cKAAJElX.js";import"./lottie-Z_NAxrmn.js";import"./lexical-BG-nDmQN.js";import"./pdf-_w1KRTSP.js";import"./utils-D06mHID-.js";import"./routePaths-ME1g30cL.js";import"./InboxNotificationsProvider--Aami2sh.js";import"./useTaskManagerAccess-CcPTnvTg.js";import"./analyticsHelper-DZVn8KPX.js";import"./ReimbursementApprovalRuleDetailScreen-D0_gOHEu.js";import"./getLocaleForTenant-DZAPKjbH.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]="72a6a826-e40b-4d2e-b9e6-459aaee1e2e6",e._sentryDebugIdIdentifier="sentry-dbid-72a6a826-e40b-4d2e-b9e6-459aaee1e2e6")}catch{}})();const bi=X((function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=W(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Be(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(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:E,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=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(Ct(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=W(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Bt({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))(Vn);function hi(){const e=Y(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>q(U))),s=v((U=>_e(U,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}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,B]=g.useState(!1),[I,j]=g.useState(!1),[A,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),Z=h&&de(u?.loggedInUserRoleMap),L=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||Z||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,Z,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(B(!0),t(wt(n??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,O,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{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 ${C.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ce,{analytics:E,onLoad:U=>(M=>{n!=null&&M.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:A,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Nt(100,58)},ut=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:C.sp10,paddingRight:C.sp3,paddingBottom:"15px",paddingLeft:C.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Me(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Ze(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=Y(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:B}=p(We.zeniAssistConfig),I=B.user_ids!=null&&i?.userId!=null&&B.user_ids.includes(i?.userId),j=v((P=>q(P)));di();const[A,T]=g.useState(!1),[k,$]=g.useState(!1),[O,G]=g.useState(!1),[N,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let Z=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(Z=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Ze(!0))}),[n,t]),g.useEffect((()=>{Z==="Not-Started"&&(u&&k?$(!1):!u&&A&&T(!1))}),[n]),g.useEffect((()=>{A||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[A,k,u,n,t,S,I,b]);const M={onOkClick:()=>{if(G(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Me(N,m,n))},onCancelClick:()=>{if(G(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:N,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Z==="Error"||J.fetchState==="Error")return a.jsx(Ae,{});if(Z!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Kt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:M,isEditPopup:!0}):null,o==="small"||H?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(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(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-BYqz0SWy.js";import{h as Y,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-B1R51LGS.js";import{fI as q,YS as _e,bq as It,SR as ia,bo as vt,bK as de,YT as kt,Hr as wt,IQ as Re,I2 as oa,bn as Be,YU as la,YV as sa,c9 as ra,YW as ca,m3 as xt,YX as At,YY as Bt,Ji as Ue,HK as xe,YZ as da,Hf as et,Y_ as ua,Na as pa,Hj as ma,Hp as Ct,Y$ as Se,Z0 as Ge,IR as Ze,HH as Dt,Z1 as ba,Z2 as ha,IU as Me,Z3 as ga,I_ as Sa,Z4 as Et,It as tt,Iy as ya,Z5 as fa,Z6 as ce,Z7 as Tt,Z8 as jt,Z9 as Pt,gZ as Ia,HP as Ve,cH as Ft,Za as va,gk as ka,Zb as wa,Zc as xa,e0 as Rt,d$ as Vt,Zd as Oe,Ze as Aa,Zf as Ba,Xq as Ne,Zg as Ca,Xr as ie,Xs as ze,Zh as Da,Zi as Ea,Zj as Ta,IA as at,Ix as ja,Zk as Pa,Zl as Fa,Zm as Ra,Ij as Va,Zn as $a,Zo as La,cv as $t,db as Lt,me as _a,bP as Ua,br as _t,bQ as Ut,Gv as Ga,Zp as Za,MZ as Ma,N3 as Oa,CA as Na,IS as za,Jp as Ha,mr as ge,Zq as Wa,Zr as Gt,mV as qa,ml as Zt,mG as Mt,mF as nt,bF as pe,bO as Ja,Zs as Ya,Zt as ye,kR as Ka,Zu as it,Zv as Xa,kV as Qa,le as en,JD as tn,Zw as an,mO as nn,Jt as on,Zx as ot,Jx as ln,JC as sn,JA as rn,Jr as cn,Zy as Ot,HA as dn,Zz as un,ZA as pn,gJ as mn,gI as bn,gH as hn,mu as gn,mM as lt,mX as Sn,v2 as yn,mD as fn,Jv as In,k$ as vn,n0 as kn,ZB as wn,kT as xn,uV as An,ZC as Bn,Ip as Cn,bL as Dn,bu as En,UR as Tn,de as jn,dd as Pn,cG as Fn,cN as Rn}from"./zeni-epic-state-M9sMLOaG.js";import{z as V,V as fe,aq as He,c as oe,$ as f,bg as We,a5 as se,E as C,a6 as Ce,l as E,bt as Vn,a2 as W,at as qe,p as D,_ as Ie,bu as st,bv as rt,bw as $n,ax as Ln,ad as _n,aQ as Un,a9 as Nt,G as De,ae as Je,bx as Gn,ac as zt,by as Zn,ao as Mn,K as Ht,w as On,bz as Nn,bA as zn,bB as Hn,bC as Wn,bD as qn,bE as Jn,bF as Yn,bG as Kn,bH as Xn,k as Qn,bI as ei,bq as ti,bJ as ai,ag as ni,bK as ii,h as oi}from"./index-Dp_Uc3gy.js";import{u as ue,n as _,S as li}from"./mui-D-_RYGgU.js";import{A as ct}from"./AddressScreen-Ce6wpOqL.js";import{g as ne,a as Ee,i as Wt,V as Ye,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-CVJejZP9.js";import{a as g}from"./sentry-DjmIorbX.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DWkTPomv.js";import{u as qt}from"./useInitialThreadRequest-BaIZPAUw.js";import{u as di}from"./BusinessVerificationPageScreen-B6gKgGKZ.js";import Ae from"./NotFoundScreen-DDA41Ig7.js";import{D as ui}from"./DrawerScreen-Bev9sxN6.js";import{M as Jt}from"./MobileAppDrawer-CsfNveW9.js";import{F as Yt}from"./FeaturePreviewScreen-DETqyCpy.js";import{S as Te}from"./SetupPagesScreen-B0b-Fgla.js";import{B as pi}from"./BillPayApprovalRoutes-BLLQGNfF.js";import{F as mi}from"./ScreenRoutes-MAHnboyU.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";import"./routePaths-BALvGXpp.js";import"./InboxNotificationsProvider-LdTK3V9o.js";import"./useTaskManagerAccess-CFJAytRv.js";import"./analyticsHelper-BkudU6tc.js";import"./ReimbursementApprovalRuleDetailScreen-NQbCpzYz.js";import"./getLocaleForTenant-Nj4zPyxj.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]="2cc0f71b-fb29-4068-9105-e6169086ff64",e._sentryDebugIdIdentifier="sentry-dbid-2cc0f71b-fb29-4068-9105-e6169086ff64")}catch{}})();const bi=X((function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=W(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Be(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(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:E,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=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(Ct(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=W(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Bt({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))(Vn);function hi(){const e=Y(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>q(U))),s=v((U=>_e(U,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}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,B]=g.useState(!1),[I,j]=g.useState(!1),[A,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),Z=h&&de(u?.loggedInUserRoleMap),L=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||Z||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,Z,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(B(!0),t(wt(n??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,O,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{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 ${C.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ce,{analytics:E,onLoad:U=>(M=>{n!=null&&M.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:A,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Nt(100,58)},ut=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:C.sp10,paddingRight:C.sp3,paddingBottom:"15px",paddingLeft:C.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Me(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Ze(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=Y(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:B}=p(We.zeniAssistConfig),I=B.user_ids!=null&&i?.userId!=null&&B.user_ids.includes(i?.userId),j=v((P=>q(P)));di();const[A,T]=g.useState(!1),[k,$]=g.useState(!1),[O,G]=g.useState(!1),[N,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let Z=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(Z=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Ze(!0))}),[n,t]),g.useEffect((()=>{Z==="Not-Started"&&(u&&k?$(!1):!u&&A&&T(!1))}),[n]),g.useEffect((()=>{A||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[A,k,u,n,t,S,I,b]);const M={onOkClick:()=>{if(G(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Me(N,m,n))},onCancelClick:()=>{if(G(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:N,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Z==="Error"||J.fetchState==="Error")return a.jsx(Ae,{});if(Z!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Kt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:M,isEditPopup:!0}):null,o==="small"||H?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(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(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(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 pt=_.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{a as C}from"./sentry-DvoFEQx8.js";import{u as K,j as b,h as se,g as oe,i as ie,N as re,l as ce}from"./core-R1zvmcG1.js";import{fI as B,I5 as ue,Ij as de,Lv as le,Ol as pe,O$ as me,PQ as fe,ZK as ye,B$ as Se,SV as ge,ZL as Ie,ZM as be,ZN as he,ZO as Te,ZP as De,ZQ as Oe,VZ as Ce,YQ as ke,Wc as Ve,MH as Ae,Mz as we,Wd as Ne,MD as Fe,mL as ve,gJ as _e,gI as Ee,gH as xe,v2 as ze,uV as Be,uS as Pe,mD as Re,C8 as Le,C6 as P,bF as R,Ck as L,cF as Me}from"./zeni-epic-state-Mdu-dKQU.js";import{bR as Ue,V as Ze,Y as je,bg as Ge,z,a6 as Ke,l as M,r as E,K as x,bT as $e,ac as Qe,p as U,aE as Z}from"./index-Cvus_VBr.js";import{n as We}from"./mui-ZKvbmPSP.js";import{j as A}from"./liveblocks-DOdRxZ-H.js";import{d as j}from"./routePaths-ME1g30cL.js";import{M as qe}from"./MobileAppDrawer-CPwvCIYa.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e9d0da84-b1b7-4de3-970b-7134da004b40",e._sentryDebugIdIdentifier="sentry-dbid-e9d0da84-b1b7-4de3-970b-7134da004b40")}catch{}})();function it(){const e=K(),r=b((u=>B(u))),a=r?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Ue(a),p=b((u=>u.billPaySetupApproverViewState.fetchState));C.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function G(e,r,a,s=!1){switch(r){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const He=We.div`
1
+ import{a as C}from"./sentry-DjmIorbX.js";import{u as K,j as b,h as se,g as oe,i as ie,N as ce,l as re}from"./core-B1R51LGS.js";import{fI as B,I5 as ue,Ij as de,Lv as le,Ol as pe,O$ as me,PQ as fe,ZK as ye,B$ as Se,SV as ge,ZL as Ie,ZM as be,ZN as he,ZO as Te,ZP as De,ZQ as Oe,VZ as Ce,YQ as ke,Wc as Ve,MH as Ae,Mz as we,Wd as Ne,MD as Fe,mL as ve,gJ as _e,gI as Ee,gH as xe,v2 as ze,uV as Be,uS as Pe,mD as Re,C8 as Le,C6 as P,bF as R,Ck as L,cF as Me}from"./zeni-epic-state-M9sMLOaG.js";import{bR as Ue,V as Ze,c as je,bg as Ge,z,a6 as Ke,l as M,r as E,K as x,bT as $e,ac as Qe,p as U,aE as Z}from"./index-Dp_Uc3gy.js";import{n as We}from"./mui-D-_RYGgU.js";import{j as A}from"./liveblocks-BYqz0SWy.js";import{d as j}from"./routePaths-BALvGXpp.js";import{M as qe}from"./MobileAppDrawer-CsfNveW9.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},c=new e.Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="b28b3976-baac-4bc2-9146-2579b2077a48",e._sentryDebugIdIdentifier="sentry-dbid-b28b3976-baac-4bc2-9146-2579b2077a48")}catch{}})();function it(){const e=K(),c=b((u=>B(u))),a=c?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Ue(a),p=b((u=>u.billPaySetupApproverViewState.fetchState));C.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function G(e,c,a,s=!1){switch(c){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const He=We.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{a as C}from"./sentry-DvoFEQx8.js";import{u as K,j as b,h as se,g as oe,i
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,Ye=ce((function(e,r){const{businessVerificationDetails:a}=r,s=B(e),l=z.getSignedInUser(),p=s.tenantId,u={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:p??""},h=Ce(r.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${Qe.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:h,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,r){const{companyId:a,productType:s,currentTenant:l,navigate:p,location:u}=r,{tenantEmailDomain:h}=l;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:m,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:f,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:T,primaryContactSyncToken:D,syncToken:c,fileIds:O,incDate:n,typeOfIncorporation:g,stateOfIncorporation:w,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:I,companySourceOfFunds:$,companySourceOfFundsDescription:Q,transactionVolume:W,transactionVolumeDescription:q,purposeOfAccount:H,purposeOfAccountDescription:Y,regulatedStatus:J,regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te}=t,v=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:m.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:V,taxIdOrEIN:y,website:f!=""&&f!=null?Me(f):void 0,phone:S,syncToken:c,fileIds:O,incDate:n!=null?R(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:Z(_)))??[],companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:Q,transactionVolume:W?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:Y,regulatedStatus:J??"",regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:T,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:D};e(L({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((m=>{const{officerType:k,userId:V,name:y,email:f,nationalityCountryCode:S,ssn:d,dob:i,phone:T,syncToken:D,selectDocument:c,role:O,ownership:n,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F}=m;let I;return c.selectDocumentType==="driverLicense"?I="driving_license":c.selectDocumentType==="passport"?I="passport":c.selectDocumentType==="stateId"?I="id_document":c.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:f,ssn:d,nationalityCountryCode:S?.selectedOption!=null?Z(S.selectedOption):void 0,phone:T,birthday:i!=null?R(i?.toString()):i,syncToken:D,titleAtCompany:O.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(L({officers:o}))},onSaveDetailsClick:t=>{e(P(a,t,s))},onSendForVerificationClick:t=>{e(P(a,t,s,!0))},onAddressClick:t=>{const o=j(h,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:t=>{const o=j(h,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{e(Le({companyId:a})),p("../setup")},updateFilesEntity:t=>{e(Re({files:t}))},onDeleteFile:t=>{e(Pe(t))},onDeleteFileList:t=>{e(Be(t))},onEditFileName:(t,o)=>{e(ze(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(ve({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=Ne(t.documentType);o!=null&&e(Fe({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(we({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))($e),rt=({productType:e})=>{const r=se(),a=oe(),s=K(),[l,p]=C.useState(!1),[u,h]=C.useState(!1),{tenantEmailDomain:t}=ie(),o=Ze(),{useDynamicConfig:m}=je(),{configValue:k}=m(Ge.zeniAccountsConfig),V=ye(k),y=b((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),f=b((n=>n.companyConfigState.fetchState)),S=b((n=>n.userRoleConfigState.fetchState)),d=b((n=>B(n))),i=d.companyId??z.getSignedInUserTenant(t)?.companyId;C.useEffect((()=>{f==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[f,S,s]),C.useEffect((()=>{l||y!=="Not-Started"||i==null||(p(!0),G(s,e,i))}),[l,y,i,s]);const T=b((n=>{switch(e){case"zeni_accounts":return De(n,i);case"zeni_treasury":return Te(n,i);case"charge_cards":return he(n,i);case"reimbursement":return be(n,i);default:return Ie(n,i)}})),D=T.kycKybResetStatus.fetchState;if(C.useEffect((()=>{D==="Completed"&&i!=null&&(G(s,e,i,!0),s(Oe()))}),[D,i,e,s]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(e){case"zeni_accounts":c=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=n=>{h(n)};return c===!1?A.jsx(re,{to:"../promo"}):A.jsxs(He,{children:[A.jsx(Ke,{analytics:M,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(qe,{isAppContentDrawerOpen:u,handleDrawerToggle:O}):null,A.jsx(Ye,{businessVerificationDetails:T,navigate:r,location:a,companyId:i,analytics:M,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{rt as B,G as d,it as u};
9
+ `,Je=re((function(e,c){const{businessVerificationDetails:a}=c,s=B(e),l=z.getSignedInUser(),p=s.tenantId,u={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:p??""},h=Ce(c.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${Qe.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:h,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,c){const{companyId:a,productType:s,currentTenant:l,navigate:p,location:u}=c,{tenantEmailDomain:h}=l;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:m,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:f,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:T,primaryContactSyncToken:D,syncToken:r,fileIds:O,incDate:n,typeOfIncorporation:g,stateOfIncorporation:w,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:I,companySourceOfFunds:$,companySourceOfFundsDescription:Q,transactionVolume:W,transactionVolumeDescription:q,purposeOfAccount:H,purposeOfAccountDescription:J,regulatedStatus:Y,regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te}=t,v=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:m.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:V,taxIdOrEIN:y,website:f!=""&&f!=null?Me(f):void 0,phone:S,syncToken:r,fileIds:O,incDate:n!=null?R(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:Z(_)))??[],companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:Q,transactionVolume:W?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:Y??"",regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:T,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:D};e(L({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((m=>{const{officerType:k,userId:V,name:y,email:f,nationalityCountryCode:S,ssn:d,dob:i,phone:T,syncToken:D,selectDocument:r,role:O,ownership:n,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F}=m;let I;return r.selectDocumentType==="driverLicense"?I="driving_license":r.selectDocumentType==="passport"?I="passport":r.selectDocumentType==="stateId"?I="id_document":r.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:f,ssn:d,nationalityCountryCode:S?.selectedOption!=null?Z(S.selectedOption):void 0,phone:T,birthday:i!=null?R(i?.toString()):i,syncToken:D,titleAtCompany:O.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(L({officers:o}))},onSaveDetailsClick:t=>{e(P(a,t,s))},onSendForVerificationClick:t=>{e(P(a,t,s,!0))},onAddressClick:t=>{const o=j(h,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:t=>{const o=j(h,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{e(Le({companyId:a})),p("../setup")},updateFilesEntity:t=>{e(Re({files:t}))},onDeleteFile:t=>{e(Pe(t))},onDeleteFileList:t=>{e(Be(t))},onEditFileName:(t,o)=>{e(ze(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(ve({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=Ne(t.documentType);o!=null&&e(Fe({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(we({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))($e),ct=({productType:e})=>{const c=se(),a=oe(),s=K(),[l,p]=C.useState(!1),[u,h]=C.useState(!1),{tenantEmailDomain:t}=ie(),o=Ze(),{useDynamicConfig:m}=je(),{configValue:k}=m(Ge.zeniAccountsConfig),V=ye(k),y=b((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),f=b((n=>n.companyConfigState.fetchState)),S=b((n=>n.userRoleConfigState.fetchState)),d=b((n=>B(n))),i=d.companyId??z.getSignedInUserTenant(t)?.companyId;C.useEffect((()=>{f==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[f,S,s]),C.useEffect((()=>{l||y!=="Not-Started"||i==null||(p(!0),G(s,e,i))}),[l,y,i,s]);const T=b((n=>{switch(e){case"zeni_accounts":return De(n,i);case"zeni_treasury":return Te(n,i);case"charge_cards":return he(n,i);case"reimbursement":return be(n,i);default:return Ie(n,i)}})),D=T.kycKybResetStatus.fetchState;if(C.useEffect((()=>{D==="Completed"&&i!=null&&(G(s,e,i,!0),s(Oe()))}),[D,i,e,s]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let r;switch(e){case"zeni_accounts":r=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":r=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":r=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":r=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:r=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=n=>{h(n)};return r===!1?A.jsx(ce,{to:"../promo"}):A.jsxs(He,{children:[A.jsx(Ke,{analytics:M,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(qe,{isAppContentDrawerOpen:u,handleDrawerToggle:O}):null,A.jsx(Je,{businessVerificationDetails:T,navigate:c,location:a,companyId:i,analytics:M,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{ct as B,G as d,it as u};
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-DOdRxZ-H.js";import{a as r}from"./sentry-DvoFEQx8.js";import{u as he,h as Ce,g as fe,j as H,i as ge,l as Se}from"./core-R1zvmcG1.js";import{e5 as be,a as Pe,e6 as ye,z as Ie,e8 as we,ea as W,eb as Ee,bm as G,a6 as ke,l as F,ec as M,em as xe,G as Ae,K as Te,w as Ue,ef as Oe,eg as _e,at as ve,ej as Qe,ek as je,bi as De,el as Fe}from"./index-Cvus_VBr.js";import{gN as $e,fH as J,fI as Le,gb as Ve,jp as Re,jl as qe,fJ as N,gx as Be,gr as He,gt as z,gz as Me,gA as Ne,gB as ze,gC as We,gD as Ge}from"./zeni-epic-state-Mdu-dKQU.js";import{D as Je,n as L,v as Ke,S as Ye}from"./mui-ZKvbmPSP.js";import"./recharts-UmMlzZlF.js";import"./analytics-BE49_JfE.js";import"./plaid-tDbexfSh.js";import"./dnd-LSyMQh_7.js";import"./stripe-cKAAJElX.js";import"./lottie-Z_NAxrmn.js";import"./lexical-BG-nDmQN.js";import"./pdf-_w1KRTSP.js";import"./utils-D06mHID-.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="cd9264e4-1f89-4795-81c1-51a5b5192752",t._sentryDebugIdIdentifier="sentry-dbid-cd9264e4-1f89-4795-81c1-51a5b5192752")}catch{}})();const K="chat-response-generated",Y="cards/ask",X="card_policy_hero";function $(t){return`/${t}/cards`}function Z(t){return`/${t}/cards/policy`}const Xe=Se((function(t,s){const d=J(t),l=s.isSubmitting,u=_e(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&d.uiState.currentChatSessionId==null,aiCfoView:d,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${ve}/tableDownload`,exportDownloadEndPoint:Qe(),emailLinkQuestion:s.emailLinkQuestion,autoSubmitEmailLinkQuestion:s.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:s.onEmailLinkQuestionProcessed,isFileUploadEnabled:s.isFileUploadEnabled,isUploadPromoVisible:s.isUploadPromoVisible,onUploadPromoClose:s.onUploadPromoClose,...u}}),(function(t,s){const{location:d,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,cardPolicyPageContext:T}=s,f=l.tenantEmailDomain,c=d.state?.referrer,h=c===X?Z(f):$(f);return{onEventReceived:(a,n)=>{if(a===K&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=Ne(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(C,y);m!=="answer"?F.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,Fe(p,U),e.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,ze(e.visualization?.type??"")??null,y,e.summarized_title,e.metadata.message_id??null),t(We({chatSessionId:e.metadata.chat_session_id,responseType:m,fetchState:{fetchState:"Completed",error:void 0}})),t(Ge({chatSessionId:e.metadata.chat_session_id,answerPayload:e,userId:u}))}},onSubmit:(a,n,e,m)=>{a&&De(t,a,n,P,C,u,m,e,T)},updateCurrentInput:a=>{t(z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(Me(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...d.state}}),t(z(""))},togglePageView:()=>{o(h,{state:W(d.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(He()),o((function(a){return`/${a}/${Y}`})(f),{state:{...d.state}})},onToggleCotCollapsed:(a,n)=>{t(Be({questionAnswerId:a,isCollapsed:n}))},...je(t,{isAiCardCreationEnabled:x,isCardPolicyEnabled:A,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(f),{state:{...d.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${f}/cards/policy`,{state:{...d.state}})}})}}))(Ue(Oe)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Ae.getLocalizedStrings(),k=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:d}=Pe(),l=he(),u=Ce(),o=fe(),[P,C]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,onCardPolicyVendorSearchTextChange:f}=ye();r.useEffect((()=>{l($e())}),[l]);const c=H((i=>J(i))),h=Ie.getSignedInUser(),{session_id:a}=ge(),n=H((i=>Le(i))),e=c.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=we({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,O=!!b?.aiCfoShouldSubmit,I=b?.referrer===X,se=I?"card_policy":void 0,ae=r.useMemo((()=>({title:I?Ze:k,subtitle:I?tt:et})),[I]),[oe,_]=r.useState(null),[ne,v]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(_(p),v(O),Q.current=!0)}),[p,O]);const ie=r.useCallback((()=>{_(null),v(!1),u(o.pathname,{replace:!0,state:W(o.state)})}),[o.pathname,o.state,u]),re=n.masterTOSInfo,g=re?.isMasterTOSAccepted??!1,E=r.useRef(null);r.useEffect((()=>{if(g&&E.current!=null){const{question:i,shouldSubmit:w}=E.current;E.current=null,_(i),v(w),Q.current=!1}}),[g]);const{visitedSessions:V}=Ee(e),j=c.fetchState,D=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,R=e!=null?c.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",q=e==null||(c.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),B=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(B,e),de=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,w){return`/${i}/${Y}/${w}`})(m,e),{state:{...o.state},replace:!0})}),[e,a,m,u,o.state]),r.useEffect((()=>{a!=null&&e==null&&a!=="new_chat"&&l(Ve({sessionId:a,agentId:"controller"}))}),[]);const ce=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${K}`)),eventCallback:(i,w,pe)=>pe.onEventReceived(i,w)})),[V]);if(r.useEffect((()=>{j!=="In-Progress"&&D&&l(Re())}),[j,D,l]),r.useEffect((()=>{e!=null&&R!=="In-Progress"&&q&&h!=null&&j==="Completed"&&!D&&l(qe(e,h.userId))}),[R,q,e,h,l]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ue=a??"new_chat",me=e!=null&&c.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return S.jsxs(at,{children:[S.jsx(ke,{analytics:F,onLoad:i=>i.trackPageLoaded(Te.Event.aiCFOPage)}),g?S.jsx(Xe,{answerExportEndPoint:s,...ce,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:B,allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,openOnboardingPage:()=>C(!0),userId:h.userId,setIsAiCfoOpen:d,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:de,customPageTitle:k,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:f,cardPolicyPageContext:se}):S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{u(I?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:O}),l(N(n.userRoleId)))}}),S.jsx(Je,{anchor:"right",open:P,transitionDuration:250,PaperProps:{component:ot,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>C(!1),children:S.jsx(st,{onClick:i=>i.stopPropagation(),children:S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>C(!1),onCompleteClick:()=>{g||n.userRoleId==null||l(N(n.userRoleId)),C(!1)}})})})]})},st=L(Ye)`
1
+ import{j as S}from"./liveblocks-BYqz0SWy.js";import{a as r}from"./sentry-DjmIorbX.js";import{u as he,h as Ce,g as fe,j as H,i as ge,l as Se}from"./core-B1R51LGS.js";import{e5 as be,a as Pe,e6 as ye,z as Ie,e8 as we,ea as W,eb as Ee,bm as G,a6 as ke,l as F,ec as M,em as xe,G as Ae,K as Te,w as Ue,ef as Oe,eg as _e,at as ve,ej as Qe,ek as je,bi as De,el as Fe}from"./index-Dp_Uc3gy.js";import{gN as $e,fH as J,fI as Le,gb as Ve,jp as Re,jl as qe,fJ as N,gx as Be,gr as He,gt as z,gz as Me,gA as Ne,gB as ze,gC as We,gD as Ge}from"./zeni-epic-state-M9sMLOaG.js";import{D as Je,n as L,v as Ke,S as Ye}from"./mui-D-_RYGgU.js";import"./recharts-By7FVN8f.js";import"./analytics-DhotUQIQ.js";import"./plaid-B0PWXAfV.js";import"./dnd-CBDtHD8g.js";import"./stripe-cKAAJElX.js";import"./lottie-C4orech3.js";import"./lexical-Cft6chCX.js";import"./pdf-DFgrdLB6.js";import"./utils-iOnDyQuG.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="cd9264e4-1f89-4795-81c1-51a5b5192752",t._sentryDebugIdIdentifier="sentry-dbid-cd9264e4-1f89-4795-81c1-51a5b5192752")}catch{}})();const K="chat-response-generated",Y="cards/ask",X="card_policy_hero";function $(t){return`/${t}/cards`}function Z(t){return`/${t}/cards/policy`}const Xe=Se((function(t,s){const d=J(t),l=s.isSubmitting,u=_e(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&d.uiState.currentChatSessionId==null,aiCfoView:d,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${ve}/tableDownload`,exportDownloadEndPoint:Qe(),emailLinkQuestion:s.emailLinkQuestion,autoSubmitEmailLinkQuestion:s.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:s.onEmailLinkQuestionProcessed,isFileUploadEnabled:s.isFileUploadEnabled,isUploadPromoVisible:s.isUploadPromoVisible,onUploadPromoClose:s.onUploadPromoClose,...u}}),(function(t,s){const{location:d,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,cardPolicyPageContext:T}=s,f=l.tenantEmailDomain,c=d.state?.referrer,h=c===X?Z(f):$(f);return{onEventReceived:(a,n)=>{if(a===K&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=Ne(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(C,y);m!=="answer"?F.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,Fe(p,U),e.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,ze(e.visualization?.type??"")??null,y,e.summarized_title,e.metadata.message_id??null),t(We({chatSessionId:e.metadata.chat_session_id,responseType:m,fetchState:{fetchState:"Completed",error:void 0}})),t(Ge({chatSessionId:e.metadata.chat_session_id,answerPayload:e,userId:u}))}},onSubmit:(a,n,e,m)=>{a&&De(t,a,n,P,C,u,m,e,T)},updateCurrentInput:a=>{t(z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(Me(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...d.state}}),t(z(""))},togglePageView:()=>{o(h,{state:W(d.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(He()),o((function(a){return`/${a}/${Y}`})(f),{state:{...d.state}})},onToggleCotCollapsed:(a,n)=>{t(Be({questionAnswerId:a,isCollapsed:n}))},...je(t,{isAiCardCreationEnabled:x,isCardPolicyEnabled:A,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(f),{state:{...d.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${f}/cards/policy`,{state:{...d.state}})}})}}))(Ue(Oe)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Ae.getLocalizedStrings(),k=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:d}=Pe(),l=he(),u=Ce(),o=fe(),[P,C]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,onCardPolicyVendorSearchTextChange:f}=ye();r.useEffect((()=>{l($e())}),[l]);const c=H((i=>J(i))),h=Ie.getSignedInUser(),{session_id:a}=ge(),n=H((i=>Le(i))),e=c.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=we({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,O=!!b?.aiCfoShouldSubmit,I=b?.referrer===X,se=I?"card_policy":void 0,ae=r.useMemo((()=>({title:I?Ze:k,subtitle:I?tt:et})),[I]),[oe,_]=r.useState(null),[ne,v]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(_(p),v(O),Q.current=!0)}),[p,O]);const ie=r.useCallback((()=>{_(null),v(!1),u(o.pathname,{replace:!0,state:W(o.state)})}),[o.pathname,o.state,u]),re=n.masterTOSInfo,g=re?.isMasterTOSAccepted??!1,E=r.useRef(null);r.useEffect((()=>{if(g&&E.current!=null){const{question:i,shouldSubmit:w}=E.current;E.current=null,_(i),v(w),Q.current=!1}}),[g]);const{visitedSessions:V}=Ee(e),j=c.fetchState,D=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,R=e!=null?c.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",q=e==null||(c.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),B=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(B,e),de=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,w){return`/${i}/${Y}/${w}`})(m,e),{state:{...o.state},replace:!0})}),[e,a,m,u,o.state]),r.useEffect((()=>{a!=null&&e==null&&a!=="new_chat"&&l(Ve({sessionId:a,agentId:"controller"}))}),[]);const ce=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${K}`)),eventCallback:(i,w,pe)=>pe.onEventReceived(i,w)})),[V]);if(r.useEffect((()=>{j!=="In-Progress"&&D&&l(Re())}),[j,D,l]),r.useEffect((()=>{e!=null&&R!=="In-Progress"&&q&&h!=null&&j==="Completed"&&!D&&l(qe(e,h.userId))}),[R,q,e,h,l]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ue=a??"new_chat",me=e!=null&&c.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return S.jsxs(at,{children:[S.jsx(ke,{analytics:F,onLoad:i=>i.trackPageLoaded(Te.Event.aiCFOPage)}),g?S.jsx(Xe,{answerExportEndPoint:s,...ce,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:B,allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,openOnboardingPage:()=>C(!0),userId:h.userId,setIsAiCfoOpen:d,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:de,customPageTitle:k,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:f,cardPolicyPageContext:se}):S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{u(I?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:O}),l(N(n.userRoleId)))}}),S.jsx(Je,{anchor:"right",open:P,transitionDuration:250,PaperProps:{component:ot,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>C(!1),children:S.jsx(st,{onClick:i=>i.stopPropagation(),children:S.jsx(M,{isTOSAccepted:g,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>C(!1),onCompleteClick:()=>{g||n.userRoleId==null||l(N(n.userRoleId)),C(!1)}})})})]})},st=L(Ye)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;