@zeniai/web-app-ui 5.3.84-prod → 5.3.85-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 (130) hide show
  1. package/dist/assets/{AccountMappingScreen-Da9lNgTh.js → AccountMappingScreen-VlkHI3xY.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-Cme87N6F.js → ActualMatchingMatchDetailScreen-D2w0402Y.js} +1 -1
  3. package/dist/assets/AddressRoutes-ChEkAt9U.js +1 -0
  4. package/dist/assets/AddressScreen-Ddq_CqzP.js +9 -0
  5. package/dist/assets/{AiCfoScreen-CmeUs6M1.js → AiCfoScreen-DZMyDWi7.js} +1 -1
  6. package/dist/assets/{AppDrawer-BvSnr3LW.js → AppDrawer-DgKtqckJ.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-C7ELb8IL.js → BillPayApprovalRoutes-BNUUByv0.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-2a_IZnwa.js → BillPayRoutes-C6ApjpPQ.js} +8 -8
  9. package/dist/assets/{BusinessVerificationPageScreen-BMy0l7mH.js → BusinessVerificationPageScreen-Bt2MC2-R.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-CqoF74R8.js → CardsAiCfoScreen-rZP4bSgz.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-BRLKWsqh.js → ChargeCardRoutes-B-GJ-Bri.js} +7 -7
  12. package/dist/assets/CompanyPassportScreen-Bzj5vwX-.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-BYY41VkQ.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-D2U3ohrN.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-C-xGwLOY.js → CustomerOnboardingRoutes-DKZXnZ66.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-B204TMlK.js → DashboardRoutes-DG0LnHD5.js} +1 -1
  17. package/dist/assets/{DefaultTenantHome-MEymJr7l.js → DefaultTenantHome-BfkBFl-w.js} +1 -1
  18. package/dist/assets/DomesticWireDetailScreen-DHQbDcNG.js +18 -0
  19. package/dist/assets/{DrawerScreen-D-EbmxsO.js → DrawerScreen-FFX6peDV.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-DJQtBHmg.js → EntityDetailRoutes-DfxLoaAu.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-DndYYpK4.js → ExpenseAutomationRoutes-BvSgjc7b.js} +7 -7
  22. package/dist/assets/FeaturePreviewScreen-BKEnTrse.js +1 -0
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-DUPKhb1k.js → HubSpotOAuthCallbackScreen-mZJfTUzG.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-BPTkk56Z.js → InboxNotificationsProvider-DTx76-7a.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-BegsYwP5.js → InvoicingRoutes-7dd3ECkW.js} +1 -1
  26. package/dist/assets/{MagicLinkRoutes-DGnkgyIy.js → MagicLinkRoutes-BePEhm0H.js} +21 -21
  27. package/dist/assets/MagicLinkSignInScreen-DdBVqdZ6.js +12 -0
  28. package/dist/assets/MobileAppDrawer-B-LrFFrs.js +1 -0
  29. package/dist/assets/NotFoundScreen-D7YKuY7u.js +1 -0
  30. package/dist/assets/{NotificationRoutes-yv8wAOZf.js → NotificationRoutes-DtJvpFLz.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-BiUYup5g.js → OAuthConsentScreen-BlNpiX2k.js} +1 -1
  32. package/dist/assets/{PandLWithForecastRoutes-CdbkRZNP.js → PandLWithForecastRoutes-g9ft1qXA.js} +1 -1
  33. package/dist/assets/{PaymentLinkScreen-exmyEd7O.js → PaymentLinkScreen-9YlFVhJT.js} +5 -5
  34. package/dist/assets/{PeopleRoutes-CIibObVn.js → PeopleRoutes-CAteVI0g.js} +3 -3
  35. package/dist/assets/PerformanceRoutes-CGryxKcT.js +1 -0
  36. package/dist/assets/{Preview-CNq1BOL1.js → Preview-DCDdGY49.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-DCCiwBvr.js → QBOConnectionScreen-DRJ9l1ZN.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-f7b2MUNz.js → ReimbursementApprovalRoutes-CJHSclit.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-ZIBaIx9-.js → ReimbursementApprovalRuleDetailScreen-BSbU5iHI.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-Cx2mA5oI.js → ReimbursementRoutes-CwwSdr2n.js} +6 -6
  41. package/dist/assets/{ReportsRoutes-D_y8Fj_V.js → ReportsRoutes-C2Jb5zyi.js} +1 -1
  42. package/dist/assets/RewardsRoutes-BWyKBIYZ.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-DCKvd2Rw.js → ScheduleDetailsPrepaidExpensesScreen-DX-YxATr.js} +1 -1
  44. package/dist/assets/ScreenRoutes-DN7T70Gm.js +2 -0
  45. package/dist/assets/{SettingsRoutes-DJySqZaP.js → SettingsRoutes-Bfs7XUiH.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-DIAlz55b.js → SetupPagesScreen-C1bkOzJr.js} +1 -1
  47. package/dist/assets/SignInScreen-BKWATPtE.js +1 -0
  48. package/dist/assets/SignOutScreen-TJtfwdGX.js +9 -0
  49. package/dist/assets/{TaskListScreen-CDkR9GBn.js → TaskListScreen-DvcC1URP.js} +2 -2
  50. package/dist/assets/TaskRoutes-DORm-aw2.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-8PpDu4Rs.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-Db4tleaR.js → TransactionDetailScreen-1ibKq26Q.js} +1 -1
  53. package/dist/assets/{TransactionListRoutes-Bou1SXH0.js → TransactionListRoutes-DLxmG7Ta.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-CAU50PuC.js → TreasuryRoutes-CLEbVEMG.js} +1 -1
  55. package/dist/assets/{VendorsRoutes-B0jpUEsr.js → VendorsRoutes-DB9yoziH.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-C7rNKySw.js → WiseConfirmationScreen-UrofaKPf.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-rvEU6aIV.js → ZeniAccountRoutes-YvPOvTvu.js} +9 -9
  58. package/dist/assets/{ZeniAccountStatementScreen-Bx3EGjPX.js → ZeniAccountStatementScreen-25uaLk4M.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-CwsbX9Ea.js → accountMappingHelper-C4sKhzhY.js} +1 -1
  60. package/dist/assets/{analytics-BXM45nWq.js → analytics-DgOwHMv9.js} +1 -1
  61. package/dist/assets/{analyticsHelper-Cx6i8svJ.js → analyticsHelper-DeEJJP1T.js} +1 -1
  62. package/dist/assets/{core-C81VRbeP.js → core-CKdWu7C4.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-CrALq_f_.js → decodeURIComponentSafe-De-pfuHA.js} +1 -1
  64. package/dist/assets/{dnd-BdXAZjIP.js → dnd-GMAnxo5D.js} +1 -1
  65. package/dist/assets/{empty-CCGHlGh0.js → empty-CCBmgRCN.js} +1 -1
  66. package/dist/assets/{empty-CatVTIO7.js → empty-DZ4e7m7E.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-B0T9fl5M.js → emptyVideoElement-CjciNHh4.js} +1 -1
  68. package/dist/assets/{epic-D-qeSG0v.js → epic-DaFddCaZ.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-Crya3Dv_.js → expenseAutomationHelper-QjlEGiQT.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-nCPleYdt.js → getLocaleForTenant-BykJ4K_E.js} +1 -1
  71. package/dist/assets/{index--a-B3LAp.js → index-8yj575lF.js} +1 -1
  72. package/dist/assets/{index-BMGzjwLG.js → index-B-KqmJJm.js} +1 -1
  73. package/dist/assets/{index-CF1zoe-f.js → index-BZQtvi2u.js} +1 -1
  74. package/dist/assets/{index-CUVRvOQe.js → index-BunveEom.js} +1 -1
  75. package/dist/assets/{index-DE2jmi6G.js → index-D6kwssUw.js} +1 -1
  76. package/dist/assets/{index-B42hg9O2.js → index-DUEtWU0V.js} +2 -2
  77. package/dist/assets/{index-DBuws41Q.js → index-DpMage3e.js} +13860 -13846
  78. package/dist/assets/{index-Ba_1Hknz.js → index-ph4OiQVe.js} +1 -1
  79. package/dist/assets/{lexical-DcaHthb5.js → lexical-Bbndsy_i.js} +1 -1
  80. package/dist/assets/{liveblocks-ElMRERc9.js → liveblocks-CiRsIXv9.js} +1 -1
  81. package/dist/assets/{lottie-B6h9ACvw.js → lottie-Bk0D-wP9.js} +1 -1
  82. package/dist/assets/{mui-DoMnHjRT.js → mui-uBLtQnjV.js} +1 -1
  83. package/dist/assets/{pathToGoBack-CArS3X2C.js → pathToGoBack-B8jPctZc.js} +1 -1
  84. package/dist/assets/{pdf-DFrRjL7N.js → pdf-C6vaCCoi.js} +3 -3
  85. package/dist/assets/{pdf-lib-NwhHokxt.js → pdf-lib-xbfYrsmJ.js} +1 -1
  86. package/dist/assets/{plaid-4usmEsnw.js → plaid-BNZ1yRTN.js} +1 -1
  87. package/dist/assets/{pusher-B9pbrwG6.js → pusher-BxkxzHUj.js} +1 -1
  88. package/dist/assets/{react-DMYtvh_5.js → react-ABdSIYHq.js} +1 -1
  89. package/dist/assets/{react-BlNQJp9p.js → react-DDSLhBDZ.js} +1 -1
  90. package/dist/assets/{react-Rj0qpQ1t.js → react-DJjTf4Q5.js} +1 -1
  91. package/dist/assets/{react-B76u7RNU.js → react-jCicCcT0.js} +1 -1
  92. package/dist/assets/{react-BzqY0M4o.js → react-nPQI4P7d.js} +1 -1
  93. package/dist/assets/{react-DPm5G7V9.js → react-siQwgdfv.js} +1 -1
  94. package/dist/assets/{recharts-DdTjw53U.js → recharts-CnFcvsiB.js} +1 -1
  95. package/dist/assets/{routePaths-CfxWxmyX.js → routePaths-Ld6pXFbh.js} +1 -1
  96. package/dist/assets/{sentry-B8nCx7v9.js → sentry-DyyEkQvE.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-YfV8OHUS.js → stripSplatSuffix-CLkpHspw.js} +1 -1
  98. package/dist/assets/{url-BjLh-KZK.js → url-BCdZ1CbH.js} +1 -1
  99. package/dist/assets/{url-CyEEo-3q.js → url-C7o4oPZz.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-DVb3aFLv.js → useActualMatchingMatchDetail-Dbi0I2OZ.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CdPJGZky.js → useAiCfoDashboardSuggestedQuestionsChips-WvX1r_Wk.js} +1 -1
  102. package/dist/assets/{useAskAiCfoHostNavButtonProps-CAip1ZNF.js → useAskAiCfoHostNavButtonProps-D35qbi_p.js} +1 -1
  103. package/dist/assets/{useChargeCardPusherEvents-BdQgr28p.js → useChargeCardPusherEvents-CvQP33nJ.js} +1 -1
  104. package/dist/assets/{useDeviceId-BHwBnu_B.js → useDeviceId-YV51-SzN.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-DLH0Ue8L.js → useEmailConnectResultRefresh-BnC-Kc6A.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-Df2EXypG.js → useInitialThreadRequest-D5CxaA02.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-BpFV6J8j.js → useTaskManagerAccess-Bvl8DVEY.js} +1 -1
  108. package/dist/assets/{useTaskManagerPusherEvents-iP182dSE.js → useTaskManagerPusherEvents-Dec5VxRR.js} +1 -1
  109. package/dist/assets/{utils-CSS89dSa.js → utils-RyVg9L9D.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-BP_l6766.js → withTransactionSidePanel-BRJU_73M.js} +1 -1
  111. package/dist/assets/{zeni-epic-state-DklVhJVB.js → zeni-epic-state-BuhfcA02.js} +3 -3
  112. package/dist/index.html +1 -1
  113. package/package.json +2 -2
  114. package/dist/assets/AddressRoutes-B_mWuw-F.js +0 -1
  115. package/dist/assets/AddressScreen-DFztK6Ig.js +0 -9
  116. package/dist/assets/CompanyPassportScreen-B6j95Qyx.js +0 -1
  117. package/dist/assets/ConnectionAuthScreen-DP7_3Lnx.js +0 -11
  118. package/dist/assets/CustomerOnboardingAuthScreen-BpjWikGb.js +0 -1
  119. package/dist/assets/DomesticWireDetailScreen-CBzt-Nae.js +0 -18
  120. package/dist/assets/FeaturePreviewScreen-Cu8urpMS.js +0 -1
  121. package/dist/assets/MagicLinkSignInScreen-Cb3CO89l.js +0 -12
  122. package/dist/assets/MobileAppDrawer-DtO8FQWm.js +0 -1
  123. package/dist/assets/NotFoundScreen-DHMPApWS.js +0 -1
  124. package/dist/assets/PerformanceRoutes-DRZwF4Om.js +0 -1
  125. package/dist/assets/RewardsRoutes-CDc0bjMu.js +0 -1
  126. package/dist/assets/ScreenRoutes-CU67IyZN.js +0 -2
  127. package/dist/assets/SignInScreen-BODRPfBX.js +0 -1
  128. package/dist/assets/SignOutScreen-Bi7O_J9b.js +0 -9
  129. package/dist/assets/TaskRoutes-CQdL9o7q.js +0 -9
  130. package/dist/assets/TransactionDetailRoutes-Cjl1b082.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as B}from"./liveblocks-ElMRERc9.js";import{a as o}from"./sentry-B8nCx7v9.js";import{h as Z,g as H,u as K,j as m,s as q,l as X}from"./core-C81VRbeP.js";import{ag as Y,W as ee,A as R,z as te,n as G,ah as ne,j as ae,Q as ce}from"./index-DBuws41Q.js";import{bn as se,fI as oe,gZ as ie,oF as Q,V8 as re,ic as J,gk as ue,ow as le,V9 as de,Va as pe,uh as ge,m3 as me,ou as be,oq as Ae,oB as Ie,ie as ye,Vb as fe,Vc as Se}from"./zeni-epic-state-DklVhJVB.js";import{n as he}from"./mui-DoMnHjRT.js";import{M as Ee}from"./MobileAppDrawer-DtO8FQWm.js";import{q as $}from"./QBOConnectionScreen-DCCiwBvr.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-CwsbX9Ea.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]="39675fab-b033-4b78-8d99-a03a0c710bcb",a._sentryDebugIdIdentifier="sentry-dbid-39675fab-b033-4b78-8d99-a03a0c710bcb")}catch{}})();const u="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},we=he.div`
1
+ import{j as B}from"./liveblocks-CiRsIXv9.js";import{a as o}from"./sentry-DyyEkQvE.js";import{h as Z,g as H,u as K,j as m,s as q,l as X}from"./core-CKdWu7C4.js";import{ag as Y,W as ee,A as R,z as te,n as J,ah as ne,j as ae,N as ce}from"./index-DpMage3e.js";import{bn as se,fI as oe,gZ as ie,oF as $,V8 as re,ic as Q,gk as ue,ow as le,V9 as de,Va as pe,uh as ge,m3 as me,ou as be,oq as Ae,oB as fe,ie as Ie,Vb as ye,Vc as Se}from"./zeni-epic-state-BuhfcA02.js";import{n as he}from"./mui-uBLtQnjV.js";import{M as Ee}from"./MobileAppDrawer-B-LrFFrs.js";import{q as G}from"./QBOConnectionScreen-DRJ9l1ZN.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-C4sKhzhY.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]="e8b6418f-5ceb-4f95-8490-b4bf8b76f837",a._sentryDebugIdIdentifier="sentry-dbid-e8b6418f-5ceb-4f95-8490-b4bf8b76f837")}catch{}})();const u="zeni_pending_projects_enable",l={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-ElMRERc9.js";import{a as o}from"./sentry-B8nCx7v
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${a=>a.theme.colors.grey4};
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(u),c=i===l.pending||i===l.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:b}=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:M,expenseCategory1099:j}=C,A=h(e.accountMappingView.incomeAccountList,x.selectedOption),k=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,M.selectedOptions),f=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:A?.accountId,selectedExpenseAccountId:k?.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()),b&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(Ie(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(u);d===l.pending||d===l.ready||a(r?be(e.currentTenant.companyId):Ae(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Y(),e=Z(),i=H(),c=K(),{useFeatureGate:b,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=b(R.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=b(R.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),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),j=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,W]=g[0]??[];S!=null&&c(Q(s.companyId,S,W,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),A=m((t=>re(t.accountState)),q),k=o.useMemo((()=>{const t={};for(const n of A)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[A]),[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(u)===l.pending&&(sessionStorage.removeItem(u),c(ue({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(u)===l.ready&&s?.companyId!=null&&(sessionStorage.removeItem(u),c(le(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(u,l.pending),c(de()),$.init("/connection/auth",s.tenantEmailDomain),$.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:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:G(i),onClickMenuIcon:()=>f(!0)})]})};export{u as P,_e as U,l 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(u),c=i===l.pending||i===l.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:b}=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:M,expenseCategory1099:j}=C,A=h(e.accountMappingView.incomeAccountList,x.selectedOption),k=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=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),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:A?.accountId,selectedExpenseAccountId:k?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:D.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{J(c)===!1?(i("../../dashboard"),a(ye())):a(Q())},onSaveClick:()=>{a(Ie()),b&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(fe(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(u);d===l.pending||d===l.ready||a(r?be(e.currentTenant.companyId):Ae(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Y(),e=Z(),i=H(),c=K(),{useFeatureGate:b,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=b(R.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=b(R.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),M=o.useCallback(((t,n)=>{c($(s.companyId,t,n))}),[c,s.companyId]),j=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,W]=g[0]??[];S!=null&&c($(s.companyId,S,W,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),A=m((t=>re(t.accountState)),q),k=o.useMemo((()=>{const t={};for(const n of A)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[A]),[f,_]=o.useState(!1),[P,D]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(Q()),_(!0))}),[f]);const I=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(u)===l.pending&&(sessionStorage.removeItem(u),c(ue({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(u)===l.ready&&s?.companyId!=null&&(sessionStorage.removeItem(u),c(le(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(u,l.pending),c(de()),G.init("/connection/auth",s.tenantEmailDomain),G.handleClick())}),[I,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),y=t=>{D(t)};return B.jsxs(we,{children:[B.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),B.jsx(ve,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:C,capitalizableAccounts:V,accountNamesById:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:J(i),onClickMenuIcon:()=>y(!0)})]})};export{u as P,_e as U,l as a};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-ElMRERc9.js";import{a as y}from"./sentry-B8nCx7v9.js";import{a2 as A,dN as R}from"./index-DBuws41Q.js";import"./mui-DoMnHjRT.js";import{u as F}from"./useActualMatchingMatchDetail-DVb3aFLv.js";import b from"./NotFoundScreen-DHMPApWS.js";import{i as P,h as U,g as w}from"./core-C81VRbeP.js";import"./zeni-epic-state-DklVhJVB.js";import"./recharts-DdTjw53U.js";import"./analytics-BXM45nWq.js";import"./plaid-4usmEsnw.js";import"./dnd-BdXAZjIP.js";import"./stripe-cKAAJElX.js";import"./lottie-B6h9ACvw.js";import"./lexical-DcaHthb5.js";import"./pdf-DFrRjL7N.js";import"./utils-CSS89dSa.js";import"./stripSplatSuffix-YfV8OHUS.js";import"./decodeURIComponentSafe-CrALq_f_.js";import"./routePaths-CfxWxmyX.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-CiRsIXv9.js";import{a as y}from"./sentry-DyyEkQvE.js";import{a2 as A,dN as R}from"./index-DpMage3e.js";import"./mui-uBLtQnjV.js";import{u as F}from"./useActualMatchingMatchDetail-Dbi0I2OZ.js";import b from"./NotFoundScreen-D7YKuY7u.js";import{i as P,h as U,g as w}from"./core-CKdWu7C4.js";import"./zeni-epic-state-BuhfcA02.js";import"./recharts-CnFcvsiB.js";import"./analytics-DgOwHMv9.js";import"./plaid-BNZ1yRTN.js";import"./dnd-GMAnxo5D.js";import"./stripe-cKAAJElX.js";import"./lottie-Bk0D-wP9.js";import"./lexical-Bbndsy_i.js";import"./pdf-C6vaCCoi.js";import"./utils-RyVg9L9D.js";import"./stripSplatSuffix-CLkpHspw.js";import"./decodeURIComponentSafe-De-pfuHA.js";import"./routePaths-Ld6pXFbh.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-CiRsIXv9.js";import{A as i}from"./AddressScreen-Ddq_CqzP.js";import s from"./NotFoundScreen-D7YKuY7u.js";import"./sentry-DyyEkQvE.js";import{n as d,o as r}from"./core-CKdWu7C4.js";import"./zeni-epic-state-BuhfcA02.js";import"./recharts-CnFcvsiB.js";import"./index-DpMage3e.js";import"./mui-uBLtQnjV.js";import"./analytics-DgOwHMv9.js";import"./plaid-BNZ1yRTN.js";import"./dnd-GMAnxo5D.js";import"./stripe-cKAAJElX.js";import"./lottie-Bk0D-wP9.js";import"./lexical-Bbndsy_i.js";import"./pdf-C6vaCCoi.js";import"./utils-RyVg9L9D.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};
@@ -0,0 +1,9 @@
1
+ import{j as r}from"./liveblocks-CiRsIXv9.js";import{a as h}from"./sentry-DyyEkQvE.js";import{h as A,u as T,g as j,i as E,j as $,l as B}from"./core-CKdWu7C4.js";import{$ as L,z as M,V,a5 as D,a6 as K,j as C,N as S,a1 as R,U as b,a2 as U}from"./index-DpMage3e.js";import{VP as _,it as N,fI as z,VQ as F,c9 as G,VR as O,mL as q}from"./zeni-epic-state-BuhfcA02.js";import{u as H,n as Q}from"./mui-uBLtQnjV.js";import J from"./NotFoundScreen-D7YKuY7u.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]="4815f497-008d-46ce-86e0-1e1b3e3175c5",e._sentryDebugIdIdentifier="sentry-dbid-4815f497-008d-46ce-86e0-1e1b3e3175c5")}catch{}})();const W=Q.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ `,X=B((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=z(e),a=s.roleMap!=null&&F(s.roleMap),n=i||c==="user_address"||G(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=O(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:n,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const d=_(e,o);return{addressToEdit:d.address,loadingState:d.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:n}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const n=i.state,d=U(n?.pathnameStackToGoBack);let t=d.poppedPathname??v();const u=n?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}o(t,{state:{pathnameStackToGoBack:d.newStack}})}};return{onSubmitHandler:a=>{const n=Y(a);e(q({addressType:c,addressToCreate:n})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(R);function re({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=A(),n=T(),d=j(),{addressId:t,addressType:u}=E(),g=L(),w=H(),I=M.getSignedInUser(),[p,k]=h.useState(t==null),f=$((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=V();if(I==null)throw Error("Can't access address page without signing in...");const P=m=>m.trackPageLoaded(t!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{p||t==null||(k(!0),n(N(t,!1)))}),[p,t,n]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address|invoicing_customer_billing_address|invoicing_subscription_shipping_address|invoicing_business_address)$/g)?!p&&f==="Not-Started"||p&&f==="In-Progress"?r.jsx(D,{fetchState:f,style:{backgroundColor:w.colors.grey5}}):t!=null&&f==="Error"?(a(`${v(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(K,{analytics:C,onLoad:P}),r.jsx(W,{windowSize:g,children:r.jsx(X,{location:d,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):r.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,Y as t};
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-ElMRERc9.js";import{a as n}from"./sentry-B8nCx7v9.js";import{u as Dt,h as Lt,i as Ft,g as Bt,j as v,l as Mt}from"./core-C81VRbeP.js";import{e4 as Nt,a as $t,v as Vt,e5 as Gt,z as Ht,$ as qt,e6 as zt,e7 as Wt,e8 as Yt,bn as Fe,e9 as We,ea as Jt,bm as Ye,a2 as ge,a6 as ce,j as N,eb as me,ec as Zt,ed as Kt,as as Xt,Q as es,w as ts,ee as ss,ef as ns,at as as,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Be,ek as ds}from"./index-DBuws41Q.js";import{fH as M,gw as R,Ux as cs,a2M as ms,a2N as Ss,jQ as hs,a2O as ps,jN as fs,a2P as Se,jt as J,jW as Z,jz as Ie,jg as he,je as gs,jY as Is,jI as Je,UG as Me,gy as $,gN as Cs,UF as ks,Uq as Ne,fI as bs,j7 as vs,a2Q as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a2R as Rs,a2S as Ts,a2T as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2U as He,jZ as Qs,ji as Us,jC as _s,jU as qe,jF as Ds,gA as Ls,gB as Fs,gC as Bs,gD as Ms}from"./zeni-epic-state-DklVhJVB.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-DoMnHjRT.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-CdPJGZky.js";import{p as Hs}from"./pathToGoBack-CArS3X2C.js";import{j as qs}from"./routePaths-CfxWxmyX.js";import{u as zs}from"./useTaskManagerPusherEvents-iP182dSE.js";import"./recharts-DdTjw53U.js";import"./analytics-BXM45nWq.js";import"./plaid-4usmEsnw.js";import"./dnd-BdXAZjIP.js";import"./stripe-cKAAJElX.js";import"./lottie-B6h9ACvw.js";import"./lexical-DcaHthb5.js";import"./pdf-DFrRjL7N.js";import"./utils-CSS89dSa.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]="10ab96b1-da3e-4252-8301-f952ca3c3644",t._sentryDebugIdIdentifier="sentry-dbid-10ab96b1-da3e-4252-8301-f952ca3c3644")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ze="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 Js=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:Z(t).detail,skillDetailError:Z(t).fetchState==="Error",skillDetailLoading:Z(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,F=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ze&&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"?N.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):N.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Fs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Bs({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&&Be(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Je())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(qe({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(_s({macroId:a,version:o}))},onDeleteSkill:a=>{t(Us({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Qs({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t($()),t($e()),Be(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($()),i!=null&&t($e());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${F}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${F}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Ft(),i=Bt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),F=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?J({scheduleId:P}):Se())}),[s,P]);const B=ke?.macroId,at=v((e=>Z(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&s(Ie({macroId:B}))}),[s,be,B]);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(J({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(J({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(Je()),s(Me())}),[s]),ct=n.useCallback((()=>{s($())}),[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($()),void s(ks())):l==="skills"?(s(Se()),s(Ne()),void s(Me())):(T==null&&s(Se()),s(Ne()),void s($()))),[s,T,g,l]);const ft=qt(),Q=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:zt(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:F,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,q=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;f(!0);const m={...e};delete m[Fe],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[q,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Jt(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),Qe=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(Qe,u),Tt=Rt.length===0;n.useEffect((()=>{x||Q||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,Q,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),_e=n.useRef(void 0);n.useEffect((()=>{const e=l!==Ue.current,m=u!==_e.current;Ue.current=l,_e.current=u,l!==u&&(!e||l==null||qs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ze}`)),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(J({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const U=(de=>{if(de==null||typeof de!="object")return null;const _=de;return fe(_.schedule_id)&&fe(_.run_id)?{scheduleId:_.schedule_id,runId:_.run_id,status:Ws.find((_t=>_t===_.status))??null,finishedAt:fe(_.finished_at)?_.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 Qt=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&Q)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:N,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(ze,{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:N,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(Zs,{children:[S.jsx(ce,{analytics:N,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),Q&&ne.drawerElement,S.jsx(Js,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Qe,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Qt,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:Q?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:F,promoDismissalScope:w}),p&&Q?S.jsx(Ns,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!Q?S.jsx(Zt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:Ut})}):null]})},ze=V($s)`
1
+ import{j as S}from"./liveblocks-CiRsIXv9.js";import{a as n}from"./sentry-DyyEkQvE.js";import{u as Dt,h as Lt,i as Ft,g as Bt,j as v,l as Mt}from"./core-CKdWu7C4.js";import{e4 as Nt,a as $t,T as Vt,e5 as Gt,z as Ht,$ as qt,e6 as zt,e7 as Wt,e8 as Yt,bn as Fe,e9 as We,ea as Jt,bm as Ye,a2 as ge,a6 as ce,j as N,eb as me,ec as Zt,ed as Kt,as as Xt,N as es,w as ts,ee as ss,ef as ns,at as as,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Be,ek as ds}from"./index-DpMage3e.js";import{fH as M,gw as R,Ux as cs,a2M as ms,a2N as Ss,jQ as hs,a2O as ps,jN as fs,a2P as Se,jt as J,jW as Z,jz as Ie,jg as he,je as gs,jY as Is,jI as Je,UG as Me,gy as $,gN as Cs,UF as ks,Uq as Ne,fI as bs,j7 as vs,a2Q as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a2R as Rs,a2S as Ts,a2T as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2U as He,jZ as Us,ji as _s,jC as Qs,jU as qe,jF as Ds,gA as Ls,gB as Fs,gC as Bs,gD as Ms}from"./zeni-epic-state-BuhfcA02.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-uBLtQnjV.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-WvX1r_Wk.js";import{p as Hs}from"./pathToGoBack-B8jPctZc.js";import{j as qs}from"./routePaths-Ld6pXFbh.js";import{u as zs}from"./useTaskManagerPusherEvents-Dec5VxRR.js";import"./recharts-CnFcvsiB.js";import"./analytics-DgOwHMv9.js";import"./plaid-BNZ1yRTN.js";import"./dnd-GMAnxo5D.js";import"./stripe-cKAAJElX.js";import"./lottie-Bk0D-wP9.js";import"./lexical-Bbndsy_i.js";import"./pdf-C6vaCCoi.js";import"./utils-RyVg9L9D.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]="8e36cd96-68b2-41d7-820e-b40ee8fada48",t._sentryDebugIdIdentifier="sentry-dbid-8e36cd96-68b2-41d7-820e-b40ee8fada48")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ze="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 Js=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:Z(t).detail,skillDetailError:Z(t).fetchState==="Error",skillDetailLoading:Z(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,F=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ze&&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"?N.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):N.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Fs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Bs({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&&Be(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Je())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(qe({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{t(_s({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Us({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t($()),t($e()),Be(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($()),i!=null&&t($e());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${F}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${F}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Ft(),i=Bt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),F=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?J({scheduleId:P}):Se())}),[s,P]);const B=ke?.macroId,at=v((e=>Z(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&s(Ie({macroId:B}))}),[s,be,B]);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(J({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(J({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(Je()),s(Me())}),[s]),ct=n.useCallback((()=>{s($())}),[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($()),void s(ks())):l==="skills"?(s(Se()),s(Ne()),void s(Me())):(T==null&&s(Se()),s(Ne()),void s($()))),[s,T,g,l]);const ft=qt(),U=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 _=e.sessionId??C.sessionId;_!=null&&D&&d(`/${w}/ai-cfo/${_}?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:zt(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:F,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,q=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;f(!0);const m={...e};delete m[Fe],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[q,we,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Jt(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),Ue=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(Ue,u),Tt=Rt.length===0;n.useEffect((()=>{x||U||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,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]),_e=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=l!==_e.current,m=u!==Qe.current;_e.current=l,Qe.current=u,l!==u&&(!e||l==null||qs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ze}`)),eventCallback:(e,m,_)=>_.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(J({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const _=(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);_!=null&&De(_.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 Ut=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&U)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:N,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:N,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(Zs,{children:[S.jsx(ce,{analytics:N,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),U&&ne.drawerElement,S.jsx(Js,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Ut,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:U?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:F,promoDismissalScope:w}),p&&U?S.jsx(Ns,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!U?S.jsx(Zt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:_t})}):null]})},ze=V($s)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-ElMRERc9.js";import{a as o,R as Ta}from"./sentry-B8nCx7v9.js";import{u as Fe,j as r,g as $a,h as Ba,q as j}from"./core-C81VRbeP.js";import{fI as Ge,Uo as xa,Up as Re,gc as Aa,gy as X,Uq as ee,jI as ye,jg as Te,Ur as _a,Us as Da,gS as Ua,q3 as Ma,Ut as Fa,Uu as $e,gp as Ga,Uv as x,fH as Ra,gw as Za,Uw as Ha,Ux as ja,Uy as Va,Uz as Be,UA as La,UB as xe,UC as Pa,Ev as Na,gq as qa,h5 as Oa,cW as za,UD as Wa,UE as Ya,qG as Ka,gb as Ja,ja as Qa,UF as Xa,UG as et,wK as at,gr as tt}from"./zeni-epic-state-DklVhJVB.js";import{w as nt,i as ot,a as st,K as rt,W as it,A as m,c as lt,u as dt,d as ct,D as ut,e as mt,f as Ct,g as pt,v as ht,h as ft,z as gt,j as V,p as h,m as Ae,k as bt,E as St,l as _e,n as kt,o as De,q as Et,J as wt,r as te,s as ae,x as It,y as vt,B as yt,L as Tt,C as $t,F as Bt,H as xt,T as At}from"./index-DBuws41Q.js";import{u as _t,q as Dt,r as Ut,I as Mt,p as Ue,t as Ft,D as Me,s as ne}from"./mui-DoMnHjRT.js";import{u as Gt}from"./InboxNotificationsProvider-BPTkk56Z.js";import{u as Rt}from"./useTaskManagerAccess-BpFV6J8j.js";import{u as Zt}from"./expenseAutomationHelper-Crya3Dv_.js";import"./recharts-DdTjw53U.js";import"./analytics-BXM45nWq.js";import"./plaid-4usmEsnw.js";import"./dnd-BdXAZjIP.js";import"./stripe-cKAAJElX.js";import"./lottie-B6h9ACvw.js";import"./lexical-DcaHthb5.js";import"./pdf-DFrRjL7N.js";import"./utils-CSS89dSa.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]="235f81a1-0dcf-4b87-9fd2-d58ee223ba0d",a._sentryDebugIdIdentifier="sentry-dbid-235f81a1-0dcf-4b87-9fd2-d58ee223ba0d")}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"}}))),jt=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[L,_]=Ta.useState(!1),[k,Ze]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[He,je]=o.useState(!1),P=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ge(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Le}=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 Q=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(Q)}const Z=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(Z)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ye()),n(Te()))}),[n,U,I,i.tenantId,w]);const[q,Pe]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:qe}=u(m.isChargeCardFeatureEnabled),Oe=Ct(i,qe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:M}=u(m.isReferralFeatureEnabled),We=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{je(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const O=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:v}=g,Ye=j("/signout")!==null,F=j("/:tenantEmailDomain/dashboard")!==null,ce=j("/:tenantEmailDomain/reports")!==null,b=j("/:tenantEmailDomain/onboarding/*")!==null,ue=Zt();o.useEffect((()=>{U&&I&&M&&!b&&O.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,O.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 Ke=Ye||b,z=r((e=>e.tenantState)),Je=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Qe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),W=r((e=>Ra(e))),la=r((e=>Za(e).skillsEnabled)),da=r((e=>Ha(e))),Ce=r((e=>ja(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(Va),[y,Y]=o.useState(void 0),K=W.uiState.currentChatSessionId,G=y!=null?W.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(G),{inboxNotifications:J,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(y!=null)return he==="In-Progress"&&G==="Completed"?(n(Be({chatSessionId:y})),Y(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:y})),Y(void 0)))}),[n,t.state,s,G,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&J!=null){const e=`dashboard_${i.companyId}`;Pe(J.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,J]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(La("task_manager","dashboard"))}),[I,D,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(q!=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:q},"comments")))}}),[q,R.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Qe===!1&&T.push("accounts_payable_aging"),Xe===!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=>Pa(e,T).fetchState)),ke=r((e=>Na(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?qa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=We,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Wa(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&V.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(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(Ka({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Je:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:O.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ne,isChargeCardEnabled:Oe,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=Le?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=>{Ve(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&V.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return N?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(V.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)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||V.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 Q=vt(e.type);yt(e.type)?(K!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Q}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),K===e&&Y(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ze,aiCfoView:W,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ja({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:He?`1px solid ${P.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(Vt,{})}),d.jsx(Lt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Ue((e=>e.breakpoints.up("md"))),ya=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ht,{className:c.root,children:[d.jsx(Ft,{}),Ke===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Me,{container:window.document.body,variant:"temporary",open:L,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Me,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Ge(_))),L={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Re({unreadCount:k.data.unread},"tasks"))}};return d.jsx(jt,{tenantEmailDomain:a,...L})},Vt=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-CiRsIXv9.js";import{a as o,R as Ta}from"./sentry-DyyEkQvE.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-CKdWu7C4.js";import{fI as Ge,Uo as xa,Up as Ze,gc as Aa,gy as Q,Uq as ee,jI as ye,jg as Te,Ur as _a,Us as Da,gS as Ma,q3 as Ua,Ut as Fa,Uu as $e,gp as Ga,Uv as x,fH as Za,gw as Ra,Uw as ja,Ux as Ha,Uy as Va,Uz as Be,UA as La,UB as xe,UC as Pa,Ev as Na,gq as qa,h5 as Oa,cW as za,UD as Wa,UE as Ya,qG as Ka,gb as Xa,ja as Ja,UF as Qa,UG as et,wK as at,gr as tt}from"./zeni-epic-state-BuhfcA02.js";import{w as nt,i as ot,a as st,X as rt,W as it,A as m,c as lt,u as dt,d as ct,e as ut,f as mt,g as Ct,I as pt,T as ht,h as ft,z as gt,j as V,p as h,m as Ae,k as bt,M as St,l as _e,n as kt,B as De,o as Et,q as wt,r as te,s as ae,v as It,x as vt,y as yt,L as Tt,C as $t,D as Bt,E as xt,R as At}from"./index-DpMage3e.js";import{u as _t,q as Dt,r as Mt,I as Ut,p as Me,t as Ft,D as Ue,s as ne}from"./mui-uBLtQnjV.js";import{u as Gt}from"./InboxNotificationsProvider-DTx76-7a.js";import{u as Zt}from"./useTaskManagerAccess-Bvl8DVEY.js";import{u as Rt}from"./expenseAutomationHelper-QjlEGiQT.js";import"./recharts-CnFcvsiB.js";import"./analytics-DgOwHMv9.js";import"./plaid-BNZ1yRTN.js";import"./dnd-GMAnxo5D.js";import"./stripe-cKAAJElX.js";import"./lottie-Bk0D-wP9.js";import"./lexical-Bbndsy_i.js";import"./pdf-C6vaCCoi.js";import"./utils-RyVg9L9D.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]="c4e7df46-a209-4d5a-951a-61923b149a95",a._sentryDebugIdIdentifier="sentry-dbid-c4e7df46-a209-4d5a-951a-61923b149a95")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},jt=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[L,_]=Ta.useState(!1),[k,Re]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[je,He]=o.useState(!1),P=_t(),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))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Le}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const J=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(J)}const R=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(R)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[q,Pe]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:qe}=u(m.isChargeCardFeatureEnabled),Oe=Ct(i,qe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:U}=u(m.isReferralFeatureEnabled),We=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const O=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Ye=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Rt();o.useEffect((()=>{M&&I&&U&&!b&&O.fetchState==="Not-Started"&&n(Ua(!0))}),[M,I,U,O.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 Ke=Ye||b,z=r((e=>e.tenantState)),Xe=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Je}=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)),W=r((e=>Za(e))),la=r((e=>Ra(e).skillsEnabled)),da=r((e=>ja(e))),Ce=r((e=>Ha(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Va),[y,Y]=o.useState(void 0),K=W.uiState.currentChatSessionId,G=y!=null?W.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(G),{inboxNotifications:X,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Gt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&G==="Completed"?(n(Be({chatSessionId:y})),Y(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:y})),Y(void 0)))}),[n,t.state,s,G,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&X!=null){const e=`dashboard_${i.companyId}`;Pe(X.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,X]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(La("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(q!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:q},"comments")))}}),[q,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Je===!1&&T.push("accounts_payable_aging"),Qe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),U===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Pa(e,T).fetchState)),ke=r((e=>Na(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?qa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=We,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Wa(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&V.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(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(Ka({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Xe:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:U,isRewardsAnimated:Sa,rewardsPlan:O.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ne,isChargeCardEnabled:Oe,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=Le?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=>{Ve(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&V.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(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 N?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(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(V.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const j=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:j,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,R=At(B)&&B!=="command_center";if(B!=="command_center"&&!R||f[i.tenantId]==null||V.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),R&&f[i.tenantId]!=null){const j=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${j.month}-${j.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const J=vt(e.type);yt(e.type)?(K!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${J}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),K===e&&Y(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Re,aiCfoView:W,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Xa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:je?`1px solid ${P.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Ut,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),d.jsx(Lt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(jt,{className:c.root,children:[d.jsx(Ft,{}),Ke===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ue,{container:window.document.body,variant:"temporary",open:L,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ue,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Ge(_))),L={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...L})},Vt=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-ElMRERc9.js";import{a as d}from"./sentry-B8nCx7v9.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-C81VRbeP.js";import{fI as P,Zq as w,Z7 as R,I3 as E,HZ as q,I1 as A,HS as H,Z9 as K,HW as ae,I5 as oe,HV as z,I8 as X,I4 as C}from"./zeni-epic-state-DklVhJVB.js";import{z as O,w as J,bX as pe,n as T,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-DBuws41Q.js";import{u as M}from"./mui-DoMnHjRT.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-ZIBaIx9-.js";import ie from"./NotFoundScreen-DHMPApWS.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]="226b4645-2130-4651-8425-2bed575a3184",e._sentryDebugIdIdentifier="sentry-dbid-226b4645-2130-4651-8425-2bed575a3184")}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:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(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]),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 m={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,...m})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(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)),m=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]),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:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:m,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const m=[];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 g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);m.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},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=O.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(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const me=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,m=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=m?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:m?.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(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.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(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(me,{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-CiRsIXv9.js";import{a as d}from"./sentry-DyyEkQvE.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-CKdWu7C4.js";import{fI as P,Zq as w,Z7 as R,I3 as E,HZ as q,I1 as A,HS as H,Z9 as K,HW as ae,I5 as oe,HV as z,I8 as X,I4 as C}from"./zeni-epic-state-BuhfcA02.js";import{z as O,w as J,bX as pe,n as T,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-DpMage3e.js";import{u as M}from"./mui-uBLtQnjV.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-BSbU5iHI.js";import ie from"./NotFoundScreen-D7YKuY7u.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]="226b4645-2130-4651-8425-2bed575a3184",e._sentryDebugIdIdentifier="sentry-dbid-226b4645-2130-4651-8425-2bed575a3184")}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:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(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]),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 m={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,...m})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(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)),m=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]),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:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:m,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const m=[];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 g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);m.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},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=O.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(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const me=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,m=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=m?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:m?.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(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.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(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(me,{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};