@zeniai/web-app-ui 5.3.45-qa → 5.3.46-qa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/assets/{AccountMappingScreen-EqyOLk0W.js → AccountMappingScreen-BT617fFT.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-B_Hxuz1x.js → ActualMatchingMatchDetailScreen-B8f2yDaP.js} +1 -1
  3. package/dist/assets/AddressRoutes-kiur36N3.js +1 -0
  4. package/dist/assets/AddressScreen-5ZLJ7_Lf.js +9 -0
  5. package/dist/assets/{AiCfoScreen-DgiomMQs.js → AiCfoScreen-CW5K1JhC.js} +1 -1
  6. package/dist/assets/{AppDrawer-C9JSspSl.js → AppDrawer-D5UtqVeE.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-CtPNwVvl.js → BillPayApprovalRoutes-DwyJret-.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-Duz6Vx7D.js → BillPayRoutes-DFm7lkFc.js} +1 -1
  9. package/dist/assets/{BusinessVerificationPageScreen-BAWcvg1q.js → BusinessVerificationPageScreen-BL6H7JF-.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-C-_PDYQc.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-B08xwpTq.js → ChargeCardRoutes-Brg8E0b9.js} +1 -1
  12. package/dist/assets/{CompanyPassportScreen-CbwVCSdf.js → CompanyPassportScreen-CEuR94fF.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-BcoTZa8L.js → ConnectionAuthScreen-uvgGU2za.js} +1 -1
  14. package/dist/assets/CustomerOnboardingAuthScreen-C-d3MNce.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-BP006ys9.js → CustomerOnboardingRoutes-BffNdH_l.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-DKsy8kjy.js → DashboardRoutes-CdQzvjb3.js} +1 -1
  17. package/dist/assets/{DefaultTenantHome-h9sstg-6.js → DefaultTenantHome-Bve2xDaJ.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-DdrkO-LG.js → DomesticWireDetailScreen-Dj3JCDGh.js} +3 -3
  19. package/dist/assets/DrawerScreen-CxKP-6Rf.js +1 -0
  20. package/dist/assets/{EntityDetailRoutes-TJfEMlzp.js → EntityDetailRoutes-CRL6OrqO.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-FRK8lYq7.js → ExpenseAutomationRoutes-BYSJ88to.js} +1 -1
  22. package/dist/assets/{FeaturePreviewScreen-R_rh5xYj.js → FeaturePreviewScreen-LeLfD5pA.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-Bf48Zrcv.js → HubSpotOAuthCallbackScreen-DAHGdPOy.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-CMirleoY.js → InboxNotificationsProvider-gj6fT2eX.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-D9DMbY6F.js → InvoicingRoutes-CvkWcLdT.js} +1 -1
  26. package/dist/assets/{MagicLinkRoutes-DVS2kuyq.js → MagicLinkRoutes-CC75kCuL.js} +6 -6
  27. package/dist/assets/MagicLinkSignInScreen-CWvMyhrQ.js +12 -0
  28. package/dist/assets/{MobileAppDrawer-DEm85bH8.js → MobileAppDrawer-DExJFFmi.js} +1 -1
  29. package/dist/assets/NotFoundScreen-sryCVGSu.js +1 -0
  30. package/dist/assets/{NotificationRoutes-DlVY8cS0.js → NotificationRoutes-njgUFBoj.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-0eyA85wD.js → OAuthConsentScreen-BCgV9bma.js} +1 -1
  32. package/dist/assets/{PandLWithForecastRoutes-Ciu8QGi3.js → PandLWithForecastRoutes-CZ27RjQE.js} +1 -1
  33. package/dist/assets/{PaymentLinkScreen-DSvOcNW8.js → PaymentLinkScreen-BrTP8y76.js} +1 -1
  34. package/dist/assets/{PeopleRoutes-B29gnv2-.js → PeopleRoutes-CulbMsz3.js} +9 -9
  35. package/dist/assets/{PerformanceRoutes-C-oSemZm.js → PerformanceRoutes-BYcI02aB.js} +1 -1
  36. package/dist/assets/{Preview-DPyEVqHc.js → Preview-j2_daqeV.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-CUhLSYvc.js → QBOConnectionScreen-CbxnK800.js} +23 -23
  38. package/dist/assets/{ReimbursementApprovalRoutes-CS9p1qcB.js → ReimbursementApprovalRoutes-DeN7vJtz.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CJnxkFoz.js → ReimbursementApprovalRuleDetailScreen-DTKS2oJ9.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-DaGg2TTR.js → ReimbursementRoutes-_NvdZWfU.js} +1 -1
  41. package/dist/assets/{ReportsRoutes-BsvYUCIx.js → ReportsRoutes-BAGPRsE0.js} +1 -1
  42. package/dist/assets/RewardsRoutes-BUOCW-CT.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CJ28c5Wc.js → ScheduleDetailsPrepaidExpensesScreen-B5q5sAGy.js} +4 -4
  44. package/dist/assets/{ScreenRoutes-Lei7nnrR.js → ScreenRoutes-BHHy1uXx.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-DJiPiJIZ.js → SettingsRoutes-BtUbt9zq.js} +1 -1
  46. package/dist/assets/{SetupPagesScreen-BzPNt5Xb.js → SetupPagesScreen-D0fdMGb4.js} +1 -1
  47. package/dist/assets/SignInScreen-5_sPhLr0.js +1 -0
  48. package/dist/assets/SignOutScreen-DrcdcbqC.js +9 -0
  49. package/dist/assets/TaskListScreen-OEgAVE9M.js +9 -0
  50. package/dist/assets/{TaskRoutes-BAifN0A-.js → TaskRoutes-DpYRDMWP.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-eA90CTkf.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-C32uKUIF.js → TransactionDetailScreen-CjwF3ORf.js} +2 -2
  53. package/dist/assets/{TransactionListRoutes-Ebou9bMl.js → TransactionListRoutes-2fGCqEq5.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-Bq4RVae3.js → TreasuryRoutes-CuPpvoic.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-dtzf2p8G.js → VendorsRoutes-B_Yg40bd.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-Dzz50WS2.js → WiseConfirmationScreen-ChaM_jYJ.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-C2FWt_0o.js → ZeniAccountRoutes-CfMUrMqe.js} +1 -1
  58. package/dist/assets/ZeniAccountStatementScreen-BgdXcTdx.js +9 -0
  59. package/dist/assets/{accountMappingHelper-B5wpHG39.js → accountMappingHelper-DWzrp9Pr.js} +1 -1
  60. package/dist/assets/{analytics-5LJ4BXQX.js → analytics-wktvfErl.js} +1 -1
  61. package/dist/assets/{analyticsHelper-k_Sp-PwA.js → analyticsHelper-DcvdGte-.js} +1 -1
  62. package/dist/assets/{core-BI5oX4mx.js → core-D6EV-11Y.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-B7oIXSPO.js → decodeURIComponentSafe-MQV5aj_5.js} +1 -1
  64. package/dist/assets/{dnd-D6wtGmk9.js → dnd-CkchuQYc.js} +1 -1
  65. package/dist/assets/{empty-D1y42ZwI.js → empty-DQLKD1Hp.js} +1 -1
  66. package/dist/assets/{empty-PW7BYANj.js → empty-PZV8n_Ql.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-DRIlZkGm.js → emptyVideoElement-CnlqukSR.js} +1 -1
  68. package/dist/assets/{epic-BgEnH7Qf.js → epic-CVdAQuh9.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-CqPrLTRM.js → expenseAutomationHelper-DEOPVtcg.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-Cv6I-eSM.js → getLocaleForTenant-C3wVeXiS.js} +1 -1
  71. package/dist/assets/{index-BT5wSX8Z.js → index-8ioAZPP6.js} +1 -1
  72. package/dist/assets/{index-BgSgl7o0.js → index-B5kf_qFj.js} +1 -1
  73. package/dist/assets/{index-Cnd56s5E.js → index-BlnK23AJ.js} +1 -1
  74. package/dist/assets/{index-ChUBWLsO.js → index-CBlRXIxp.js} +1 -1
  75. package/dist/assets/{index-C8KisrNI.js → index-CKDPlCKN.js} +2 -2
  76. package/dist/assets/{index-C2L5Bzwa.js → index-DvW7BRlL.js} +13249 -13249
  77. package/dist/assets/{index-Cf-PV9pR.js → index-EnAqWoDC.js} +1 -1
  78. package/dist/assets/{index-COJM8F4x.js → index-qI_nnuux.js} +1 -1
  79. package/dist/assets/{lexical-BLu7UAko.js → lexical-C6tQwGBF.js} +1 -1
  80. package/dist/assets/{liveblocks-CW9yScMF.js → liveblocks-DKqwsBQp.js} +1 -1
  81. package/dist/assets/{lottie-lQbJqTc2.js → lottie-BwhdO6jl.js} +1 -1
  82. package/dist/assets/{mui-KP5Ep0NX.js → mui-qouWiIWk.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Ddmf68xx.js → pathToGoBack-DMRqTTJ7.js} +1 -1
  84. package/dist/assets/{pdf-DflcYtDk.js → pdf-DcGn_mX8.js} +4 -4
  85. package/dist/assets/{pdf-lib-iL5hUpKl.js → pdf-lib-DndwkHl6.js} +1 -1
  86. package/dist/assets/{plaid-BrgJMdej.js → plaid-deRHM6gT.js} +1 -1
  87. package/dist/assets/{pusher-CN7UYIVv.js → pusher-BmM2v3Ys.js} +1 -1
  88. package/dist/assets/{react-C3b5GjIN.js → react-1c5WrJsc.js} +1 -1
  89. package/dist/assets/{react-D7C_-SWb.js → react-D6U1M1pt.js} +1 -1
  90. package/dist/assets/{react-Ow08-_5J.js → react-DFunsRdI.js} +1 -1
  91. package/dist/assets/{react-XJ6XyB9N.js → react-DZ82GBCj.js} +1 -1
  92. package/dist/assets/{react-C3_gvmu5.js → react-DiQLb4cq.js} +1 -1
  93. package/dist/assets/{react-BvzziK5i.js → react-QkGRtVkE.js} +1 -1
  94. package/dist/assets/{recharts-DRl2ZsSW.js → recharts-C9zWmt1W.js} +1 -1
  95. package/dist/assets/{routePaths-BrIEdo8u.js → routePaths-GYFjoelZ.js} +1 -1
  96. package/dist/assets/{sentry-C_uJQK1a.js → sentry-CxSdF_rC.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-CSXpdRK5.js → stripSplatSuffix-CYVrHv_0.js} +1 -1
  98. package/dist/assets/{url-Csr3E4Sb.js → url-BSgCM0lM.js} +1 -1
  99. package/dist/assets/{url-0wqXxJRo.js → url-Ej5v3O6d.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-C-OzIN8B.js → useActualMatchingMatchDetail-BkDnJbPg.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CZodBcrZ.js → useAiCfoDashboardSuggestedQuestionsChips-D_Ro-9Tt.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-DV4bjx-y.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-B3svLsmE.js → useChargeCardPusherEvents-1X1JYShz.js} +1 -1
  104. package/dist/assets/{useDeviceId-CAlK1w38.js → useDeviceId-RToKfM0O.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-CIZ_wxDt.js → useEmailConnectResultRefresh-dVylO6qh.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-BNsRpSRE.js → useInitialThreadRequest-BwX5Js6P.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-Bhr2JI_X.js → useTaskManagerAccess-daSMnBbA.js} +1 -1
  108. package/dist/assets/{utils-BzQpFQvw.js → utils-D8aAQJhF.js} +1 -1
  109. package/dist/assets/{withTransactionSidePanel-mkP2Wc9X.js → withTransactionSidePanel-CPG02lKM.js} +1 -1
  110. package/dist/assets/{zeni-epic-state-CIizsNeB.js → zeni-epic-state-CZbm731W.js} +3 -3
  111. package/dist/index.html +1 -1
  112. package/package.json +3 -3
  113. package/dist/assets/AddressRoutes-ByQnL6Ep.js +0 -1
  114. package/dist/assets/AddressScreen-C2qj6tYr.js +0 -9
  115. package/dist/assets/CardsAiCfoScreen-BdTJBLec.js +0 -14
  116. package/dist/assets/CustomerOnboardingAuthScreen-BpGFH1t5.js +0 -1
  117. package/dist/assets/DrawerScreen-KSeYe6Xi.js +0 -1
  118. package/dist/assets/MagicLinkSignInScreen-CmaiVv9M.js +0 -12
  119. package/dist/assets/NotFoundScreen-CS6UgwGr.js +0 -1
  120. package/dist/assets/RewardsRoutes-BeNSEmB_.js +0 -1
  121. package/dist/assets/SignInScreen-OFMK0Fhv.js +0 -1
  122. package/dist/assets/SignOutScreen-Duww-LZM.js +0 -9
  123. package/dist/assets/TaskListScreen-Dy6L1Gr_.js +0 -9
  124. package/dist/assets/TransactionDetailRoutes-KEbThb3n.js +0 -1
  125. package/dist/assets/ZeniAccountStatementScreen-CJtdjYJW.js +0 -9
  126. package/dist/assets/useAskAiCfoHostNavButtonProps-4TGjNsPg.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as D}from"./liveblocks-CW9yScMF.js";import{a as o}from"./sentry-C_uJQK1a.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-BI5oX4mx.js";import{ai as Z,N as ee,d as $,z as te,o as G,aj as ne,k as ae,S as ce}from"./index-C2L5Bzwa.js";import{bn as se,fF as oe,gV as ie,oB as Q,Uw as re,i8 as J,gh as le,os as ue,Ux as de,Uy as pe,u6 as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as ye,Uz as Ie,UA as Se}from"./zeni-epic-state-CIizsNeB.js";import{n as he}from"./mui-KP5Ep0NX.js";import{M as Ee}from"./MobileAppDrawer-DEm85bH8.js";import{q as R}from"./QBOConnectionScreen-CUhLSYvc.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-B5wpHG39.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]="d689ff63-882c-4b03-8745-62df506e7bcc",a._sentryDebugIdIdentifier="sentry-dbid-d689ff63-882c-4b03-8745-62df506e7bcc")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},we=he.div`
1
+ import{j as D}from"./liveblocks-DKqwsBQp.js";import{a as o}from"./sentry-CxSdF_rC.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-D6EV-11Y.js";import{ai as Z,N as ee,d as $,z as te,q as G,aj as ne,l as ae,T as ce}from"./index-DvW7BRlL.js";import{bn as se,fF as oe,gV as ie,oB as Q,Uw as le,i8 as J,gh as re,os as ue,Ux as de,Uy as pe,u6 as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as ye,Uz as Ie,UA as Se}from"./zeni-epic-state-CZbm731W.js";import{n as he}from"./mui-qouWiIWk.js";import{M as Ee}from"./MobileAppDrawer-DExJFFmi.js";import{q as R}from"./QBOConnectionScreen-CbxnK800.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DWzrp9Pr.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]="13e06298-0dba-4ff1-9d1d-823ef4b853d3",a._sentryDebugIdIdentifier="sentry-dbid-13e06298-0dba-4ff1-9d1d-823ef4b853d3")}catch{}})();const r="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},we=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as D}from"./liveblocks-CW9yScMF.js";import{a as o}from"./sentry-C_uJQK1
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${a=>a.theme.colors.grey4};
9
- `,xe=Y((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:x,filing1099Section:v}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=x,{bankAccount:M,expenseCategory1099:j}=v,b=h(e.accountMappingView.incomeAccountList,C.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),U=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),I=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:k?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:I};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(Ie())):a(J())},onSaveClick:()=>{a(ye()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(fe(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=K(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:w,isDynamicConfigLoading:x}=r("transaction_categorization_config"),v=!x&&w?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),j=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[B,N]of g)N===null?delete n[B]:n[B]=N;const[S,H]=g[0]??[];S!=null&&c(Q(s.companyId,S,H,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,U]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const y=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[y,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),I=t=>{U(t)};return D.jsxs(we,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:I}),D.jsx(xe,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:v,capitalizableAccounts:V,accountNamesById:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:G(i),onClickMenuIcon:()=>I(!0)})]})};export{l as P,_e as U,u as a};
9
+ `,xe=Y((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(r),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:l=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:w,vendorsAccountSection:x,filing1099Section:v}=l,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:T}=w,{prepaidExpensesAccount:p,fixedAssetsAccount:V,accruedExpensesAccount:O}=x,{bankAccount:M,expenseCategory1099:j}=v,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),P=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,T.selectedOption),k=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),U=E(e.accountMappingView.fixedAssetsAccountList,V.selectedOptions),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),I=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:P?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:k.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:I};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(Ie())):a(J())},onSaveClick:()=>{a(ye()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:l=>{a(fe(e.currentTenant.companyId,l))},onAccountingProjectsToggle:l=>{const d=sessionStorage.getItem(r);d===u.pending||d===u.ready||a(l?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=K(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:l}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:w,isDynamicConfigLoading:x}=l("transaction_categorization_config"),v=!x&&w?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:T,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:V,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),j=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[B,N]of g)N===null?delete n[B]:n[B]=N;const[S,H]=g[0]??[];S!=null&&c(Q(s.companyId,S,H,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>le(t.accountState)),q),P=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),[k,U]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const y=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(r)===u.pending&&(sessionStorage.removeItem(r),c(re({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(r)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(r),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(r,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[y,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),I=t=>{U(t)};return D.jsxs(we,{children:[D.jsx(Ee,{isAppContentDrawerOpen:k,handleDrawerToggle:I}),D.jsx(xe,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:v,capitalizableAccounts:T,accountNamesById:P,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:V,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:G(i),onClickMenuIcon:()=>I(!0)})]})};export{r as P,_e as U,u as a};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-CW9yScMF.js";import{a as k}from"./sentry-C_uJQK1a.js";import{a4 as I,dR as g}from"./index-C2L5Bzwa.js";import"./mui-KP5Ep0NX.js";import{u as y}from"./useActualMatchingMatchDetail-C-OzIN8B.js";import R from"./NotFoundScreen-CS6UgwGr.js";import{i as v,h as U,g as w}from"./core-BI5oX4mx.js";import"./zeni-epic-state-CIizsNeB.js";import"./recharts-DRl2ZsSW.js";import"./analytics-5LJ4BXQX.js";import"./plaid-BrgJMdej.js";import"./dnd-D6wtGmk9.js";import"./stripe-cKAAJElX.js";import"./lottie-lQbJqTc2.js";import"./lexical-BLu7UAko.js";import"./pdf-DflcYtDk.js";import"./utils-BzQpFQvw.js";import"./stripSplatSuffix-CSXpdRK5.js";import"./decodeURIComponentSafe-B7oIXSPO.js";import"./routePaths-BrIEdo8u.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]="ce9c10db-7449-433c-997f-f15acb078a66",t._sentryDebugIdIdentifier="sentry-dbid-ce9c10db-7449-433c-997f-f15acb078a66")}catch{}})();function K(){const{matchId:t,tenantEmailDomain:e}=v(),n=U(),r=w(),b=y(t??""),a=k.useCallback((()=>{const S=I(r.state?.pathnameStackToGoBack);n(S.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:S.newStack}})}),[r.state,n,e]);if(t==null)return s.jsx(R,{});const{match:i,detailFetchState:o,handleOpenBill:l,handleRefresh:c,handleUndoReversal:d,handleContinueMatch:h,lastMatchResults:f,lastUndoResults:m,refreshStatus:p,undoReversalStatus:u}=b;return i==null?o.fetchState==="Not-Started"||o.fetchState==="In-Progress"?s.jsx(g,{detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m}):s.jsx(R,{}):s.jsx(g,{match:i,detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m})}export{K as default};
1
+ import{j as s}from"./liveblocks-DKqwsBQp.js";import{a as k}from"./sentry-CxSdF_rC.js";import{a4 as I,dR as g}from"./index-DvW7BRlL.js";import"./mui-qouWiIWk.js";import{u as y}from"./useActualMatchingMatchDetail-BkDnJbPg.js";import R from"./NotFoundScreen-sryCVGSu.js";import{i as v,h as U,g as w}from"./core-D6EV-11Y.js";import"./zeni-epic-state-CZbm731W.js";import"./recharts-C9zWmt1W.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.js";import"./stripSplatSuffix-CYVrHv_0.js";import"./decodeURIComponentSafe-MQV5aj_5.js";import"./routePaths-GYFjoelZ.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]="ce9c10db-7449-433c-997f-f15acb078a66",t._sentryDebugIdIdentifier="sentry-dbid-ce9c10db-7449-433c-997f-f15acb078a66")}catch{}})();function K(){const{matchId:t,tenantEmailDomain:e}=v(),n=U(),r=w(),b=y(t??""),a=k.useCallback((()=>{const S=I(r.state?.pathnameStackToGoBack);n(S.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:S.newStack}})}),[r.state,n,e]);if(t==null)return s.jsx(R,{});const{match:i,detailFetchState:o,handleOpenBill:l,handleRefresh:c,handleUndoReversal:d,handleContinueMatch:h,lastMatchResults:f,lastUndoResults:m,refreshStatus:p,undoReversalStatus:u}=b;return i==null?o.fetchState==="Not-Started"||o.fetchState==="In-Progress"?s.jsx(g,{detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m}):s.jsx(R,{}):s.jsx(g,{match:i,detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m})}export{K as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DKqwsBQp.js";import{A as i}from"./AddressScreen-5ZLJ7_Lf.js";import s from"./NotFoundScreen-sryCVGSu.js";import"./sentry-CxSdF_rC.js";import{n as d,o as r}from"./core-D6EV-11Y.js";import"./zeni-epic-state-CZbm731W.js";import"./recharts-C9zWmt1W.js";import"./index-DvW7BRlL.js";import"./mui-qouWiIWk.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.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 n}from"./liveblocks-DKqwsBQp.js";import{a as b}from"./sentry-CxSdF_rC.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-D6EV-11Y.js";import{a1 as $,E as D,z as L,U as V,a7 as K,a8 as U,l as C,T as S,a3 as F,Z as h,a4 as z}from"./index-DvW7BRlL.js";import{Vb as _,ip as R,fF as G,Vc as H,c8 as N,Vd as O,mH as q}from"./zeni-epic-state-CZbm731W.js";import{n as Z}from"./mui-qouWiIWk.js";import J from"./NotFoundScreen-sryCVGSu.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]="61f05193-2851-4817-bddb-aff6528671ea",e._sentryDebugIdIdentifier="sentry-dbid-61f05193-2851-4817-bddb-aff6528671ea")}catch{}})();const Q=Z.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
+ `,W=M((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=G(e),a=s.roleMap!=null&&H(s.roleMap),d=i||c==="user_address"||N(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:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=_(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=z(d?.pathnameStackToGoBack);let t=r.poppedPathname??v();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}o(t,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:a=>{const d=X(a);e(q({addressType:c,addressToCreate:d})),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)}}}))(F);function ne({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=P(),r=j(),{addressId:t,addressType:u}=E(),g=$(),I=D(),k=L.getSignedInUser(),[f,w]=b.useState(t==null),p=B((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=V();if(k==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||(w(!0),d(R(t,!1)))}),[f,t,d]),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"?n.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(U,{analytics:C,onLoad:A}),n.jsx(Q,{windowSize:g,children:n.jsx(W,{location:r,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):n.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},X=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{ne as A,X as t};
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-CW9yScMF.js";import{a}from"./sentry-C_uJQK1a.js";import{u as Rt,h as Tt,i as Ot,g as jt,j as b,l as At}from"./core-BI5oX4mx.js";import{a as Qt,O as Dt,e8 as Lt,z as Ut,a1 as _t,e9 as Bt,ea as Ft,eb as Mt,bo as Ae,ec as Ne,ed as Vt,bn as Ge,a4 as me,a8 as re,k as B,ee as le,ef as $t,eg as Nt,au as Gt,S as qt,w as Ht,eh as zt,ei as Wt,av as Jt,ej as Kt,ek as Yt,el as Xt,em as Zt,p as es,bk as Qe,en as ts}from"./index-C2L5Bzwa.js";import{fE as _,gt as y,TV as ss,a21 as as,a22 as ns,jM as os,a23 as is,jJ as rs,a24 as de,jD as ue,jT as z,jl as Se,jB as De,jz as ls,jQ as ds,ju as qe,U2 as Le,gv as F,gK as us,U1 as cs,TO as Ue,fF as ms,j3 as Ss,a25 as hs,g8 as ps,jh as fs,jd as gs,fG as ce,gf as Cs,a26 as Is,a27 as ks,a28 as bs,gu as vs,go as _e,k4 as Be,gq as Fe,gw as Es,a29 as Me,jV as Ps,ja as ws,jo as ys,jR as Ve,jr as xs,gx as Rs,gy as Ts,gz as Os,gA as js}from"./zeni-epic-state-CIizsNeB.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-KP5Ep0NX.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-CZodBcrZ.js";import{p as Us}from"./pathToGoBack-Ddmf68xx.js";import{j as _s}from"./routePaths-BrIEdo8u.js";import"./recharts-DRl2ZsSW.js";import"./analytics-5LJ4BXQX.js";import"./plaid-BrgJMdej.js";import"./dnd-D6wtGmk9.js";import"./stripe-cKAAJElX.js";import"./lottie-lQbJqTc2.js";import"./lexical-BLu7UAko.js";import"./pdf-DflcYtDk.js";import"./utils-BzQpFQvw.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="4dc49a6b-c7c3-4d65-a19c-59f75c8b6904",s._sentryDebugIdIdentifier="sentry-dbid-4dc49a6b-c7c3-4d65-a19c-59f75c8b6904")}catch{}})();const He="chat-response-generated";function Bs(s,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 t=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Fs=At((function(s,r){const t=_(s),l=r.isSubmitting,u=t.uiState?.currentChatSessionId,i=u!=null?Cs(s.aiCfoState,u):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),T=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),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:y(s).skills,skillSaveState:Bs(s,T),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:T.fetchState==="In-Progress",skillSaveError:T.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Yt(s),resolveSyntheticAnswerPolicyTile:Kt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:u,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:T,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Rs(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=Ge(p,v);E!=="answer"?B.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):B.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Ts(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(Os({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(js({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:u}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,u,E,c,void 0,v)},onFetchSkills:()=>{s(qe())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Ve({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Ve({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(F()),s(_e()),Qe(s,o,"user_input",void 0,p,u,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Fe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Fe(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(F()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:T,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Rt(),l=Tt(),{session_id:u}=Ot(),i=jt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),T=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ke=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),O=f,pe=n.routines.find((e=>e.scheduleId===O)),C=b((e=>is(e))),Ye=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(O!=null?ue({scheduleId:O}):de())}),[t,O]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??u,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(ue({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(O==null||Ce!==!0)return;const e=window.setInterval((()=>{t(ue({scheduleId:O})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,O]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(ds({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),K=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),Y=a.useCallback((()=>{t(qe()),t(Le())}),[t]),ot=a.useCallback((()=>{t(F())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:dt}=Lt();a.useEffect((()=>{t(us())}),[t]);const g=b((e=>_(e))),R=Ut.getSignedInUser();a.useEffect((()=>u==="routines"?(t(F()),void t(cs())):u==="skills"?(t(de()),t(Ue()),void t(Le())):(U==null&&t(de()),t(Ue()),void t(F()))),[t,U,f,u]);const ut=_t(),j=Gt(ut),k=b((e=>ms(e))),d=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Bt(I),skillName:I.isAdHoc===!0?void 0:K.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:Y,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[Y,Z,X,ee,ge,I,C.fetchState,C.runs,K]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Ft({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:d,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:Y}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),V=i.state,$=V?.aiCfoInitialQuestion,ke=!!V?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&$!=null&&$!==""){const e=i.state;se($),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[$,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??V?.aiCfoRef,ie=ve.get("emailRefId")??V?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||d!=null||R==null||(t(Ss("controller",R.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,d,t,R]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&d!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,d,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=Vt(d),G=g.fetchState,q=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=d!=null?g.fetchChatSessionHistoryByChatSessionId?.[d]?.fetchState??"Not-Started":"Not-Started",xe=d==null||(g.uiState.chatHistoryNextPageToken[d]?.hasMore??!0),Re=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Re,d),Et=vt.length===0;a.useEffect((()=>{w||j||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,j,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Te=a.useRef(void 0),Oe=a.useRef(void 0);a.useEffect((()=>{const e=u!==Te.current,h=d!==Oe.current;Te.current=u,Oe.current=d,u!==d&&(!e||u==null||_s(u)?h&&d!=null&&l(`../ai-cfo/${d}`,{state:{...i.state}}):t(ps({sessionId:u,agentId:"controller"})))}),[d,u]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[we]);a.useEffect((()=>{G!=="In-Progress"&&q&&t(fs())}),[G,q,t]),a.useEffect((()=>{d!=null&&ye!=="In-Progress"&&xe&&R!=null&&(u===d||G==="Completed"&&!q)&&t(gs(d,R.userId))}),[ye,G,xe,q,d,R,u,t]);const je=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(R==null||u==null)throw Error("Can't access AI Controller page without signing in...");const yt=d!=null&&g.responseStateByChatSessionId?.[d]?.answer?.fetchState==="In-Progress";if(!w&&j)return S.jsxs(Vs,{children:[S.jsx(re,{analytics:B,onLoad:je}),te.drawerElement,S.jsx($s,{children:S.jsx($e,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:B,onLoad:je}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:B,onLoad:e=>e.trackPageLoaded(qt.Event.aiCFOPage)}),j&&te.drawerElement,S.jsx(Fs,{...wt,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:Re,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:R.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:u,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:dt,onMenuClick:j?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:T,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:K,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ye,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ke,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&j?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx($e,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!j?S.jsx($t,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},$e=M(Qs)`
1
+ import{j as S}from"./liveblocks-DKqwsBQp.js";import{a}from"./sentry-CxSdF_rC.js";import{u as Rt,h as Tt,i as Ot,g as jt,j as b,l as At}from"./core-D6EV-11Y.js";import{a as Qt,R as Dt,e8 as Lt,z as Ut,a1 as _t,e9 as Bt,ea as Ft,eb as Mt,bo as Ae,ec as Ne,ed as Vt,bn as Ge,a4 as me,a8 as re,l as B,ee as le,ef as $t,eg as Nt,au as Gt,T as qt,w as Ht,eh as zt,ei as Wt,av as Jt,ej as Kt,ek as Yt,el as Xt,em as Zt,p as es,bk as Qe,en as ts}from"./index-DvW7BRlL.js";import{fE as _,gt as y,TV as ss,a21 as as,a22 as ns,jM as os,a23 as is,jJ as rs,a24 as ue,jD as de,jT as z,jl as Se,jB as De,jz as ls,jQ as us,ju as qe,U2 as Le,gv as F,gK as ds,U1 as cs,TO as Ue,fF as ms,j3 as Ss,a25 as hs,g8 as ps,jh as fs,jd as gs,fG as ce,gf as Cs,a26 as Is,a27 as ks,a28 as bs,gu as vs,go as _e,k4 as Be,gq as Fe,gw as Es,a29 as Me,jV as Ps,ja as ws,jo as ys,jR as Ve,jr as xs,gx as Rs,gy as Ts,gz as Os,gA as js}from"./zeni-epic-state-CZbm731W.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-qouWiIWk.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-D_Ro-9Tt.js";import{p as Us}from"./pathToGoBack-DMRqTTJ7.js";import{j as _s}from"./routePaths-GYFjoelZ.js";import"./recharts-C9zWmt1W.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="35e54982-11b8-4524-b2ba-c1139a78050a",s._sentryDebugIdIdentifier="sentry-dbid-35e54982-11b8-4524-b2ba-c1139a78050a")}catch{}})();const He="chat-response-generated";function Bs(s,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 t=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Fs=At((function(s,r){const t=_(s),l=r.isSubmitting,d=t.uiState?.currentChatSessionId,i=d!=null?Cs(s.aiCfoState,d):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),T=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),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:y(s).skills,skillSaveState:Bs(s,T),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:T.fetchState==="In-Progress",skillSaveError:T.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Yt(s),resolveSyntheticAnswerPolicyTile:Kt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:d,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:T,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Rs(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=Ge(p,v);E!=="answer"?B.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):B.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Ts(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(Os({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(js({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,d,E,c,void 0,v)},onFetchSkills:()=>{s(qe())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Ve({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Ve({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(F()),s(_e()),Qe(s,o,"user_input",void 0,p,d,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Fe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Fe(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(F()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:T,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Rt(),l=Tt(),{session_id:d}=Ot(),i=jt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),T=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ke=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),O=f,pe=n.routines.find((e=>e.scheduleId===O)),C=b((e=>is(e))),Ye=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(O!=null?de({scheduleId:O}):ue())}),[t,O]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??d,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(de({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(O==null||Ce!==!0)return;const e=window.setInterval((()=>{t(de({scheduleId:O})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,O]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(us({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),K=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),Y=a.useCallback((()=>{t(qe()),t(Le())}),[t]),ot=a.useCallback((()=>{t(F())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:ut}=Lt();a.useEffect((()=>{t(ds())}),[t]);const g=b((e=>_(e))),R=Ut.getSignedInUser();a.useEffect((()=>d==="routines"?(t(F()),void t(cs())):d==="skills"?(t(ue()),t(Ue()),void t(Le())):(U==null&&t(ue()),t(Ue()),void t(F()))),[t,U,f,d]);const dt=_t(),j=Gt(dt),k=b((e=>ms(e))),u=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Bt(I),skillName:I.isAdHoc===!0?void 0:K.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:Y,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[Y,Z,X,ee,ge,I,C.fetchState,C.runs,K]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Ft({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:Y}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),V=i.state,$=V?.aiCfoInitialQuestion,ke=!!V?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&$!=null&&$!==""){const e=i.state;se($),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[$,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??V?.aiCfoRef,ie=ve.get("emailRefId")??V?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||u!=null||R==null||(t(Ss("controller",R.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,u,t,R]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&u!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,u,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=Vt(u),G=g.fetchState,q=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",xe=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Re=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Re,u),Et=vt.length===0;a.useEffect((()=>{w||j||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,j,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Te=a.useRef(void 0),Oe=a.useRef(void 0);a.useEffect((()=>{const e=d!==Te.current,h=u!==Oe.current;Te.current=d,Oe.current=u,d!==u&&(!e||d==null||_s(d)?h&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(ps({sessionId:d,agentId:"controller"})))}),[u,d]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[we]);a.useEffect((()=>{G!=="In-Progress"&&q&&t(fs())}),[G,q,t]),a.useEffect((()=>{u!=null&&ye!=="In-Progress"&&xe&&R!=null&&(d===u||G==="Completed"&&!q)&&t(gs(u,R.userId))}),[ye,G,xe,q,u,R,d,t]);const je=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(R==null||d==null)throw Error("Can't access AI Controller page without signing in...");const yt=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!w&&j)return S.jsxs(Vs,{children:[S.jsx(re,{analytics:B,onLoad:je}),te.drawerElement,S.jsx($s,{children:S.jsx($e,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:B,onLoad:je}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:B,onLoad:e=>e.trackPageLoaded(qt.Event.aiCFOPage)}),j&&te.drawerElement,S.jsx(Fs,{...wt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Re,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:R.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:d,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:ut,onMenuClick:j?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:T,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:K,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ye,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ke,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&j?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx($e,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!j?S.jsx($t,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},$e=M(Qs)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-CW9yScMF.js";import{a as o,R as va}from"./sentry-C_uJQK1a.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-BI5oX4mx.js";import{fF as Fe,TM as Ba,TN as Re,g9 as xa,gv as Q,TO as X,ju as Ie,jB as Te,TP as Aa,TQ as _a,gO as Da,p$ as Ma,TR as Fa,TS as ve,gm as Ra,TT as $,fE as Za,gt as Ga,TU as Va,TV as Pa,TW as ja,TX as ye,TY as Ha,TZ as $e,T_ as Na,E1 as La,gn as Ua,h1 as Oa,cV as za,T$ as qa,U0 as Ya,qC as Wa,g8 as Qa,j6 as Xa,U1 as Ja,U2 as Ka,wq as et,go as at}from"./zeni-epic-state-CIizsNeB.js";import{w as tt,i as nt,a as ot,E as st,c as rt,N as it,d as m,e as lt,u as dt,f as ct,q as ut,g as mt,h as Ct,R as pt,O as ht,j as ft,z as gt,k as V,p,m as Be,l as bt,V as St,n as xe,o as kt,r as Ae,s as Et,D as wt,v as K,x as J,y as It,A as Tt,B as vt,L as yt,C as $t,F as Bt,H as ee,I as xt,W as At}from"./index-C2L5Bzwa.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-KP5Ep0NX.js";import{u as Rt}from"./InboxNotificationsProvider-CMirleoY.js";import{u as Zt}from"./useTaskManagerAccess-Bhr2JI_X.js";import{u as Gt}from"./expenseAutomationHelper-CqPrLTRM.js";import"./recharts-DRl2ZsSW.js";import"./analytics-5LJ4BXQX.js";import"./plaid-BrgJMdej.js";import"./dnd-D6wtGmk9.js";import"./stripe-cKAAJElX.js";import"./lottie-lQbJqTc2.js";import"./lexical-BLu7UAko.js";import"./pdf-DflcYtDk.js";import"./utils-BzQpFQvw.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]="035d7c9e-daf2-41c5-85c6-24f5e58d49a3",a._sentryDebugIdIdentifier="sentry-dbid-035d7c9e-daf2-41c5-85c6-24f5e58d49a3")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Vt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Pt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[P,A]=va.useState(!1),[S,Ze]=o.useState(!1),t=ya(),s=$a(),ae=xa(),te=st(),n=Me(),[Ge,Ve]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(Q()),n(X()))}),[n,ne]),o.useEffect((()=>{n(Q()),n(X())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(Te()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Le}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Le,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>Aa(e)));o.useEffect((()=>{const e=()=>{Ve(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const L=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=G("/signout")!==null,M=G("/:tenantEmailDomain/dashboard")!==null,ie=G("/:tenantEmailDomain/reports")!==null,g=G("/:tenantEmailDomain/onboarding/*")!==null,le=Gt();o.useEffect((()=>{w&&D&&!g&&L.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,L.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const Ye=qe||g,U=r((e=>e.tenantState)),We=r((e=>U.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Qe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Za(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Va(e))),ce=r((e=>Pa(e).routines)),la=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]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[T,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Rt(),R=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(T!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:T})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:T})),z(void 0)))}),[n,t.state,s,F,T,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;He(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||R.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,R.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:N},"comments")))}}),[N,R.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Qe===!1&&v.push("accounts_payable_aging"),Xe===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>Na(e,v).fetchState)),ge=r((e=>La(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{A(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&V.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const x=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Wa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:U.currentTenantId??"",tenants:U.fetchState==="Completed"?We:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:L.rewardsPlan},selectedMenu:C===!0?Ae("ai_cfo"):xe(t)&&ue!=="completed"?Ae("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:xe(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Pe(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&V.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Te()),n(Ja()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Ka()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(Q()),n(X()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(V.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const Z=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:Z,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),W=e.type,we=At(W)&&W!=="command_center";if(W!=="command_center"&&!we||h[i.tenantId]==null||V.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const Z=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${Z.month}-${Z.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const Ta=Tt(e.type);vt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ta}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Xa(e)),q===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(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:I,onPeriodChange:Sa,onCalendarOpen:Ze,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Qa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Je,thanksGivingAnimationEnabled:Ke,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ge?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ia=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Vt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:P,onClose:()=>y(!1),PaperProps:{sx:{width:K,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:K,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((A=>Fe(A))),P={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Re({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Pt,{tenantEmailDomain:a,...P})},jt=ee((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-DKqwsBQp.js";import{a as o,R as va}from"./sentry-CxSdF_rC.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-D6EV-11Y.js";import{fF as Fe,TM as Ba,TN as Re,g9 as xa,gv as J,TO as Q,ju as Ie,jB as Te,TP as Aa,TQ as _a,gO as Da,p$ as Ma,TR as Fa,TS as ve,gm as Ra,TT as $,fE as Za,gt as Ga,TU as Pa,TV as Va,TW as ja,TX as ye,TY as Ha,TZ as $e,T_ as Na,E1 as La,gn as Ua,h1 as Oa,cV as za,T$ as qa,U0 as Ya,qC as Wa,g8 as Ja,j6 as Qa,U1 as Xa,U2 as Ka,wq as et,go as at}from"./zeni-epic-state-CZbm731W.js";import{w as tt,i as nt,a as ot,c as st,E as rt,N as it,d as m,e as lt,u as dt,f as ct,g as ut,h as mt,j as Ct,M as pt,R as ht,k as ft,z as gt,l as P,p,m as Be,n as bt,W as St,o as xe,q as kt,r as Ae,s as Et,v as wt,x as K,y as X,A as It,B as Tt,C as vt,L as yt,D as $t,F as Bt,H as ee,I as xt,J as At}from"./index-DvW7BRlL.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-qouWiIWk.js";import{u as Rt}from"./InboxNotificationsProvider-gj6fT2eX.js";import{u as Zt}from"./useTaskManagerAccess-daSMnBbA.js";import{u as Gt}from"./expenseAutomationHelper-DEOPVtcg.js";import"./recharts-C9zWmt1W.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.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]="c89cc397-66c7-4683-b482-aa36b63be776",a._sentryDebugIdIdentifier="sentry-dbid-c89cc397-66c7-4683-b482-aa36b63be776")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Pt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,A]=va.useState(!1),[S,Ze]=o.useState(!1),t=ya(),s=$a(),ae=xa(),te=st(),n=Me(),[Ge,Pe]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(J()),n(Q()))}),[n,ne]),o.useEffect((()=>{n(J()),n(Q())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(Te()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Le}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Le,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>Aa(e)));o.useEffect((()=>{const e=()=>{Pe(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const L=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=G("/signout")!==null,M=G("/:tenantEmailDomain/dashboard")!==null,ie=G("/:tenantEmailDomain/reports")!==null,g=G("/:tenantEmailDomain/onboarding/*")!==null,le=Gt();o.useEffect((()=>{w&&D&&!g&&L.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,L.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const Ye=qe||g,U=r((e=>e.tenantState)),We=r((e=>U.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Je}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Za(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Pa(e))),ce=r((e=>Va(e).routines)),la=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]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[T,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Rt(),R=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(T!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:T})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:T})),z(void 0)))}),[n,t.state,s,F,T,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;He(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||R.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,R.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:N},"comments")))}}),[N,R.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Je===!1&&v.push("accounts_payable_aging"),Qe===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>Na(e,v).fetchState)),ge=r((e=>La(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{A(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const x=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Wa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:U.currentTenantId??"",tenants:U.fetchState==="Completed"?We:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:L.rewardsPlan},selectedMenu:C===!0?Ae("ai_cfo"):xe(t)&&ue!=="completed"?Ae("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:xe(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&P.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Ka()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(J()),n(Q()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const Z=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:Z,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),W=e.type,we=At(W)&&W!=="command_center";if(W!=="command_center"&&!we||h[i.tenantId]==null||P.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const Z=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${Z.month}-${Z.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const Ta=Tt(e.type);vt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ta}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),q===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(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:I,onPeriodChange:Sa,onCalendarOpen:Ze,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ja({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Xe,thanksGivingAnimationEnabled:Ke,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ge?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ia=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Pt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>y(!1),PaperProps:{sx:{width:K,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:K,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((A=>Fe(A))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Re({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
2
2
  height: 20px;
3
3
  width: 20px;
4
4
  color: ${a=>a.theme.colors.primary};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-CW9yScMF.js";import{a as d}from"./sentry-C_uJQK1a.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-BI5oX4mx.js";import{fF as P,YN as w,Yu as R,Hy as E,Hs as Y,Hw as A,Hl as q,Yw as z,Hp as ae,HA as oe,Ho as K,HD as Z,Hz as C}from"./zeni-epic-state-CIizsNeB.js";import{z as O,w as J,bY as pe,o as T,bS as G,bZ as le,c as M,a7 as Q,b_ as se,b$ as ne}from"./index-C2L5Bzwa.js";import"./mui-KP5Ep0NX.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-CJnxkFoz.js";import ie from"./NotFoundScreen-CS6UgwGr.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]="d1309d5c-b3a6-4b7c-9fec-61c9ec35d452",e._sentryDebugIdIdentifier="sentry-dbid-d1309d5c-b3a6-4b7c-9fec-61c9ec35d452")}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(z(!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(Y(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},N="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(N)&&e(z(!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}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();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(Y(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${N}`]:[],eventCallback:(i,I,m)=>{i.endsWith(N)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),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(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const L=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];L==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):L==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(H,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
1
+ import{j as u}from"./liveblocks-DKqwsBQp.js";import{a as d}from"./sentry-CxSdF_rC.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-D6EV-11Y.js";import{fF as P,YN as w,Yu as R,Hy as E,Hs as q,Hw as A,Hl as Y,Yw as z,Hp as ae,HA as oe,Ho as K,HD as Z,Hz as C}from"./zeni-epic-state-CZbm731W.js";import{z as O,w as J,bY as pe,q as T,bS as G,bZ as le,E as M,a7 as Q,b_ as se,b$ as ne}from"./index-DvW7BRlL.js";import"./mui-qouWiIWk.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-DTKS2oJ9.js";import ie from"./NotFoundScreen-sryCVGSu.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]="91265915-69f8-4ecf-bd84-a8b952d22416",e._sentryDebugIdIdentifier="sentry-dbid-91265915-69f8-4ecf-bd84-a8b952d22416")}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(z(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(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 g={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(F,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},N="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(N)&&e(z(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(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}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();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:g.companyId!=null?[`private-encrypted-${g.companyId}.${N}`]:[],eventCallback:(i,I,m)=>{i.endsWith(N)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),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(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const L=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];L==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):L==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(H,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-CW9yScMF.js";import{h as J,u as le,g as Q,i as te,j as k,N as ee,l as X,q as na,n as ia,o as y}from"./core-BI5oX4mx.js";import{fF as Z,Y4 as Ue,bq as kt,S5 as oa,bo as wt,bJ as de,Y5 as Bt,GS as Ct,I3 as Ve,Hp as la,bn as Ae,Y6 as sa,Y7 as ra,c8 as ca,Y8 as da,l$ as xt,Y9 as At,Ya as Et,IE as _e,H5 as Ce,Yb as ua,GG as at,Yc as pa,Mt as ma,GK as ba,GQ as Dt,Yd as Se,Ye as Me,I4 as Ne,Yf as ha,Yg as ga,I7 as Oe,Yh as Sa,Ik as ya,Yi as Tt,HQ as nt,HV as fa,Yj as Ia,Yk as ce,Yl as jt,Ym as Pt,Yn as Ft,gV as va,Ha as $e,cG as Rt,Yo as ka,gh as wa,Yp as Ba,Yq as Ca,d_ as Vt,dZ as $t,Yr as Ye,Ys as xa,Yt as Aa,WF as ze,Yu as Ea,WG as ie,WH as He,Yv as Da,Yw as Ta,Yx as ja,HX as it,HU as Pa,Yy as Fa,Yz as Ra,YA as Va,HG as $a,YB as La,YC as Ga,cu as Lt,da as Gt,ma as Ua,bO as _a,br as Ut,bP as _t,FV as Ma,YD as Na,Mg as Oa,Mm as Ya,C5 as za,I5 as Ha,IL as Za,mn as ge,YE as Wa,YF as Mt,mR as qa,mh as Nt,mC as Ot,mB as ot,bE as pe,bN as Ka,YG as Ja,YH as ye,kN as Qa,YI as lt,YJ as Xa,kR as en,la as tn,IZ as an,YK as nn,mK as on,IP as ln,YL as st,IT as sn,IY as rn,IW as cn,IN as dn,YM as Yt,G$ as un,YN as pn,YO as mn,gG as bn,gF as hn,gE as gn,mq as Sn,mI as rt,mT as yn,uT as fn,mz as In,IR as vn,kX as kn,mY as wn,YP as Bn,kP as Cn,uK as xn,YQ as An,HM as En,bK as Dn,bt as Tn,U4 as jn,dd as Pn,dc as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-CIizsNeB.js";import{c as ue,z as L,U as fe,as as Ze,N as oe,d as g,bi as We,a7 as se,I as A,a8 as Ee,k as j,bu as $n,a4 as H,av as qe,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as Un,aS as _n,ab as zt,G as De,ag as Ke,by as Mn,ae as Ht,bz as Nn,aq as On,S as Zt,w as Yn,bA as zn,bB as Hn,bC as Zn,bD as Wn,bE as qn,bF as Kn,bG as Jn,bH as Qn,bI as Xn,E as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,h as li}from"./index-C2L5Bzwa.js";import{n as U,S as si}from"./mui-KP5Ep0NX.js";import{A as ut}from"./AddressScreen-C2qj6tYr.js";import{g as ne,a as Te,i as Wt,V as Je,b as Qe,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-DdrkO-LG.js";import{a as f}from"./sentry-C_uJQK1a.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-4TGjNsPg.js";import{u as qt}from"./useInitialThreadRequest-BNsRpSRE.js";import{u as ui}from"./BusinessVerificationPageScreen-BAWcvg1q.js";import xe from"./NotFoundScreen-CS6UgwGr.js";import{D as pi}from"./DrawerScreen-KSeYe6Xi.js";import{M as Kt}from"./MobileAppDrawer-DEm85bH8.js";import{F as Jt}from"./FeaturePreviewScreen-R_rh5xYj.js";import{S as je}from"./SetupPagesScreen-BzPNt5Xb.js";import{B as mi}from"./BillPayApprovalRoutes-CtPNwVvl.js";import{F as bi}from"./ScreenRoutes-Lei7nnrR.js";import"./recharts-DRl2ZsSW.js";import"./analytics-5LJ4BXQX.js";import"./plaid-BrgJMdej.js";import"./dnd-D6wtGmk9.js";import"./stripe-cKAAJElX.js";import"./lottie-lQbJqTc2.js";import"./lexical-BLu7UAko.js";import"./pdf-DflcYtDk.js";import"./utils-BzQpFQvw.js";import"./routePaths-BrIEdo8u.js";import"./InboxNotificationsProvider-CMirleoY.js";import"./useTaskManagerAccess-Bhr2JI_X.js";import"./analyticsHelper-k_Sp-PwA.js";import"./ReimbursementApprovalRuleDetailScreen-CJnxkFoz.js";import"./getLocaleForTenant-Cv6I-eSM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0071b7da-e9d8-408d-8671-4ad399efec5b",e._sentryDebugIdIdentifier="sentry-dbid-0071b7da-e9d8-408d-8671-4ad399efec5b")}catch{}})();const hi=X((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=Q(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,C]=f.useState(!1),[x,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:N}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=B(We.zeniAssistConfig),v=oa(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:K}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",N,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t(Ve(!1,N,$,K,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,N,$,K]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new zt(100,58)},mt=X((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));ui();const[x,_]=f.useState(!1),[D,B]=f.useState(!1),[N,V]=f.useState(!1),[W,O]=f.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const K=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&_(!1))}),[n]),f.useEffect((()=>{x||n==null||u||(_(!0),t(Ct(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[x,D,u,n,t,S,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(K??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(K??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(C.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:O,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:K}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,N?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Ci,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:O,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-DKqwsBQp.js";import{h as J,u as le,g as Q,i as te,j as k,N as ee,l as X,q as na,n as ia,o as y}from"./core-D6EV-11Y.js";import{fF as Z,Y4 as Ue,bq as kt,S5 as oa,bo as wt,bJ as de,Y5 as Bt,GS as Ct,I3 as Ve,Hp as la,bn as Ae,Y6 as sa,Y7 as ra,c8 as ca,Y8 as da,l$ as xt,Y9 as At,Ya as Et,IE as _e,H5 as Ce,Yb as ua,GG as at,Yc as pa,Mt as ma,GK as ba,GQ as Dt,Yd as Se,Ye as Me,I4 as Ne,Yf as ha,Yg as ga,I7 as Oe,Yh as Sa,Ik as ya,Yi as Tt,HQ as nt,HV as fa,Yj as Ia,Yk as ce,Yl as jt,Ym as Pt,Yn as Ft,gV as va,Ha as $e,cG as Rt,Yo as ka,gh as wa,Yp as Ba,Yq as Ca,d_ as Vt,dZ as $t,Yr as Ye,Ys as xa,Yt as Aa,WF as ze,Yu as Ea,WG as ie,WH as He,Yv as Da,Yw as Ta,Yx as ja,HX as it,HU as Pa,Yy as Fa,Yz as Ra,YA as Va,HG as $a,YB as La,YC as Ga,cu as Lt,da as Gt,ma as Ua,bO as _a,br as Ut,bP as _t,FV as Ma,YD as Na,Mg as Oa,Mm as Ya,C5 as za,I5 as Ha,IL as Za,mn as ge,YE as Wa,YF as Mt,mR as qa,mh as Nt,mC as Ot,mB as ot,bE as pe,bN as Ka,YG as Ja,YH as ye,kN as Qa,YI as lt,YJ as Xa,kR as en,la as tn,IZ as an,YK as nn,mK as on,IP as ln,YL as st,IT as sn,IY as rn,IW as cn,IN as dn,YM as Yt,G$ as un,YN as pn,YO as mn,gG as bn,gF as hn,gE as gn,mq as Sn,mI as rt,mT as yn,uT as fn,mz as In,IR as vn,kX as kn,mY as wn,YP as Bn,kP as Cn,uK as xn,YQ as An,HM as En,bK as Dn,bt as Tn,U4 as jn,dd as Pn,dc as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-CZbm731W.js";import{E as ue,z as L,U as fe,as as Ze,N as oe,d as g,bi as We,a7 as se,I as A,a8 as Ee,l as j,bu as $n,a4 as H,av as qe,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as Un,aS as _n,ab as zt,G as De,ag as Ke,by as Mn,ae as Ht,bz as Nn,aq as On,T as Zt,w as Yn,bA as zn,bB as Hn,bC as Zn,bD as Wn,bE as qn,bF as Kn,bG as Jn,bH as Qn,bI as Xn,c as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,j as li}from"./index-DvW7BRlL.js";import{n as U,S as si}from"./mui-qouWiIWk.js";import{A as ut}from"./AddressScreen-5ZLJ7_Lf.js";import{g as ne,a as Te,i as Wt,V as Je,b as Qe,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-Dj3JCDGh.js";import{a as f}from"./sentry-CxSdF_rC.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DV4bjx-y.js";import{u as qt}from"./useInitialThreadRequest-BwX5Js6P.js";import{u as ui}from"./BusinessVerificationPageScreen-BL6H7JF-.js";import xe from"./NotFoundScreen-sryCVGSu.js";import{D as pi}from"./DrawerScreen-CxKP-6Rf.js";import{M as Kt}from"./MobileAppDrawer-DExJFFmi.js";import{F as Jt}from"./FeaturePreviewScreen-LeLfD5pA.js";import{S as je}from"./SetupPagesScreen-D0fdMGb4.js";import{B as mi}from"./BillPayApprovalRoutes-DwyJret-.js";import{F as bi}from"./ScreenRoutes-BHHy1uXx.js";import"./recharts-C9zWmt1W.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.js";import"./routePaths-GYFjoelZ.js";import"./InboxNotificationsProvider-gj6fT2eX.js";import"./useTaskManagerAccess-daSMnBbA.js";import"./analyticsHelper-DcvdGte-.js";import"./ReimbursementApprovalRuleDetailScreen-DTKS2oJ9.js";import"./getLocaleForTenant-C3wVeXiS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d2bdc01f-eca1-4b47-8046-bc84fb12c819",e._sentryDebugIdIdentifier="sentry-dbid-d2bdc01f-eca1-4b47-8046-bc84fb12c819")}catch{}})();const hi=X((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=Q(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,C]=f.useState(!1),[x,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:N}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=B(We.zeniAssistConfig),v=oa(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:K}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",N,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t(Ve(!1,N,$,K,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,N,$,K]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new zt(100,58)},mt=X((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));ui();const[x,_]=f.useState(!1),[D,B]=f.useState(!1),[N,V]=f.useState(!1),[W,O]=f.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const K=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&_(!1))}),[n]),f.useEffect((()=>{x||n==null||u||(_(!0),t(Ct(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[x,D,u,n,t,S,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(K??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(K??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(C.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:O,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:K}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,N?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Ci,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:O,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{a as V}from"./sentry-C_uJQK1a.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-BI5oX4mx.js";import{fF as z,Hs as ce,YY as ue,Bw as de,S8 as pe,HG as le,KR as me,NE as fe,Oi as ye,P7 as Se,YZ as ge,Y_ as Ie,Y$ as be,Z0 as he,Z1 as Te,Vc as De,Y2 as Oe,Vr as Ce,LV as ke,Vs as Ve,LZ as we,mH as Ae,gG as Ne,gF as Fe,gE as _e,uT as ve,uK as Ee,uH as xe,mz as Be,BF as ze,BD as R,bE as P,BR as U,cE as Re}from"./zeni-epic-state-CIizsNeB.js";import{bS as Pe,U as Ue,N as Le,bi as Me,z as B,a8 as je,k as L,o as E,S as x,bU as Ge,ae as Ye,p as M,aG as j}from"./index-C2L5Bzwa.js";import{n as Ze}from"./mui-KP5Ep0NX.js";import{j as k}from"./liveblocks-CW9yScMF.js";import{d as G}from"./routePaths-BrIEdo8u.js";import{M as He}from"./MobileAppDrawer-DEm85bH8.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="2f0d2271-edf3-4901-9bb9-dec7e22ca68a",t._sentryDebugIdIdentifier="sentry-dbid-2f0d2271-edf3-4901-9bb9-dec7e22ca68a")}catch{}})();function nt(){const t=Y(),u=h((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const $e=Ze.div`
1
+ import{a as k}from"./sentry-CxSdF_rC.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-D6EV-11Y.js";import{fF as z,Hs as ce,YY as ue,Bw as de,S8 as pe,HG as le,KR as me,NE as fe,Oi as ye,P7 as Se,YZ as ge,Y_ as Ie,Y$ as be,Z0 as he,Z1 as Te,Vc as De,Y2 as Oe,Vr as Ce,LV as Ve,Vs as ke,LZ as we,mH as Ae,gG as Ne,gF as Fe,gE as _e,uT as ve,uK as Ee,uH as xe,mz as Be,BF as ze,BD as R,bE as P,BR as U,cE as Re}from"./zeni-epic-state-CZbm731W.js";import{bS as Pe,U as Ue,N as Le,bi as Me,z as B,a8 as je,l as L,q as E,T as x,bU as Ge,ae as Ye,p as M,aG as j}from"./index-DvW7BRlL.js";import{n as Ze}from"./mui-qouWiIWk.js";import{j as V}from"./liveblocks-DKqwsBQp.js";import{d as G}from"./routePaths-GYFjoelZ.js";import{M as He}from"./MobileAppDrawer-DExJFFmi.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="e05acd07-cc6e-4975-b482-b8d66f68d42e",t._sentryDebugIdIdentifier="sentry-dbid-e05acd07-cc6e-4975-b482-b8d66f68d42e")}catch{}})();function nt(){const t=Y(),u=h((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));k.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const qe=Ze.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{a as V}from"./sentry-C_uJQK1a.js";import{u as Y,j as h,h as ne,g as se,i
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${t=>t.theme.colors.grey4};
9
- `,qe=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=B.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ye.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:b,companySourceOfFunds:Z,companySourceOfFundsDescription:H,transactionVolume:$,transactionVolumeDescription:q,purposeOfAccount:K,purposeOfAccountDescription:W,regulatedStatus:J,regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee}=e,_=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Re(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?P(f?.toString()):f,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:b?.selectedOptions.map((v=>v.length===2?v:j(v)))??[],companySourceOfFunds:Z?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:W,regulatedStatus:J??"",regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(U({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=m;let b;return S.selectDocumentType==="driverLicense"?b="driving_license":S.selectDocumentType==="passport"?b="passport":S.selectDocumentType==="stateId"?b="id_document":S.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?j(I.selectedOption):void 0,phone:l,birthday:o!=null?P(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:b,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(U({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=G(T,e),m=M(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=G(T,e),m=M(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(Be({files:e}))},onDeleteFile:e=>{t(xe(e))},onDeleteFileList:e=>{t(Ee(e))},onEditFileName:(e,s)=>{t(ve(e,s.split(".")[0]))},onGetOtp:e=>{t(_e(e,"SpendManagementSetup"))},onResendOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ne(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ae({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Ve(e.documentType);s!=null&&t(we({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(ke({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ge),st=({productType:t})=>{const u=ne(),n=se(),i=Y(),[d,p]=V.useState(!1),[r,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=Ue(),{useDynamicConfig:m}=Le(),{configValue:O}=m(Me.zeniAccountsConfig),C=ue(O),g=h((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),y=h((a=>a.companyConfigState.fetchState)),I=h((a=>a.userRoleConfigState.fetchState)),c=h((a=>z(a))),o=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),V.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),B.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{T(a)},S=h((a=>{switch(t){case"zeni_accounts":return Te(a,o);case"zeni_treasury":return he(a,o);case"charge_cards":return be(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?k.jsx(ie,{to:"../promo"}):k.jsxs($e,{children:[k.jsx(je,{analytics:L,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?k.jsx(He,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,k.jsx(qe,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:L,currentTenant:c,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};
9
+ `,$e=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=B.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ye.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:b,companySourceOfFunds:Z,companySourceOfFundsDescription:H,transactionVolume:q,transactionVolumeDescription:$,purposeOfAccount:K,purposeOfAccountDescription:W,regulatedStatus:J,regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee}=e,_=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Re(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?P(f?.toString()):f,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:b?.selectedOptions.map((v=>v.length===2?v:j(v)))??[],companySourceOfFunds:Z?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:q?.selectedOption??"",transactionVolumeDescription:$,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:W,regulatedStatus:J??"",regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(U({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=m;let b;return S.selectDocumentType==="driverLicense"?b="driving_license":S.selectDocumentType==="passport"?b="passport":S.selectDocumentType==="stateId"?b="id_document":S.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?j(I.selectedOption):void 0,phone:l,birthday:o!=null?P(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:b,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(U({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=G(T,e),m=M(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=G(T,e),m=M(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(Be({files:e}))},onDeleteFile:e=>{t(xe(e))},onDeleteFileList:e=>{t(Ee(e))},onEditFileName:(e,s)=>{t(ve(e,s.split(".")[0]))},onGetOtp:e=>{t(_e(e,"SpendManagementSetup"))},onResendOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ne(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ae({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=ke(e.documentType);s!=null&&t(we({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(Ve({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ge),st=({productType:t})=>{const u=ne(),n=se(),i=Y(),[d,p]=k.useState(!1),[r,T]=k.useState(!1),{tenantEmailDomain:e}=oe(),s=Ue(),{useDynamicConfig:m}=Le(),{configValue:O}=m(Me.zeniAccountsConfig),C=ue(O),g=h((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),y=h((a=>a.companyConfigState.fetchState)),I=h((a=>a.userRoleConfigState.fetchState)),c=h((a=>z(a))),o=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(k.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),k.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),B.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{T(a)},S=h((a=>{switch(t){case"zeni_accounts":return Te(a,o);case"zeni_treasury":return he(a,o);case"charge_cards":return be(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?V.jsx(ie,{to:"../promo"}):V.jsxs(qe,{children:[V.jsx(je,{analytics:L,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?V.jsx(He,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,V.jsx($e,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:L,currentTenant:c,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};
@@ -0,0 +1,14 @@
1
+ import{j as g}from"./liveblocks-DKqwsBQp.js";import{a as l}from"./sentry-CxSdF_rC.js";import{u as pe,h as he,g as Ce,j as M,i as fe,l as Se}from"./core-D6EV-11Y.js";import{a as ge,e8 as be,z as ye,ea as Pe,ec as N,ed as Ie,bn as W,a8 as we,l as $,ee as H,eo as Ee,G as Te,T as ke,w as Ae,eh as xe,ei as Ue,av as _e,el as Oe,em as ve,bk as Qe,en as Fe}from"./index-DvW7BRlL.js";import{gK as $e,fE as G,fF as De,g8 as je,jh as Le,jd as Ve,fG as z,gu as qe,go as Re,gq as B,gw as Me,gx as He,gy as ze,gz as Be,gA as Ne}from"./zeni-epic-state-CZbm731W.js";import{D as We,n as j,P as Ge,S as Ke}from"./mui-qouWiIWk.js";import"./recharts-C9zWmt1W.js";import"./analytics-wktvfErl.js";import"./plaid-deRHM6gT.js";import"./dnd-CkchuQYc.js";import"./stripe-cKAAJElX.js";import"./lottie-BwhdO6jl.js";import"./lexical-C6tQwGBF.js";import"./pdf-DcGn_mX8.js";import"./utils-D8aAQJhF.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="1eac18e2-c58b-444b-b359-82f3298f1841",e._sentryDebugIdIdentifier="sentry-dbid-1eac18e2-c58b-444b-b359-82f3298f1841")}catch{}})();const K="chat-response-generated",Y="cards/ask",J="card_policy_hero";function D(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),d=a.isSubmitting,c=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:d,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Oe(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...c}}),(function(e,a){const{location:o,currentTenant:d,userId:c,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=d.tenantEmailDomain,C=o.state?.referrer,p=C===J?X(i):D(i);return{onEventReceived:(n,t)=>{if(n===K&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,ze(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:c}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,c,f,s,U)},updateCurrentInput:n=>{e(B(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Me(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(B(""))},togglePageView:()=>{m(p,{state:N(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${Y}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(qe({questionAnswerId:n,isCollapsed:t}))},...ve(e,{isAiCardCreationEnabled:A,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Ae(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=Te.getLocalizedStrings(),k=Z.pageTitle,Je=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,gt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),d=he(),c=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o($e())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>De(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=c.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Je:k,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),d(c.pathname,{replace:!0,state:N(c.state)})}),[c.pathname,c.state,d]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,T=l.useRef(null);l.useEffect((()=>{if(S&&T.current!=null){const{question:r,shouldSubmit:w}=T.current;T.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&d((function(r,w){return`/${r}/${Y}/${w}`})(s,t),{state:{...c.state},replace:!0})}),[t,p,s,d,c.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(je({sessionId:p,agentId:"controller"}))}),[]);const ce=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${K}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const de=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(tt,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(ke.Event.aiCFOPage)}),S?g.jsx(Ye,{...ce,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:d,sessionFromUrl:de,location:c,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:k,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{d(I?X(s):D(s),{state:{...c.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(T.current={question:u,shouldSubmit:P}),o(z(n.userRoleId)))}}),g.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(et,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(z(n.userRoleId)),h(!1)}})})})]})},et=j(Ke)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,tt=j.div`
6
+ flex: 1 1 auto;
7
+ display: flex;
8
+ flex-direction: column;
9
+ min-height: 0;
10
+ width: 100%;
11
+ `,st=j(Ge)`
12
+ box-shadow: ${({theme:e})=>e.colors.elevation2};
13
+ color: ${({theme:e})=>e.colors.grey4};
14
+ `;export{gt as default};