@zeniai/web-app-ui 5.3.89-dev → 5.3.90-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 (142) hide show
  1. package/dist/assets/{AccountMappingScreen-Dd-9mkbJ.js → AccountMappingScreen-BS2TEEML.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-CwU0IpO-.js → ActualMatchingMatchDetailScreen-BG0f_9dm.js} +1 -1
  3. package/dist/assets/AddressRoutes-DXLSGq6p.js +1 -0
  4. package/dist/assets/AddressScreen-CFFjqn9x.js +9 -0
  5. package/dist/assets/AiCfoScreen-Bb7BlHVl.js +22 -0
  6. package/dist/assets/{AppDrawer-t7pXwFsy.js → AppDrawer-CUWwfrcw.js} +2 -2
  7. package/dist/assets/{BillPayApprovalRoutes-DOtDJlUD.js → BillPayApprovalRoutes-BnsNw_Wt.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-b2SMWo4z.js → BillPayRoutes-D-m3lGSH.js} +18 -18
  9. package/dist/assets/BusinessVerificationPageScreen-DGcNuKpp.js +9 -0
  10. package/dist/assets/{CardsAiCfoScreen-lmBrsGeg.js → CardsAiCfoScreen-CdMzvkcF.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-C9jB_BU5.js → ChargeCardRoutes-CEdKIYwO.js} +7 -7
  12. package/dist/assets/{CompanyPassportScreen-BslihQWZ.js → CompanyPassportScreen-ouG3XJ0B.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-CzZXAv1W.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-CwkUm4jt.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-DmCDi77C.js → CustomerOnboardingRoutes-DKFmMkvz.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-CQAZF0k8.js → DashboardRoutes-FwFiyAun.js} +3 -3
  17. package/dist/assets/{DefaultTenantHome-DSgsISV-.js → DefaultTenantHome-DpFF7UFt.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-B1jSUQp2.js → DomesticWireDetailScreen-mG0aAckn.js} +3 -3
  19. package/dist/assets/{DrawerScreen-CLNuMP4c.js → DrawerScreen-CESLwM_E.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-CPbgn6WL.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-DLqUzGyz.js → ExpenseAutomationRoutes-7eBLUF1p.js} +7 -7
  22. package/dist/assets/FeaturePreviewScreen-DNtB8Ogu.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-BzaBWYUg.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-CmAbaz3a.js → InboxNotificationsProvider-BDvEEMzw.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-DFf9_vlp.js → InvoicingRoutes-QrdL6jni.js} +2 -2
  26. package/dist/assets/{MagicLinkRoutes-DPRx78HI.js → MagicLinkRoutes-fajlaDEP.js} +22 -22
  27. package/dist/assets/MagicLinkSignInScreen-DeVFtM-w.js +12 -0
  28. package/dist/assets/MobileAppDrawer-B8sARono.js +1 -0
  29. package/dist/assets/NotFoundScreen-XYwSCqRV.js +1 -0
  30. package/dist/assets/NotificationRoutes-BCLjcBx9.js +1 -0
  31. package/dist/assets/{OAuthConsentScreen-DMeszvcw.js → OAuthConsentScreen-eOi9FOn6.js} +1 -1
  32. package/dist/assets/PandLWithForecastRoutes-C0xsoIO3.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-DZH3o71q.js → PaymentLinkScreen-DrbI3lMH.js} +5 -5
  34. package/dist/assets/PeopleRoutes-mXGFHp3Z.js +22 -0
  35. package/dist/assets/PerformanceRoutes-DATOhE_v.js +1 -0
  36. package/dist/assets/{Preview-6s066EpN.js → Preview-B9tcJoWQ.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-MUHRwejb.js → QBOConnectionScreen-RFxms0Wa.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-BFxtthm2.js → ReimbursementApprovalRoutes-C5fSRq-h.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BXCFB-xI.js → ReimbursementApprovalRuleDetailScreen-BRSlUWFS.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-AomTv5z8.js → ReimbursementRoutes-5zTCjNMx.js} +5 -5
  41. package/dist/assets/{ReportsRoutes-CUQDlOh2.js → ReportsRoutes-Bm7SmFOd.js} +1 -1
  42. package/dist/assets/RewardsRoutes-BftpYdCc.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-B2Zz8Q8W.js → ScheduleDetailsPrepaidExpensesScreen-Cs3QDcYO.js} +5 -5
  44. package/dist/assets/ScreenRoutes-Bgg7yoYV.js +2 -0
  45. package/dist/assets/{SettingsRoutes-CIKlS7WR.js → SettingsRoutes-BIatjdKn.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-Drwip476.js → SetupPagesScreen-5LQJzH9k.js} +5 -5
  47. package/dist/assets/SignInScreen-MYaF1oeQ.js +1 -0
  48. package/dist/assets/SignOutScreen-BQC-vnXw.js +9 -0
  49. package/dist/assets/{TaskListScreen-BwBbID9Z.js → TaskListScreen-DDtS1dW-.js} +2 -2
  50. package/dist/assets/TaskRoutes-DFZky3LW.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-BtOvElEM.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-R1s2Fj0b.js → TransactionDetailScreen-D-8He79E.js} +2 -2
  53. package/dist/assets/{TransactionListRoutes-Cc6hdxdW.js → TransactionListRoutes-CA94kxFD.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-9B6vJLbh.js → TreasuryRoutes-CBqnYiwq.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-m5oaZn9_.js → VendorsRoutes-XMGo57cf.js} +10 -10
  56. package/dist/assets/WiseConfirmationScreen-DL3t64Kq.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-CbOETsfG.js → ZeniAccountRoutes-J5QpQxjm.js} +10 -10
  58. package/dist/assets/ZeniAccountStatementScreen-AZVgMM5C.js +9 -0
  59. package/dist/assets/{accountMappingHelper-D7kdjZSp.js → accountMappingHelper-Dz3WGDfz.js} +1 -1
  60. package/dist/assets/{analytics-CHOlTFyu.js → analytics-C3JIdGJp.js} +1 -1
  61. package/dist/assets/{analyticsHelper-BCFnQWXb.js → analyticsHelper-isaFMiiy.js} +1 -1
  62. package/dist/assets/{core-DO2aQ9sC.js → core-CjSjXYyY.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-BGunfdyb.js → decodeURIComponentSafe-CL2ts4bS.js} +1 -1
  64. package/dist/assets/{dnd-C6oCteDZ.js → dnd-DQdg3jZV.js} +1 -1
  65. package/dist/assets/{empty-BnXjgXTG.js → empty-CHbZ6EKy.js} +1 -1
  66. package/dist/assets/{empty-BEdZehso.js → empty-CbjHBZe9.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-DyfqG-Dl.js → emptyVideoElement-DldZjfRN.js} +1 -1
  68. package/dist/assets/epic-wF-1Nkht.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-CBURllgC.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-Bn-3jfmk.js → getLocaleForTenant-CUMk734N.js} +1 -1
  71. package/dist/assets/{index-BX493DEc.js → index-B-AxVrtB.js} +1 -1
  72. package/dist/assets/{index-CJp0mZVW.js → index-B95Ul72p.js} +1 -1
  73. package/dist/assets/{index-D8IL39lv.js → index-BOFTe1v-.js} +1 -1
  74. package/dist/assets/{index-CqLY6f8A.js → index-BkzgLf7w.js} +1 -1
  75. package/dist/assets/{index-BpSPKksw.js → index-ByMk-VWt.js} +2 -2
  76. package/dist/assets/{index-CHVvaLYS.js → index-DT61Dzwo.js} +1 -1
  77. package/dist/assets/{index-BIf8ZdZy.js → index-DrKuh0N3.js} +1 -1
  78. package/dist/assets/{index-DtDfc4Ly.js → index-zhznqeY3.js} +14294 -14320
  79. package/dist/assets/{lexical-Dahvp5A4.js → lexical-DFfYCN7b.js} +1 -1
  80. package/dist/assets/{liveblocks-DCIY2V5W.js → liveblocks-fvHZHCch.js} +1 -1
  81. package/dist/assets/{lottie-BsiUbd07.js → lottie-Cmgc5pKa.js} +1 -1
  82. package/dist/assets/{mui-Beesmy34.js → mui-Cv0Yu4Hx.js} +1 -1
  83. package/dist/assets/{pathToGoBack-BF0QeMYg.js → pathToGoBack-DWp6jk4n.js} +1 -1
  84. package/dist/assets/{pdf-Bi1FWCM7.js → pdf-C21rIcNJ.js} +4 -4
  85. package/dist/assets/{pdf-lib-D-883htS.js → pdf-lib-CeyW0y7u.js} +1 -1
  86. package/dist/assets/{plaid-IFb-JOAW.js → plaid-B_ZF6XEj.js} +1 -1
  87. package/dist/assets/{pusher-CZ2f9qiw.js → pusher-YCZIG_Zw.js} +1 -1
  88. package/dist/assets/{react-BGT56QSM.js → react-BkYlXOI6.js} +1 -1
  89. package/dist/assets/{react-U8FVY9XX.js → react-CgBiLhFT.js} +1 -1
  90. package/dist/assets/{react-C009U_vG.js → react-Cmh_nuuS.js} +1 -1
  91. package/dist/assets/{react-B37EnoMa.js → react-D_MOfVxA.js} +1 -1
  92. package/dist/assets/{react-BBLrRlBQ.js → react-J2JzrsDb.js} +1 -1
  93. package/dist/assets/{react-B7Ae5uDO.js → react-LTvMDmLf.js} +1 -1
  94. package/dist/assets/{recharts-BFgvJAkx.js → recharts-iN3Tsoxx.js} +1 -1
  95. package/dist/assets/{routePaths-CWDMrD59.js → routePaths-o_RQZUW0.js} +1 -1
  96. package/dist/assets/{sentry--FQm-CEz.js → sentry-5M-_hQEn.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-BjVyO64h.js → stripSplatSuffix-ntc_sS44.js} +1 -1
  98. package/dist/assets/{url-CYqslED7.js → url-BvDoSxgp.js} +1 -1
  99. package/dist/assets/{url-aH6bFotI.js → url-CBVoutGU.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-0ydHXgNC.js +1 -0
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DOb2Yrjn.js → useAiCfoDashboardSuggestedQuestionsChips-gs_gUo4b.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-ClUKa-x1.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-BzP1s6ty.js → useChargeCardPusherEvents-B_qQWepJ.js} +1 -1
  104. package/dist/assets/{useDeviceId-04DUxcYB.js → useDeviceId-DcODeIz7.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DETKjPI-.js +1 -0
  106. package/dist/assets/{useInitialThreadRequest-B_GduCEN.js → useInitialThreadRequest-DvEY1Wx_.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-DgmndGpu.js → useTaskManagerAccess-AyRfKL8F.js} +1 -1
  108. package/dist/assets/{useTaskManagerPusherEvents-BgO_yohE.js → useTaskManagerPusherEvents-nRX-pAls.js} +1 -1
  109. package/dist/assets/{utils-9X_P6qcc.js → utils-CSmUhNCi.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-CRkrcV_c.js → withTransactionSidePanel-Cimx250C.js} +3 -3
  111. package/dist/assets/{zeni-epic-state-Cc-xO4DM.js → zeni-epic-state-DbSzv5hl.js} +5 -5
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -4
  114. package/dist/assets/AddressRoutes-DkKEg9nJ.js +0 -1
  115. package/dist/assets/AddressScreen-NLlV-cSD.js +0 -9
  116. package/dist/assets/AiCfoScreen-DUNS2Dhv.js +0 -22
  117. package/dist/assets/BusinessVerificationPageScreen-BMbooZ9c.js +0 -9
  118. package/dist/assets/ConnectionAuthScreen-DS5u9yD-.js +0 -11
  119. package/dist/assets/CustomerOnboardingAuthScreen-C7dVHXwO.js +0 -1
  120. package/dist/assets/EntityDetailRoutes-Zk-9UMwO.js +0 -1
  121. package/dist/assets/FeaturePreviewScreen-D1TH0B4H.js +0 -1
  122. package/dist/assets/HubSpotOAuthCallbackScreen-CvYzzQt6.js +0 -1
  123. package/dist/assets/MagicLinkSignInScreen-Bsg6zj8U.js +0 -12
  124. package/dist/assets/MobileAppDrawer-C1CX08Nz.js +0 -1
  125. package/dist/assets/NotFoundScreen-DUP1I-Dh.js +0 -1
  126. package/dist/assets/NotificationRoutes-b-zZEsBw.js +0 -1
  127. package/dist/assets/PandLWithForecastRoutes-Dh0lrJ4b.js +0 -1
  128. package/dist/assets/PeopleRoutes-BXk_l6Ng.js +0 -22
  129. package/dist/assets/PerformanceRoutes-CuBRzzvZ.js +0 -1
  130. package/dist/assets/RewardsRoutes-D6jHcv01.js +0 -1
  131. package/dist/assets/ScreenRoutes-BBi6T6TG.js +0 -2
  132. package/dist/assets/SignInScreen-B2i0uaaw.js +0 -1
  133. package/dist/assets/SignOutScreen-yXoT_vjf.js +0 -9
  134. package/dist/assets/TaskRoutes-DkYij_G4.js +0 -9
  135. package/dist/assets/TransactionDetailRoutes-DmTwl-Oi.js +0 -1
  136. package/dist/assets/WiseConfirmationScreen-BEME5pnv.js +0 -12
  137. package/dist/assets/ZeniAccountStatementScreen-CyFrpw1Y.js +0 -9
  138. package/dist/assets/epic-Cg7zjUcf.js +0 -2
  139. package/dist/assets/expenseAutomationHelper-Box0P8C-.js +0 -1
  140. package/dist/assets/useActualMatchingMatchDetail-B3AFBcfZ.js +0 -1
  141. package/dist/assets/useAskAiCfoHostNavButtonProps-BH1yPMVh.js +0 -1
  142. package/dist/assets/useEmailConnectResultRefresh-6HOW2gqB.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as B}from"./liveblocks-DCIY2V5W.js";import{a as o}from"./sentry--FQm-CEz.js";import{h as Z,g as H,u as K,j as m,s as q,l as X}from"./core-DO2aQ9sC.js";import{ag as Y,W as ee,A as R,z as te,q as J,ah as ne,l as ae,O as ce}from"./index-DtDfc4Ly.js";import{bn as se,fI as oe,gZ as ie,oF as $,Vc as re,ic as Q,gk as ue,ow as le,Vd as de,Ve as pe,uh as ge,m3 as me,ou as Ae,oq as be,oB as fe,ie as Ie,Vf as ye,Vg as Se}from"./zeni-epic-state-Cc-xO4DM.js";import{n as he}from"./mui-Beesmy34.js";import{M as Ee}from"./MobileAppDrawer-C1CX08Nz.js";import{q as G}from"./QBOConnectionScreen-MUHRwejb.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-D7kdjZSp.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]="c60a7c90-1f49-4755-92d2-724fa97f73cd",a._sentryDebugIdIdentifier="sentry-dbid-c60a7c90-1f49-4755-92d2-724fa97f73cd")}catch{}})();const u="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},we=he.div`
1
+ import{j as B}from"./liveblocks-fvHZHCch.js";import{a as o}from"./sentry-5M-_hQEn.js";import{h as Z,g as H,u as K,j as m,s as q,l as X}from"./core-CjSjXYyY.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-zhznqeY3.js";import{bn as se,fI as oe,gZ as ie,oF as $,V9 as re,ic as Q,gk as ue,ow as le,Va as de,Vb as pe,uh as ge,m3 as me,ou as Ae,oq as be,oB as fe,ie as Ie,Vc as ye,Vd as Se}from"./zeni-epic-state-DbSzv5hl.js";import{n as he}from"./mui-Cv0Yu4Hx.js";import{M as Ee}from"./MobileAppDrawer-B8sARono.js";import{q as G}from"./QBOConnectionScreen-RFxms0Wa.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-Dz3WGDfz.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]="f1e65456-c9bf-49cb-82f6-7a58f3352b6c",a._sentryDebugIdIdentifier="sentry-dbid-f1e65456-c9bf-49cb-82f6-7a58f3352b6c")}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-DCIY2V5W.js";import{a as o}from"./sentry--FQm-CE
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:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:v,filing1099Section:C}=r,{incomeAccount:x,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=v,{bankAccount:M,expenseCategory1099:k}=C,b=h(e.accountMappingView.incomeAccountList,x.selectedOption),_=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),j=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,k),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:_?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:j?.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()),A&&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?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),je=()=>{const a=Y(),e=Z(),i=H(),c=K(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A(R.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A(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]),k=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]),b=m((t=>re(t.accountState)),q),_=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[f,j]=o.useState(!1),[P,D]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(Q()),j(!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:_,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:k,location:i,isSettings:J(i),onClickMenuIcon:()=>y(!0)})]})};export{u as P,je 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:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:v,filing1099Section:C}=r,{incomeAccount:x,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=v,{bankAccount:M,expenseCategory1099:j}=C,b=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:b?.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()),A&&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?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Y(),e=Z(),i=H(),c=K(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A(R.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A(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]),b=m((t=>re(t.accountState)),q),k=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[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-DCIY2V5W.js";import{a as y}from"./sentry--FQm-CEz.js";import{a2 as A,dN as R}from"./index-DtDfc4Ly.js";import"./mui-Beesmy34.js";import{u as F}from"./useActualMatchingMatchDetail-B3AFBcfZ.js";import b from"./NotFoundScreen-DUP1I-Dh.js";import{i as P,h as U,g as w}from"./core-DO2aQ9sC.js";import"./zeni-epic-state-Cc-xO4DM.js";import"./recharts-BFgvJAkx.js";import"./analytics-CHOlTFyu.js";import"./plaid-IFb-JOAW.js";import"./dnd-C6oCteDZ.js";import"./stripe-cKAAJElX.js";import"./lottie-BsiUbd07.js";import"./lexical-Dahvp5A4.js";import"./pdf-Bi1FWCM7.js";import"./utils-9X_P6qcc.js";import"./stripSplatSuffix-BjVyO64h.js";import"./decodeURIComponentSafe-BGunfdyb.js";import"./routePaths-CWDMrD59.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-fvHZHCch.js";import{a as y}from"./sentry-5M-_hQEn.js";import{a2 as A,dN as R}from"./index-zhznqeY3.js";import"./mui-Cv0Yu4Hx.js";import{u as F}from"./useActualMatchingMatchDetail-0ydHXgNC.js";import b from"./NotFoundScreen-XYwSCqRV.js";import{i as P,h as U,g as w}from"./core-CjSjXYyY.js";import"./zeni-epic-state-DbSzv5hl.js";import"./recharts-iN3Tsoxx.js";import"./analytics-C3JIdGJp.js";import"./plaid-B_ZF6XEj.js";import"./dnd-DQdg3jZV.js";import"./stripe-cKAAJElX.js";import"./lottie-Cmgc5pKa.js";import"./lexical-DFfYCN7b.js";import"./pdf-C21rIcNJ.js";import"./utils-CSmUhNCi.js";import"./stripSplatSuffix-ntc_sS44.js";import"./decodeURIComponentSafe-CL2ts4bS.js";import"./routePaths-o_RQZUW0.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-fvHZHCch.js";import{A as i}from"./AddressScreen-CFFjqn9x.js";import s from"./NotFoundScreen-XYwSCqRV.js";import"./sentry-5M-_hQEn.js";import{n as d,o as r}from"./core-CjSjXYyY.js";import"./zeni-epic-state-DbSzv5hl.js";import"./recharts-iN3Tsoxx.js";import"./index-zhznqeY3.js";import"./mui-Cv0Yu4Hx.js";import"./analytics-C3JIdGJp.js";import"./plaid-B_ZF6XEj.js";import"./dnd-DQdg3jZV.js";import"./stripe-cKAAJElX.js";import"./lottie-Cmgc5pKa.js";import"./lexical-DFfYCN7b.js";import"./pdf-C21rIcNJ.js";import"./utils-CSmUhNCi.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-fvHZHCch.js";import{a as b}from"./sentry-5M-_hQEn.js";import{h as T,u as P,g as j,i as E,j as $,l as B}from"./core-CjSjXYyY.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 h,a2 as U}from"./index-zhznqeY3.js";import{VQ as _,it as N,fI as z,VR as F,c9 as G,VS as O,mL as q}from"./zeni-epic-state-DbSzv5hl.js";import{u as H,n as Q}from"./mui-Cv0Yu4Hx.js";import J from"./NotFoundScreen-XYwSCqRV.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]="e2f54d6e-b433-4ae7-9b11-2ab9eaa6f3ce",e._sentryDebugIdIdentifier="sentry-dbid-e2f54d6e-b433-4ae7-9b11-2ab9eaa6f3ce")}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:h.googleMapsAPIKey,isDisabled:n,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const d=_(e,o);return{addressToEdit:d.address,loadingState:d.fetchState,googleAPIKey:h.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=T(),n=P(),d=j(),{addressId:t,addressType:u}=E(),g=L(),w=H(),I=M.getSignedInUser(),[f,k]=b.useState(t==null),p=$((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=V();if(I==null)throw Error("Can't access address page without signing in...");const A=m=>m.trackPageLoaded(t!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return b.useEffect((()=>{f||t==null||(k(!0),n(N(t,!1)))}),[f,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)?!f&&p==="Not-Started"||f&&p==="In-Progress"?r.jsx(D,{fetchState:p,style:{backgroundColor:w.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(K,{analytics:C,onLoad:A}),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};
@@ -0,0 +1,22 @@
1
+ import{j as S}from"./liveblocks-fvHZHCch.js";import{a}from"./sentry-5M-_hQEn.js";import{u as Dt,h as Lt,i as Bt,g as Ft,j as v,l as Mt}from"./core-CjSjXYyY.js";import{e4 as Nt,a as $t,T as Vt,e5 as Gt,z as Ht,$ as zt,e6 as qt,e7 as Wt,e8 as Yt,bn as Be,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 as,at as ns,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Fe,ek as ds}from"./index-zhznqeY3.js";import{fH as M,gw as R,Uy as cs,a2O as ms,a2P as Ss,jQ as hs,a2Q as ps,jN as fs,a2R as Se,jt as J,jW as Z,jz as Ie,jg as he,je as gs,jY as Is,jI as Je,UH as Me,gy as $,gN as Cs,UG as ks,Ur as Ne,fI as bs,j7 as vs,a2S as Es,gb as Ps,jp as ys,jl as ws,fJ as pe,gi as xs,a2T as Rs,a2U as Ts,a2V as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2W as He,jZ as Us,ji as _s,jC as Qs,jU as ze,jF as Ds,gA as Ls,gB as Bs,gC as Fs,gD as Ms}from"./zeni-epic-state-DbSzv5hl.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-Cv0Yu4Hx.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-gs_gUo4b.js";import{p as Hs}from"./pathToGoBack-DWp6jk4n.js";import{j as zs}from"./routePaths-o_RQZUW0.js";import{u as qs}from"./useTaskManagerPusherEvents-nRX-pAls.js";import"./recharts-iN3Tsoxx.js";import"./analytics-C3JIdGJp.js";import"./plaid-B_ZF6XEj.js";import"./dnd-DQdg3jZV.js";import"./stripe-cKAAJElX.js";import"./lottie-Cmgc5pKa.js";import"./lexical-DFfYCN7b.js";import"./pdf-C21rIcNJ.js";import"./utils-CSmUhNCi.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]="07f2e715-1016-44df-a888-7306027b9aaa",t._sentryDebugIdIdentifier="sentry-dbid-07f2e715-1016-44df-a888-7306027b9aaa")}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=as(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:`${ns}/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,B=s.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===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,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Fs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,j,E)=>{n&&Fe(t,n,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Je())},onOpenSkill:n=>{t(Ie({macroId:n})),t(Ds({macroId:n}))},onSaveSkill:(n,o)=>{t(ze({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";t(ze({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{t(Qs({macroId:n,version:o}))},onDeleteSkill:n=>{t(_s({macroId:n}))},onSetSkillVisibility:(n,o)=>{t(Us({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(n,o)=>{t($()),t($e()),Fe(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,n),t(He())},updateCurrentInput:n=>{t(Ge(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{t(As(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??Hs(1);l(o,{state:{...h.state,pathnameStackToGoBack:n.newStack}}),t(Ge(""))},togglePageView:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,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 n=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{t(Os({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),ka=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Bt(),i=Ft(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=a.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),n=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=a.useState(void 0),[G,A]=a.useState(!1),[Ke,Ce]=a.useState(void 0),Xe=a.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=a.useCallback((e=>{O(e),A(!0)}),[]),tt=a.useCallback((()=>{O(void 0),A(!1)}),[]),st=a.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))),at=a.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{s(P!=null?J({scheduleId:P}):Se())}),[s,P]);const F=ke?.macroId,nt=v((e=>Z(e))),be=F!=null&&F!==""&&nt.fetchState==="Not-Started";a.useEffect((()=>{be&&F!=null&&s(Ie({macroId:F}))}),[s,be,F]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=a.useState(!0);a.useEffect((()=>{T!=null&&s(J({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.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=a.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=a.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=a.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{n&&s(he())}),[s,n]);const Pe=v((e=>R(e).skills)),K=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=a.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=a.useCallback((()=>{s(Je()),s(Me())}),[s]),ct=a.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();a.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),w=Ht.getSignedInUser();a.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=zt(),U=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,y=b.tenantEmailDomain,D=y!=null&&y!=="",ee=a.useCallback((e=>{D&&d(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,y]),te=a.useCallback((()=>{D&&d(`/${y}/ai-cfo/routines`)}),[D,d,y]),se=a.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&D&&d(`/${y}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,y]),gt=a.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:qt(k),skillName:k.isAdHoc===!0?void 0:K.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,K]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:y}),ae=Yt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,z=H?.aiCfoInitialQuestion,ye=!!H?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ne]=a.useState(null),[Et,oe]=a.useState(!1),[Pt,ie]=a.useState(void 0),[yt,re]=a.useState(void 0),we=a.useRef(!1);a.useEffect((()=>{if(!we.current&&z!=null&&z!==""){const e=i.state;ne(z),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),we.current=!0}}),[z,ye,i.state]);const wt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(s(vs("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,w]);const q=I.uiState.lastContextMessage;a.useEffect((()=>{q!=null&&q!==""&&u!=null&&(ne(q),oe(!0),ie(void 0),re(void 0),s(Es()))}),[q,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;a.useEffect((()=>{x||U||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,d,i.state]);const jt=a.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=a.useRef(void 0),Qe=a.useRef(void 0);a.useEffect((()=>{const e=l!==_e.current,m=u!==Qe.current;_e.current=l,Qe.current=u,l!==u&&(!e||l==null||zs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=a.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ze}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[je]);a.useEffect((()=>{W!=="In-Progress"&&Y&&s(ys())}),[W,Y,s]),a.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(l===u||W==="Completed"&&!Y)&&s(ws(u,w.userId))}),[Oe,W,Ae,Y,u,w,l,s]);const ue=w?.userId,At=a.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=a.useCallback((e=>{const m=e!=null&&(e===P||e===T);(n||m)&&s(he()),m&&s(J({scheduleId:e}))}),[s,n,T,P]);qs({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(w==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}),ae.drawerElement,S.jsx(Xs,{children:S.jsx(qe,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const _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&&ae.drawerElement,S.jsx(Js,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:w.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Ut,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:wt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:yt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:U?ae.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:n,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:at,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ke,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:y}),p&&U?S.jsx(Ns,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ea,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(qe,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!U?S.jsx(Zt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:_t})}):null]})},qe=V($s)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,Zs=V.div`
6
+ height: 100vh;
7
+ width: 100%;
8
+ `,Ks=V.div`
9
+ height: 100vh;
10
+ width: 100%;
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 0;
14
+ `,Xs=V.div`
15
+ flex: 1;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ `,ea=V(Vs)`
20
+ box-shadow: ${({theme:t})=>t.colors.elevation2};
21
+ color: ${({theme:t})=>t.colors.grey4};
22
+ `;export{ka as default};
@@ -1,8 +1,8 @@
1
- import{j as d}from"./liveblocks-DCIY2V5W.js";import{a as o,R as Ta}from"./sentry--FQm-CEz.js";import{u as Fe,j as r,g as $a,h as Ba,q as j}from"./core-DO2aQ9sC.js";import{fI as Ge,Us as xa,Ut as Ze,gc as Aa,gy as X,Uu as ee,jI as ve,jg as Te,Uv as _a,Uw as Da,gS as Ua,q3 as Ma,Ux as Fa,Uy as $e,gp as Ga,Uz as x,fH as Za,gw as Ha,UA as Ra,UB as ja,UC as La,UD as Be,UE as Va,UF as xe,UG as Pa,Ey as Na,gq as Oa,h5 as qa,cW as za,UH as Wa,UI as Ya,qG as Ja,gb as Ka,ja as Qa,UJ as Xa,UK as et,wL as at,gr as tt}from"./zeni-epic-state-Cc-xO4DM.js";import{w as nt,i as ot,a as st,c as rt,W as it,A as m,d as lt,u as dt,e as ct,f as ut,g as mt,h as Ct,H as pt,j as ht,k as ft,z as gt,l as L,p as h,m as Ae,n as bt,Z as St,o as _e,q as kt,U as De,r as Et,s as wt,v as te,x as ae,y as It,B as yt,C as vt,L as Tt,D as $t,E as Bt,F as xt,I as At}from"./index-DtDfc4Ly.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-Beesmy34.js";import{u as Gt}from"./InboxNotificationsProvider-CmAbaz3a.js";import{u as Zt}from"./useTaskManagerAccess-DgmndGpu.js";import{u as Ht}from"./expenseAutomationHelper-Box0P8C-.js";import"./recharts-BFgvJAkx.js";import"./analytics-CHOlTFyu.js";import"./plaid-IFb-JOAW.js";import"./dnd-C6oCteDZ.js";import"./stripe-cKAAJElX.js";import"./lottie-BsiUbd07.js";import"./lexical-Dahvp5A4.js";import"./pdf-Bi1FWCM7.js";import"./utils-9X_P6qcc.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]="629e76fe-ff00-46b9-b18c-cc64ea71b8ab",a._sentryDebugIdIdentifier="sentry-dbid-629e76fe-ff00-46b9-b18c-cc64ea71b8ab")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Rt=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(),[V,_]=Ta.useState(!1),[k,He]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[Re,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:Le}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Ve}=Zt(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 H=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(H)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ve()),n(Te()))}),[n,U,I,i.tenantId,w]);const[O,Pe]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,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 q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:y}=g,Ye=j("/signout")!==null,F=j("/:tenantEmailDomain/dashboard")!==null,ce=j("/:tenantEmailDomain/reports")!==null,b=j("/:tenantEmailDomain/onboarding/*")!==null,ue=Ht();o.useEffect((()=>{U&&I&&M&&!b&&q.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Je=Ye||b,z=r((e=>e.tenantState)),Ke=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=>Za(e))),la=r((e=>Ha(e).skillsEnabled)),da=r((e=>Ra(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(La),[v,Y]=o.useState(void 0),J=W.uiState.currentChatSessionId,G=v!=null?W.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,he=ft(G),{inboxNotifications:K,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(v!=null)return he==="In-Progress"&&G==="Completed"?(n(Be({chatSessionId:v})),Y(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:v})),Y(void 0)))}),[n,t.state,s,G,v,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&K!=null){const e=`dashboard_${i.companyId}`;Pe(K.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,K]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(Va("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];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?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=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(y.monthEndCloseChecks?.auditSummary!=null&&L.trackMonthCloseAuditPage(e.month,e.year,y.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",y.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(Ja({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,y.monthEndCloseChecks?.auditSummary,y.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Ke:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?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:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=Ve?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=>{Le(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&L.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(ve()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(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(L.trackAICFOChatScreenStateChanged("viewed","left_menu",J??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const R=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:R,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,H=At(B)&&B!=="command_center";if(B!=="command_center"&&!H||f[i.tenantId]==null||L.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),H&&f[i.tenantId]!=null){const R=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${R.month}-${R.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const Q=yt(e.type);vt(e.type)?(J!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Q}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),J===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:y,onPeriodChange:Ea,onCalendarOpen:He,aiCfoView:W,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),ya=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`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(Lt,{})}),d.jsx(Vt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ye=Ue((e=>e.breakpoints.up("md"))),va=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Rt,{className:c.root,children:[d.jsx(Ft,{}),Je===!1?d.jsxs(d.Fragment,{children:[ye||!F?null:ya,d.jsxs("nav",{className:c.drawer,children:[ye?null:d.jsx(Me,{container:window.document.body,variant:"temporary",open:V,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),va?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(_))),V={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(jt,{tenantEmailDomain:a,...V})},Lt=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-fvHZHCch.js";import{a as o,R as Ta}from"./sentry-5M-_hQEn.js";import{u as Fe,j as r,g as $a,h as Ba,q as j}from"./core-CjSjXYyY.js";import{fI as Ge,Up as xa,Uq as Re,gc as Aa,gy as X,Ur as ee,jI as ye,jg as Te,Us as _a,Ut as Da,gS as Ma,q3 as Ua,Uu as Fa,Uv as $e,gp as Ga,Uw as x,fH as Ra,gw as Za,Ux as Ha,Uy as ja,Uz as Va,UA as Be,UB as La,UC as xe,UD as Pa,Ev as Na,gq as qa,h5 as Oa,cW as za,UE as Wa,UF as Ya,qG as Ka,gb as Ja,ja as Qa,UG as Xa,UH as et,wK as at,gr as tt}from"./zeni-epic-state-DbSzv5hl.js";import{w as nt,i as ot,a as st,Z 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-zhznqeY3.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-Cv0Yu4Hx.js";import{u as Gt}from"./InboxNotificationsProvider-BDvEEMzw.js";import{u as Rt}from"./useTaskManagerAccess-AyRfKL8F.js";import{u as Zt}from"./expenseAutomationHelper-CBURllgC.js";import"./recharts-iN3Tsoxx.js";import"./analytics-C3JIdGJp.js";import"./plaid-B_ZF6XEj.js";import"./dnd-DQdg3jZV.js";import"./stripe-cKAAJElX.js";import"./lottie-Cmgc5pKa.js";import"./lexical-DFfYCN7b.js";import"./pdf-C21rIcNJ.js";import"./utils-CSmUhNCi.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]="363de0f9-33b3-4da8-bde5-5d521dd5d2db",a._sentryDebugIdIdentifier="sentry-dbid-363de0f9-33b3-4da8-bde5-5d521dd5d2db")}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(),M=(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((()=>{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=()=>{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=>Ma(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((()=>{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)),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"),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"?Je: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(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(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(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(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(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"}))))`
2
2
  height: 20px;
3
3
  width: 20px;
4
4
  color: ${a=>a.theme.colors.primary};
5
- `,Vt=ne((a=>o.createElement("svg",{viewBox:"0 0 102 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{d:"M73.4046 13.2609H57.77C58.0392 15.0844 58.8324 16.5249 60.352 17.5133C61.5784 18.3113 62.9424 18.5733 64.3842 18.407C64.8867 18.3484 65.3952 18.2539 65.8738 18.0935C67.1433 17.6676 68.0945 16.8923 68.4559 15.5031H73.2777C73.1629 16.3885 72.8877 17.1866 72.4845 17.938C71.4734 19.8189 69.9228 21.1159 67.9414 21.8302C64.3076 23.138 60.7875 22.9178 57.5642 20.6588C55.1293 18.9526 53.7318 16.5465 53.3034 13.6055C52.9959 11.4973 53.2065 9.43809 54.1374 7.49857C55.6988 4.2453 58.2761 2.29381 61.8273 1.67642C64.048 1.28995 66.2124 1.54361 68.2202 2.60969C71.2784 4.23333 73.0085 6.79743 73.4405 10.2314C73.5649 11.2161 73.5374 12.202 73.407 13.2621L73.4046 13.2609ZM68.3554 9.72765C68.3278 9.51706 68.3159 9.334 68.2788 9.15692C68.0622 8.12913 67.4915 7.32388 66.6767 6.68735C65.7697 5.97902 64.7264 5.68349 63.5825 5.62486C61.0543 5.49444 58.8289 7.02356 58.0918 9.44408C58.0655 9.52903 58.0595 9.62116 58.0416 9.72765H68.3566H68.3554Z",fill:"currentColor"}),o.createElement("path",{d:"M52.7423 17.86V21.9162C52.7423 22.0478 52.6346 22.1555 52.503 22.1555H34.5854C34.5854 22.1555 34.595 19.9659 34.5783 19.1008C34.5723 18.7861 34.662 18.5528 34.8786 18.3183C38.3664 14.535 41.8458 10.7445 45.3276 6.95397C45.452 6.81877 45.744 6.49093 45.744 6.49093H35.6396C35.5079 6.49093 35.4003 6.38324 35.4003 6.25163V2.14645C35.4003 2.01483 35.5079 1.90715 35.6396 1.90715H52.6334C52.6334 1.90715 52.6274 4.18288 52.6418 5.17239C52.6454 5.41767 52.5341 5.57321 52.3833 5.73713C50.1543 8.15884 41.5048 17.6219 41.5048 17.6219H52.5042C52.6358 17.6219 52.7435 17.7296 52.7435 17.8612L52.7423 17.86Z",fill:"currentColor"}),o.createElement("path",{d:"M94.0631 22.0758H89.7353C89.6037 22.0758 89.496 21.9694 89.496 21.8377C89.4925 20.5539 89.4733 14.3919 89.4769 11.3696C89.4769 10.6397 89.4195 9.92064 89.2041 9.21829C88.6142 7.29553 87.0528 6.12056 85.0367 6.07151C83.7122 6.0392 82.5288 6.37542 81.58 7.34578C80.8406 8.10196 80.4386 9.02686 80.2998 10.0642C80.2388 10.5213 80.2148 10.9879 80.2136 11.4498C80.2076 14.429 80.2088 20.5539 80.21 21.8365C80.21 21.9682 80.1023 22.0758 79.9707 22.0758H75.6047C75.4731 22.0758 75.3654 21.9705 75.3654 21.8389C75.3606 20.512 75.3403 13.9576 75.387 10.6349C75.4205 8.27546 76.1838 6.1433 77.78 4.36411C79.2062 2.77516 80.9973 1.84189 83.1056 1.52243C84.8441 1.258 86.5658 1.3286 88.2254 1.93642C91.4727 3.12454 93.3954 5.47924 94.093 8.83302C94.2557 9.61314 94.3072 10.4268 94.3131 11.226C94.3335 14.3321 94.3083 20.5503 94.3036 21.8401C94.3036 21.9717 94.1959 22.077 94.0643 22.077L94.0631 22.0758Z",fill:"currentColor"}),o.createElement("path",{d:"M97.2196 1.90527H101.482C101.613 1.90527 101.721 2.01176 101.721 2.14338L101.772 21.9035C101.772 22.0363 101.666 22.144 101.533 22.144H97.2256C97.094 22.144 96.9863 22.0363 96.9863 21.9047L96.9803 2.14457C96.9803 2.01296 97.088 1.90527 97.2196 1.90527Z",fill:"currentColor"}),o.createElement("path",{d:"M17.1795 0.0270299C16.9776 -0.0551712 16.7491 0.057251 16.6911 0.267589C16.6706 0.342537 16.6476 0.417486 16.6234 0.491225C16.4022 1.1573 16.0299 1.76655 15.5197 2.27789C14.6566 3.14221 13.5082 3.61971 12.2861 3.62091H12.2825C11.0627 3.62091 9.91435 3.14584 9.05124 2.28394C8.54111 1.77381 8.16636 1.16455 7.94394 0.499687C7.91976 0.425947 7.89679 0.350999 7.87503 0.276051C7.81701 0.0657128 7.58854 -0.0455005 7.38666 0.0367007C6.20321 0.522655 5.108 1.17906 4.13125 1.97447C4.00795 2.07481 3.96806 2.24525 4.02729 2.39273C4.07686 2.51603 4.13004 2.63813 4.18565 2.7578C4.62204 3.70916 5.22888 4.58557 5.99166 5.34714C7.67316 7.02501 9.90589 7.94977 12.2813 7.94977H12.2897C14.6675 7.94736 16.9027 7.01897 18.5829 5.33626C19.3445 4.57348 19.9489 3.69586 20.3841 2.7445C20.4397 2.62362 20.4917 2.50153 20.5413 2.37823C20.6005 2.23075 20.5606 2.0603 20.4373 1.95997C19.4594 1.16576 18.3629 0.511775 17.1795 0.0270299Z",fill:"#97C3B9"}),o.createElement("path",{d:"M20.3984 21.2422C19.962 20.2933 19.3564 19.4193 18.596 18.6602C16.9133 16.9799 14.6733 16.0527 12.2979 16.0575C8.71131 16.0611 5.61789 18.196 4.2108 21.2604C4.1564 21.38 4.10321 21.5009 4.05244 21.623C3.992 21.7705 4.03189 21.9422 4.1564 22.0437C5.13435 22.8367 6.22956 23.4895 7.41181 23.973C7.61369 24.0552 7.84095 23.944 7.90018 23.7337C7.92073 23.6575 7.9437 23.5838 7.96908 23.5088C8.57713 21.698 10.2876 20.3888 12.3016 20.3864H12.3064C13.5261 20.3864 14.6745 20.8615 15.5376 21.7234C16.0466 22.2311 16.4189 22.8379 16.6413 23.5004C16.6667 23.5741 16.6897 23.649 16.7102 23.724C16.7694 23.9343 16.9967 24.0455 17.1986 23.9621C18.382 23.4762 19.476 22.821 20.4528 22.0256C20.5761 21.9252 20.616 21.7536 20.5567 21.6061C20.5072 21.4828 20.454 21.3619 20.3984 21.241V21.2422Z",fill:"#97C3B9"}),o.createElement("path",{d:"M0.494416 9.85376C0.31309 9.85376 0.161985 9.98795 0.13539 10.1669C0.045936 10.7676 0 11.3829 0 12.0091C0 12.6401 0.0483536 13.2603 0.141434 13.8659C0.169238 14.0448 0.320343 14.1778 0.501669 14.1778L24.0934 14.1427C24.2747 14.1427 24.4258 14.0086 24.4524 13.8296C24.5419 13.2288 24.589 12.6135 24.5878 11.9862C24.5878 11.3551 24.5395 10.735 24.4464 10.1294C24.4186 9.95047 24.2675 9.8175 24.0862 9.8175L0.494416 9.85256V9.85376Z",fill:"#97C3B9"}))))`
5
+ `,Lt=ne((a=>o.createElement("svg",{viewBox:"0 0 102 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{d:"M73.4046 13.2609H57.77C58.0392 15.0844 58.8324 16.5249 60.352 17.5133C61.5784 18.3113 62.9424 18.5733 64.3842 18.407C64.8867 18.3484 65.3952 18.2539 65.8738 18.0935C67.1433 17.6676 68.0945 16.8923 68.4559 15.5031H73.2777C73.1629 16.3885 72.8877 17.1866 72.4845 17.938C71.4734 19.8189 69.9228 21.1159 67.9414 21.8302C64.3076 23.138 60.7875 22.9178 57.5642 20.6588C55.1293 18.9526 53.7318 16.5465 53.3034 13.6055C52.9959 11.4973 53.2065 9.43809 54.1374 7.49857C55.6988 4.2453 58.2761 2.29381 61.8273 1.67642C64.048 1.28995 66.2124 1.54361 68.2202 2.60969C71.2784 4.23333 73.0085 6.79743 73.4405 10.2314C73.5649 11.2161 73.5374 12.202 73.407 13.2621L73.4046 13.2609ZM68.3554 9.72765C68.3278 9.51706 68.3159 9.334 68.2788 9.15692C68.0622 8.12913 67.4915 7.32388 66.6767 6.68735C65.7697 5.97902 64.7264 5.68349 63.5825 5.62486C61.0543 5.49444 58.8289 7.02356 58.0918 9.44408C58.0655 9.52903 58.0595 9.62116 58.0416 9.72765H68.3566H68.3554Z",fill:"currentColor"}),o.createElement("path",{d:"M52.7423 17.86V21.9162C52.7423 22.0478 52.6346 22.1555 52.503 22.1555H34.5854C34.5854 22.1555 34.595 19.9659 34.5783 19.1008C34.5723 18.7861 34.662 18.5528 34.8786 18.3183C38.3664 14.535 41.8458 10.7445 45.3276 6.95397C45.452 6.81877 45.744 6.49093 45.744 6.49093H35.6396C35.5079 6.49093 35.4003 6.38324 35.4003 6.25163V2.14645C35.4003 2.01483 35.5079 1.90715 35.6396 1.90715H52.6334C52.6334 1.90715 52.6274 4.18288 52.6418 5.17239C52.6454 5.41767 52.5341 5.57321 52.3833 5.73713C50.1543 8.15884 41.5048 17.6219 41.5048 17.6219H52.5042C52.6358 17.6219 52.7435 17.7296 52.7435 17.8612L52.7423 17.86Z",fill:"currentColor"}),o.createElement("path",{d:"M94.0631 22.0758H89.7353C89.6037 22.0758 89.496 21.9694 89.496 21.8377C89.4925 20.5539 89.4733 14.3919 89.4769 11.3696C89.4769 10.6397 89.4195 9.92064 89.2041 9.21829C88.6142 7.29553 87.0528 6.12056 85.0367 6.07151C83.7122 6.0392 82.5288 6.37542 81.58 7.34578C80.8406 8.10196 80.4386 9.02686 80.2998 10.0642C80.2388 10.5213 80.2148 10.9879 80.2136 11.4498C80.2076 14.429 80.2088 20.5539 80.21 21.8365C80.21 21.9682 80.1023 22.0758 79.9707 22.0758H75.6047C75.4731 22.0758 75.3654 21.9705 75.3654 21.8389C75.3606 20.512 75.3403 13.9576 75.387 10.6349C75.4205 8.27546 76.1838 6.1433 77.78 4.36411C79.2062 2.77516 80.9973 1.84189 83.1056 1.52243C84.8441 1.258 86.5658 1.3286 88.2254 1.93642C91.4727 3.12454 93.3954 5.47924 94.093 8.83302C94.2557 9.61314 94.3072 10.4268 94.3131 11.226C94.3335 14.3321 94.3083 20.5503 94.3036 21.8401C94.3036 21.9717 94.1959 22.077 94.0643 22.077L94.0631 22.0758Z",fill:"currentColor"}),o.createElement("path",{d:"M97.2196 1.90527H101.482C101.613 1.90527 101.721 2.01176 101.721 2.14338L101.772 21.9035C101.772 22.0363 101.666 22.144 101.533 22.144H97.2256C97.094 22.144 96.9863 22.0363 96.9863 21.9047L96.9803 2.14457C96.9803 2.01296 97.088 1.90527 97.2196 1.90527Z",fill:"currentColor"}),o.createElement("path",{d:"M17.1795 0.0270299C16.9776 -0.0551712 16.7491 0.057251 16.6911 0.267589C16.6706 0.342537 16.6476 0.417486 16.6234 0.491225C16.4022 1.1573 16.0299 1.76655 15.5197 2.27789C14.6566 3.14221 13.5082 3.61971 12.2861 3.62091H12.2825C11.0627 3.62091 9.91435 3.14584 9.05124 2.28394C8.54111 1.77381 8.16636 1.16455 7.94394 0.499687C7.91976 0.425947 7.89679 0.350999 7.87503 0.276051C7.81701 0.0657128 7.58854 -0.0455005 7.38666 0.0367007C6.20321 0.522655 5.108 1.17906 4.13125 1.97447C4.00795 2.07481 3.96806 2.24525 4.02729 2.39273C4.07686 2.51603 4.13004 2.63813 4.18565 2.7578C4.62204 3.70916 5.22888 4.58557 5.99166 5.34714C7.67316 7.02501 9.90589 7.94977 12.2813 7.94977H12.2897C14.6675 7.94736 16.9027 7.01897 18.5829 5.33626C19.3445 4.57348 19.9489 3.69586 20.3841 2.7445C20.4397 2.62362 20.4917 2.50153 20.5413 2.37823C20.6005 2.23075 20.5606 2.0603 20.4373 1.95997C19.4594 1.16576 18.3629 0.511775 17.1795 0.0270299Z",fill:"#97C3B9"}),o.createElement("path",{d:"M20.3984 21.2422C19.962 20.2933 19.3564 19.4193 18.596 18.6602C16.9133 16.9799 14.6733 16.0527 12.2979 16.0575C8.71131 16.0611 5.61789 18.196 4.2108 21.2604C4.1564 21.38 4.10321 21.5009 4.05244 21.623C3.992 21.7705 4.03189 21.9422 4.1564 22.0437C5.13435 22.8367 6.22956 23.4895 7.41181 23.973C7.61369 24.0552 7.84095 23.944 7.90018 23.7337C7.92073 23.6575 7.9437 23.5838 7.96908 23.5088C8.57713 21.698 10.2876 20.3888 12.3016 20.3864H12.3064C13.5261 20.3864 14.6745 20.8615 15.5376 21.7234C16.0466 22.2311 16.4189 22.8379 16.6413 23.5004C16.6667 23.5741 16.6897 23.649 16.7102 23.724C16.7694 23.9343 16.9967 24.0455 17.1986 23.9621C18.382 23.4762 19.476 22.821 20.4528 22.0256C20.5761 21.9252 20.616 21.7536 20.5567 21.6061C20.5072 21.4828 20.454 21.3619 20.3984 21.241V21.2422Z",fill:"#97C3B9"}),o.createElement("path",{d:"M0.494416 9.85376C0.31309 9.85376 0.161985 9.98795 0.13539 10.1669C0.045936 10.7676 0 11.3829 0 12.0091C0 12.6401 0.0483536 13.2603 0.141434 13.8659C0.169238 14.0448 0.320343 14.1778 0.501669 14.1778L24.0934 14.1427C24.2747 14.1427 24.4258 14.0086 24.4524 13.8296C24.5419 13.2288 24.589 12.6135 24.5878 11.9862C24.5878 11.3551 24.5395 10.735 24.4464 10.1294C24.4186 9.95047 24.2675 9.8175 24.0862 9.8175L0.494416 9.85256V9.85376Z",fill:"#97C3B9"}))))`
6
6
  height: ${xt.sp4};
7
7
  width: 102px;
8
8
  color: ${a=>a.theme.colors.primary};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-DCIY2V5W.js";import{a as d}from"./sentry--FQm-CEz.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-DO2aQ9sC.js";import{fI as P,Zu as w,Zb as R,I6 as E,I0 as q,I4 as A,HV as H,Zd as K,HZ as ae,I8 as oe,HY as Y,Ib as z,I7 as C}from"./zeni-epic-state-Cc-xO4DM.js";import{z as O,w as J,bX as pe,q as T,bR as X,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-DtDfc4Ly.js";import{u as M}from"./mui-Beesmy34.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-BXCFB-xI.js";import ie from"./NotFoundScreen-DUP1I-Dh.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]="12d131f7-93ab-45a1-8b06-1e83bc9decfd",e._sentryDebugIdIdentifier="sentry-dbid-12d131f7-93ab-45a1-8b06-1e83bc9decfd")}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,b)=>{r.endsWith(k)&&b.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}=X(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 b={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,I,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,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const m=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const g=!!re(I.value);return{type:g?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(b);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(z(!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(Y(!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 I=[];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";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},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 b=m?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!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}=X(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(Y(!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-fvHZHCch.js";import{a as d}from"./sentry-5M-_hQEn.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-CjSjXYyY.js";import{fI as P,Zr as w,Z8 as R,I3 as E,HZ as H,I1 as A,HS as q,Za as K,HW as ae,I5 as oe,HV as z,I8 as X,I4 as C}from"./zeni-epic-state-DbSzv5hl.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-zhznqeY3.js";import{u as M}from"./mui-Cv0Yu4Hx.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-BRSlUWFS.js";import ie from"./NotFoundScreen-XYwSCqRV.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]="4c30954b-f770-498e-be29-1a08e783c5c6",e._sentryDebugIdIdentifier="sentry-dbid-4c30954b-f770-498e-be29-1a08e783c5c6")}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(q(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(H(!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(q(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(H(!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};