@zeniai/web-app-ui 5.3.64-dev → 5.3.64-dev-beta0KB

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 (155) hide show
  1. package/dist/assets/{AccountMappingScreen-xfXO279W.js → AccountMappingScreen-C_GVFaoh.js} +2 -2
  2. package/dist/assets/ActualMatchingMatchDetailScreen-Br9CFUye.js +1 -0
  3. package/dist/assets/AddressRoutes-Bw_nh--O.js +1 -0
  4. package/dist/assets/AddressScreen-CvhZrOl1.js +9 -0
  5. package/dist/assets/AiCfoScreen-enlKpZc4.js +22 -0
  6. package/dist/assets/{AppDrawer-B2rHD8Zo.js → AppDrawer-BvDyxQG-.js} +1 -1
  7. package/dist/assets/BillPayApprovalRoutes-D18TxHMc.js +1 -0
  8. package/dist/assets/{BillPayRoutes-Dmusj5HX.js → BillPayRoutes-CloKoO0m.js} +6 -6
  9. package/dist/assets/{BusinessVerificationPageScreen-C-aPhqey.js → BusinessVerificationPageScreen-wzhfqwbN.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-CsPjsbB8.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-JBiL4Thy.js → ChargeCardRoutes-CeG2_2Iv.js} +9 -9
  12. package/dist/assets/CompanyPassportScreen-CTdU0eT4.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-tQkR0Qdq.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-Cfna6QXU.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-C2sAsjXY.js → CustomerOnboardingRoutes-C2PIK8CC.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-B3_TJQND.js → DashboardRoutes-B6PQcDII.js} +4 -4
  17. package/dist/assets/DefaultTenantHome-R8lvjrth.js +1 -0
  18. package/dist/assets/{DomesticWireDetailScreen-DQXD1NSK.js → DomesticWireDetailScreen-BOXpXEFg.js} +3 -3
  19. package/dist/assets/{DrawerScreen-DyQejCID.js → DrawerScreen-kd-vUIOU.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-CKVztcFF.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-CZBhc5OO.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-DlYWStt_.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-BiVfvVOh.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-CYNlrTK-.js → InboxNotificationsProvider-jZPrqdDf.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-DBwLj6Ir.js → InvoicingRoutes-CTeBd6HD.js} +2 -2
  26. package/dist/assets/{MagicLinkRoutes-D5UwoWcf.js → MagicLinkRoutes-DBawNNk_.js} +21 -21
  27. package/dist/assets/MagicLinkSignInScreen-CKyZ86AC.js +12 -0
  28. package/dist/assets/MobileAppDrawer-thURFqdR.js +1 -0
  29. package/dist/assets/NotFoundScreen-CjcmfT5h.js +1 -0
  30. package/dist/assets/{NotificationRoutes-D7MHUmyT.js → NotificationRoutes-B5kGRr3c.js} +1 -1
  31. package/dist/assets/OAuthConsentScreen-DKPtywIw.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-DuKFzXpp.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-Bh4jK9uE.js → PaymentLinkScreen-DgjfMeF_.js} +4 -4
  34. package/dist/assets/PeopleRoutes-BFFXxsrW.js +22 -0
  35. package/dist/assets/PerformanceRoutes-DlDpAJN4.js +1 -0
  36. package/dist/assets/{Preview-Cqz8sG2s.js → Preview-CFep9b6s.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-DreC-yDW.js → QBOConnectionScreen-zn7s2M2b.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-h6pN24Dd.js +1 -0
  39. package/dist/assets/ReimbursementApprovalRuleDetailScreen-La5bMk76.js +1 -0
  40. package/dist/assets/ReimbursementRoutes-DpjqJ1j9.js +68 -0
  41. package/dist/assets/{ReportsRoutes-BZjyXdiB.js → ReportsRoutes-Tu97hQPr.js} +1 -1
  42. package/dist/assets/RewardsRoutes-C7-L_VuA.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-PbMzJVD9.js → ScheduleDetailsPrepaidExpensesScreen-BNVCc0tE.js} +5 -5
  44. package/dist/assets/ScreenRoutes-DUiJb0LC.js +2 -0
  45. package/dist/assets/{SettingsRoutes-hveOvbi9.js → SettingsRoutes-BVrPYY3-.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-B8kiMdZf.js → SetupPagesScreen-Cx3OOUGr.js} +5 -5
  47. package/dist/assets/SignInScreen-BXBlASFY.js +1 -0
  48. package/dist/assets/SignOutScreen-BN1O2qGb.js +9 -0
  49. package/dist/assets/{TaskListScreen-Bi73r_uo.js → TaskListScreen-DrflApgr.js} +2 -2
  50. package/dist/assets/{TaskRoutes-DCW1uZnF.js → TaskRoutes-BxW92Ol2.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-CUdtnWL8.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-DVFrl6h2.js → TransactionDetailScreen-C2qhnA5b.js} +2 -2
  53. package/dist/assets/TransactionListRoutes-Bt_C_073.js +1 -0
  54. package/dist/assets/{TreasuryRoutes-BPVOZ6Bj.js → TreasuryRoutes-DJK_7z5t.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-CHDVO5Sr.js → VendorsRoutes-dr-KQ_Nk.js} +13 -13
  56. package/dist/assets/WiseConfirmationScreen-BjSMumPA.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-BzLWpyYJ.js → ZeniAccountRoutes-mpb2ppPH.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-C6P6WNnP.js +9 -0
  59. package/dist/assets/{accountMappingHelper-Gh8rpbjD.js → accountMappingHelper-D5I8xPpR.js} +1 -1
  60. package/dist/assets/{analytics-S5MhEivL.js → analytics-CVpLIXYS.js} +1 -1
  61. package/dist/assets/{analyticsHelper-Ch9SsWjb.js → analyticsHelper-DIAaX2E9.js} +1 -1
  62. package/dist/assets/{core-Cc7wW2EM.js → core-BmXpopk3.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-DhqIXi_U.js → decodeURIComponentSafe-CmNiiSLm.js} +1 -1
  64. package/dist/assets/{dnd-DEyyKSEC.js → dnd-CFbFq_On.js} +1 -1
  65. package/dist/assets/{empty-6MFM8UPN.js → empty-0E71-pkh.js} +1 -1
  66. package/dist/assets/{empty-CjY9w6q2.js → empty-IUpx8pFE.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-MGXFhhLz.js → emptyVideoElement-DvAsJwe7.js} +1 -1
  68. package/dist/assets/epic-Dp0UOOW0.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-wsi-w_Qs.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-Bgt5rFzV.js → getLocaleForTenant-CLcFXXBi.js} +1 -1
  71. package/dist/assets/{index-vIt7RQvO.js → index-BH7Z90Ry.js} +16405 -15862
  72. package/dist/assets/{index-BZ6qOKkD.js → index-BwG9RDJd.js} +1 -1
  73. package/dist/assets/{index-Cm43WhAF.js → index-DaYn0dIv.js} +2 -2
  74. package/dist/assets/{index-D2oCZR3F.js → index-Diiw4rJ6.js} +1 -1
  75. package/dist/assets/{index-2QCkbhu2.js → index-_EB0AYfG.js} +1 -1
  76. package/dist/assets/{index-DpnxiqBj.js → index-n9iskFtR.js} +1 -1
  77. package/dist/assets/{index-gtGWrJ79.js → index-nMXCGK26.js} +1 -1
  78. package/dist/assets/{index-ldlm2cjp.js → index-xAn5v5dB.js} +1 -1
  79. package/dist/assets/{lexical-DXgKWO29.js → lexical-CUqOWG_f.js} +1 -1
  80. package/dist/assets/{liveblocks-CgHUgeBY.js → liveblocks-2F3ER8H4.js} +1 -1
  81. package/dist/assets/{lottie-C1A2hiZE.js → lottie-Do5BYuHO.js} +1 -1
  82. package/dist/assets/{mui-C4zFSCiU.js → mui-DpZKsKJ-.js} +1 -1
  83. package/dist/assets/{pathToGoBack-C17GqrA7.js → pathToGoBack-IYhrTF3T.js} +1 -1
  84. package/dist/assets/{pdf-rXyPRm1U.js → pdf-CaVqV5T4.js} +3 -3
  85. package/dist/assets/{pdf-lib-CsM74zBq.js → pdf-lib-DgpGz3__.js} +1 -1
  86. package/dist/assets/{plaid-vsHcqLdj.js → plaid-B0sfsJHV.js} +1 -1
  87. package/dist/assets/{pusher-C0EhdUPA.js → pusher-BZ4RRfso.js} +1 -1
  88. package/dist/assets/{react-BU_8yW5D.js → react-B40uyjvd.js} +1 -1
  89. package/dist/assets/{react-Yy9ZuxR6.js → react-BlQV6oEC.js} +1 -1
  90. package/dist/assets/{react-CzfY0Vx3.js → react-CM6JlJfX.js} +1 -1
  91. package/dist/assets/{react-CEepHjWP.js → react-CVdpmzlC.js} +1 -1
  92. package/dist/assets/{react-DG8YneWb.js → react-Cx2vmGsH.js} +1 -1
  93. package/dist/assets/{react-Gc0eJCMR.js → react-cC2pOmRW.js} +1 -1
  94. package/dist/assets/{recharts-DJGeJ2v_.js → recharts-lgPPofcu.js} +1 -1
  95. package/dist/assets/routePaths-DuFLBwyX.js +1 -0
  96. package/dist/assets/{sentry-DSWD_gIh.js → sentry-Dwi3Xpu2.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-kLnY55Qt.js → stripSplatSuffix-Cm_Bj9mb.js} +1 -1
  98. package/dist/assets/{url-DCbpXgdk.js → url-B3IdPeRD.js} +1 -1
  99. package/dist/assets/{url-DUlo21cY.js → url-CuCw2GYz.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CTL9QRWv.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B1hI9_5p.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-B82QOIYm.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-BVr00Fos.js → useChargeCardPusherEvents-CNgbxhoK.js} +1 -1
  104. package/dist/assets/{useDeviceId-B5zol9VP.js → useDeviceId-Dklpg4lb.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-BfOhSDOo.js +1 -0
  106. package/dist/assets/useEnsureVendorListLoaded-BtOYIHPo.js +1 -0
  107. package/dist/assets/{useInitialThreadRequest-D4Y8xhXu.js → useInitialThreadRequest-DagpMHc1.js} +1 -1
  108. package/dist/assets/useTaskManagerAccess-DvrYqbN3.js +1 -0
  109. package/dist/assets/{useTaskManagerPusherEvents-X_H33C0C.js → useTaskManagerPusherEvents-Be2DL4pK.js} +1 -1
  110. package/dist/assets/{utils-DiIEQ7_h.js → utils-DAgs23EZ.js} +1 -1
  111. package/dist/assets/withTransactionSidePanel-Dn8x-lme.js +25 -0
  112. package/dist/assets/{zeni-epic-state-BVJjEVAA.js → zeni-epic-state-DtY6MD5C.js} +6 -6
  113. package/dist/index.html +1 -1
  114. package/package.json +4 -4
  115. package/dist/assets/ActualMatchingMatchDetailScreen-ByqHVLf7.js +0 -1
  116. package/dist/assets/AddressRoutes-BWVJyPk8.js +0 -1
  117. package/dist/assets/AddressScreen-CrPViFiu.js +0 -9
  118. package/dist/assets/AiCfoScreen-DXsXYKZU.js +0 -22
  119. package/dist/assets/BillPayApprovalRoutes-CMAUuUUB.js +0 -1
  120. package/dist/assets/CardsAiCfoScreen-CTX5PjYy.js +0 -14
  121. package/dist/assets/CompanyPassportScreen-Df3GjmsH.js +0 -1
  122. package/dist/assets/ConnectionAuthScreen-CRXLzdg9.js +0 -11
  123. package/dist/assets/CustomerOnboardingAuthScreen-DSYY256B.js +0 -1
  124. package/dist/assets/DefaultTenantHome-4mMU5w7G.js +0 -1
  125. package/dist/assets/EntityDetailRoutes-0npRYuOC.js +0 -1
  126. package/dist/assets/ExpenseAutomationRoutes-SlF4KM3u.js +0 -38
  127. package/dist/assets/FeaturePreviewScreen-OtBPdCPK.js +0 -1
  128. package/dist/assets/HubSpotOAuthCallbackScreen-CtTG0u9D.js +0 -1
  129. package/dist/assets/MagicLinkSignInScreen-B_572HKC.js +0 -12
  130. package/dist/assets/MobileAppDrawer-DLFLa7hS.js +0 -1
  131. package/dist/assets/NotFoundScreen-DzxbROot.js +0 -1
  132. package/dist/assets/OAuthConsentScreen-iNKlAsfd.js +0 -1
  133. package/dist/assets/PandLWithForecastRoutes-COCZ3G6X.js +0 -1
  134. package/dist/assets/PeopleRoutes-BkRUXc0D.js +0 -22
  135. package/dist/assets/PerformanceRoutes-BzDFWREu.js +0 -1
  136. package/dist/assets/ReimbursementApprovalRoutes-DPScUcq4.js +0 -1
  137. package/dist/assets/ReimbursementApprovalRuleDetailScreen-BxglZgWl.js +0 -1
  138. package/dist/assets/ReimbursementRoutes-DveTyQyE.js +0 -68
  139. package/dist/assets/RewardsRoutes-zL93sOaR.js +0 -1
  140. package/dist/assets/ScreenRoutes-Bl2EONFe.js +0 -2
  141. package/dist/assets/SignInScreen-CGBu1NjI.js +0 -1
  142. package/dist/assets/SignOutScreen-D0F6FeVm.js +0 -9
  143. package/dist/assets/TransactionDetailRoutes-CWMSCIXL.js +0 -1
  144. package/dist/assets/TransactionListRoutes-B3tJhd_n.js +0 -1
  145. package/dist/assets/WiseConfirmationScreen-Du3rEKnE.js +0 -12
  146. package/dist/assets/ZeniAccountStatementScreen-DaV7I7ku.js +0 -9
  147. package/dist/assets/epic-D9Y6xcsI.js +0 -2
  148. package/dist/assets/expenseAutomationHelper-iXuIUZiF.js +0 -1
  149. package/dist/assets/routePaths-C0UIXwMQ.js +0 -1
  150. package/dist/assets/useActualMatchingMatchDetail-CwcmHDQ8.js +0 -1
  151. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BFr557mr.js +0 -1
  152. package/dist/assets/useAskAiCfoHostNavButtonProps-7-6nPEHY.js +0 -1
  153. package/dist/assets/useEmailConnectResultRefresh-HcMCYvt9.js +0 -1
  154. package/dist/assets/useTaskManagerAccess-BeNfkHpZ.js +0 -1
  155. package/dist/assets/withTransactionSidePanel-DkQdwLfY.js +0 -25
@@ -1,4 +1,4 @@
1
- import{j as D}from"./liveblocks-CgHUgeBY.js";import{a as o}from"./sentry-DSWD_gIh.js";import{h as H,g as W,u as X,j as m,s as q,l as Y}from"./core-Cc7wW2EM.js";import{aj as Z,N as ee,f as $,z as te,q as G,ak as ne,j as ae,U as ce}from"./index-vIt7RQvO.js";import{bn as se,fF as oe,gV as ie,oB as Q,UK as re,i8 as J,gh as le,os as ue,UL as de,UM as pe,ua as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as Ie,UN as ye,UO as Se}from"./zeni-epic-state-BVJjEVAA.js";import{n as he}from"./mui-C4zFSCiU.js";import{M as Ee}from"./MobileAppDrawer-DLFLa7hS.js";import{q as R}from"./QBOConnectionScreen-DreC-yDW.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-Gh8rpbjD.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]="b6c9b4fc-f52a-4004-91d5-c333afa9e0e4",a._sentryDebugIdIdentifier="sentry-dbid-b6c9b4fc-f52a-4004-91d5-c333afa9e0e4")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
1
+ import{j as D}from"./liveblocks-2F3ER8H4.js";import{a as o}from"./sentry-Dwi3Xpu2.js";import{h as X,g as Y,u as H,j as m,s as $,l as K}from"./core-BmXpopk3.js";import{aj as Z,d as ee,$ as q,z as te,s as G,ak as ne,m as ae,U as ce}from"./index-BH7Z90Ry.js";import{bn as se,fF as oe,gV as ie,oB as Q,UU as re,i8 as J,gh as le,os as ue,UV as de,UW as pe,ua as ge,l$ as me,oq as be,om as Ae,ox as fe,ia as Ie,UX as ye,UY as Se}from"./zeni-epic-state-DtY6MD5C.js";import{n as he}from"./mui-DpZKsKJ-.js";import{M as Ee}from"./MobileAppDrawer-thURFqdR.js";import{q as R}from"./QBOConnectionScreen-zn7s2M2b.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-D5I8xPpR.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]="0bbf14aa-4bb9-4fe3-8eba-d07ea95d13e4",a._sentryDebugIdIdentifier="sentry-dbid-0bbf14aa-4bb9-4fe3-8eba-d07ea95d13e4")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as D}from"./liveblocks-CgHUgeBY.js";import{a as o}from"./sentry-DSWD_gI
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${a=>a.theme.colors.grey4};
9
- `,we=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:v,vendorsAccountSection:w,filing1099Section:x}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=v,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=w,{bankAccount:M,expenseCategory1099:j}=x,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),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:k?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(Ie()),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=H(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.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,K]=g[0]??[];S!=null&&c(Q(s.companyId,S,K,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),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 I=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((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),y=t=>{U(t)};return D.jsxs(ve,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),D.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:G(i),onClickMenuIcon:()=>y(!0)})]})};export{l as P,_e as U,u as a};
9
+ `,we=K((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:b}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:v,vendorsAccountSection:w,filing1099Section:x}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=v,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=w,{bankAccount:M,expenseCategory1099:j}=x,A=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),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:A?.accountId,selectedExpenseAccountId:k?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(Ie()),b&&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?be(e.currentTenant.companyId):Ae(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=X(),i=Y(),c=H(),{useFeatureGate:b,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=b(q.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=b(q.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.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??"$"}}),$),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,W]=g[0]??[];S!=null&&c(Q(s.companyId,S,W,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),A=m((t=>re(t.accountState)),$),k=o.useMemo((()=>{const t={};for(const n of A)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[A]),[f,_]=o.useState(!1),[P,U]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const I=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((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),y=t=>{U(t)};return D.jsxs(ve,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),D.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:G(i),onClickMenuIcon:()=>y(!0)})]})};export{l as P,_e as U,u as a};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-2F3ER8H4.js";import{a as k}from"./sentry-Dwi3Xpu2.js";import{a5 as I,dR as g}from"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import{u as y}from"./useActualMatchingMatchDetail-CTL9QRWv.js";import R from"./NotFoundScreen-CjcmfT5h.js";import{i as v,h as U,g as w}from"./core-BmXpopk3.js";import"./zeni-epic-state-DtY6MD5C.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.js";import"./stripSplatSuffix-Cm_Bj9mb.js";import"./decodeURIComponentSafe-CmNiiSLm.js";import"./routePaths-DuFLBwyX.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]="05f60fea-a345-4147-87e2-7452b4125bfe",t._sentryDebugIdIdentifier="sentry-dbid-05f60fea-a345-4147-87e2-7452b4125bfe")}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:f,handleUndoReversal:h,handleContinueMatch:c,lastMatchResults:d,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:()=>{c(),a()},onRefresh:f,onUndoReversal:h,lastMatchResults:d,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:()=>{c(),a()},onRefresh:f,onUndoReversal:h,lastMatchResults:d,lastUndoResults:m})}export{K as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-2F3ER8H4.js";import{A as i}from"./AddressScreen-CvhZrOl1.js";import s from"./NotFoundScreen-CjcmfT5h.js";import"./sentry-Dwi3Xpu2.js";import{n as d,o as r}from"./core-BmXpopk3.js";import"./zeni-epic-state-DtY6MD5C.js";import"./recharts-lgPPofcu.js";import"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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-2F3ER8H4.js";import{a as h}from"./sentry-Dwi3Xpu2.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-BmXpopk3.js";import{a2 as $,E as D,z as L,O as V,a8 as K,a9 as U,m as C,U as S,a4 as z,X as b,a5 as F}from"./index-BH7Z90Ry.js";import{Vz as _,ip as O,fF as R,VA as G,c8 as H,VB as N,mH as q}from"./zeni-epic-state-DtY6MD5C.js";import{n as X}from"./mui-DpZKsKJ-.js";import J from"./NotFoundScreen-CjcmfT5h.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]="39a40a19-5575-49d3-886a-3a835bd7b5c5",e._sentryDebugIdIdentifier="sentry-dbid-39a40a19-5575-49d3-886a-3a835bd7b5c5")}catch{}})();const Q=X.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=R(e),t=s.roleMap!=null&&G(s.roleMap),d=i||c==="user_address"||H(l?.userRole??[])||t?void 0:"readonly";if(o==null){const a=N(c,e);return{addressToEdit:a?.addressToCreate,loadingState:a?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=_(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=t=>{if(t==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=F(d?.pathnameStackToGoBack);let a=r.poppedPathname??v();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(a=`${a}?${g}`)}o(a,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:t=>{const d=Y(t);e(q({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:t.street.addressString,city:t.city,state:t.state,country:t.country.selectedOption??"",postalCode:t.postalCode,suite:t.suite,secondaryInfo:t.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(z);function ne({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const t=T(),d=P(),r=j(),{addressId:a,addressType:u}=E(),g=$(),I=D(),k=L.getSignedInUser(),[p,w]=h.useState(a==null),f=B((m=>a!=null?_(m,a).fetchState:"Not-Started")),A=V();if(k==null)throw Error("Can't access address page without signing in...");const x=m=>m.trackPageLoaded(a!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{p||a==null||(w(!0),d(O(a,!1)))}),[p,a,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)?!p&&f==="Not-Started"||p&&f==="In-Progress"?n.jsx(K,{fetchState:f,style:{backgroundColor:I.colors.grey5}}):a!=null&&f==="Error"?(t(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(U,{analytics:C,onLoad:x}),n.jsx(Q,{windowSize:g,children:n.jsx(W,{location:r,navigate:t,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:a,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):n.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{ne as A,Y as t};
@@ -0,0 +1,22 @@
1
+ import{j as h}from"./liveblocks-2F3ER8H4.js";import{a}from"./sentry-Dwi3Xpu2.js";import{u as _t,h as Dt,i as Lt,g as Ft,j as b,l as Bt}from"./core-BmXpopk3.js";import{a as Mt,j as Vt,e8 as $t,z as Nt,a2 as qt,e9 as Gt,ea as Ht,eb as zt,br as Fe,ec as We,ed as Wt,bq as Je,a5 as ge,a9 as ce,m as M,ee as me,ef as Jt,eg as Kt,av as Yt,U as Xt,w as Zt,eh as es,ei as ts,aw as ss,ej as as,ek as ns,el as os,em as is,p as rs,bm as Be,en as ls}from"./index-BH7Z90Ry.js";import{fE as B,gt as R,Uh as ds,a2x as us,a2y as cs,jM as ms,a2z as Ss,jJ as hs,a2A as Se,jp as W,jS as J,jv as Ie,jc as he,ja as ps,jU as fs,jE as Ke,Uq as Me,gv as V,gK as gs,Up as Is,Ua as Ve,fF as Cs,j3 as ks,a2B as bs,g8 as vs,jl as Es,jh as Ps,fG as pe,gf as ys,a2C as ws,a2D as xs,a2E as Rs,gu as Ts,go as $e,k4 as Ne,gq as qe,gw as js,a2F as Ge,jV as Os,je as As,jy as Us,jQ as He,jB as Qs,gx as _s,gy as Ds,gz as Ls,gA as Fs}from"./zeni-epic-state-DtY6MD5C.js";import{D as Bs,n as $,S as Ms,P as Vs}from"./mui-DpZKsKJ-.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-B1hI9_5p.js";import{p as Ns}from"./pathToGoBack-IYhrTF3T.js";import{k as qs}from"./routePaths-DuFLBwyX.js";import{u as Gs}from"./useTaskManagerPusherEvents-Be2DL4pK.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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]="5433294a-3ad3-4119-91d6-d15d090adf0e",s._sentryDebugIdIdentifier="sentry-dbid-5433294a-3ad3-4119-91d6-d15d090adf0e")}catch{}})();const Hs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Ye="chat-response-generated";function zs(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=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Bt((function(s,r){const t=B(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(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:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:J(s).detail,skillDetailError:J(s).fetchState==="Error",skillDetailLoading:J(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:ns(s),resolveSyntheticAnswerPolicyTile:as(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:D}=r,T=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=_s(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:K,currentQuestionAnswer:j,currentQuestionAnswerSummary:Y}=Je(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(Y,K),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Ds(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Fs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(n,o,m,E,v)=>{n&&Be(s,n,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:n=>{s(Ie({macroId:n})),s(Qs({macroId:n}))},onSaveSkill:(n,o)=>{s(He({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",m=n.name?.trim()??"";s(He({draft:{name:o.length>0?o:m,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(Us({macroId:n,version:o}))},onDeleteSkill:n=>{s(As({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Os({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(n,o)=>{s(V()),s($e()),Be(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,n),s(Ge())},updateCurrentInput:n=>{s(qe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(js(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(qe(""))},togglePageView:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),D(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const n=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(Ts({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{D(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{D(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Ia=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=_t(),l=Dt(),{session_id:c}=Lt(),i=Ft(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=a.useState(!1),A=b((e=>B(e).uiState.isSkillsBrowserOpen===!0)),D=b((e=>R(e).skillsEnabled)),T=b((e=>B(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ds(e))),o=b((e=>us(e))),m=b((e=>cs(e))),[E,v]=a.useState(void 0),[K,j]=a.useState(!1),[Y,Ce]=a.useState(void 0),Xe=a.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=a.useCallback((e=>{v(e),j(!0)}),[]),et=a.useCallback((()=>{v(void 0),j(!1)}),[]),tt=a.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=n.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=a.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const F=ke?.macroId,at=b((e=>J(e))),be=F!=null&&F!==""&&at.fetchState==="Not-Started";a.useEffect((()=>{be&&F!=null&&t(Ie({macroId:F}))}),[t,be,F]);const nt=b((e=>B(e).uiState.currentChatSessionId))??c,C=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Vt(nt))),O=C?.scheduleId??null,[ve,ot]=a.useState(!0);a.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=a.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=a.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=a.useCallback(((e,u)=>{t(fs({enabled:u,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=a.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=a.useCallback((()=>{t(Ke()),t(Me())}),[t]),ut=a.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();a.useEffect((()=>{t(gs())}),[t]);const g=b((e=>B(e))),w=Nt.getSignedInUser();a.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=qt(),U=Yt(pt),k=b((e=>Cs(e))),d=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=a.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=a.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=a.useCallback(((e,u)=>{const Q=e.sessionId??I.sessionId;Q!=null&&L&&l(`/${y}/ai-cfo/${Q}?routine=${encodeURIComponent(u)}`)}),[L,l,I.sessionId,y]),ft=a.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:X.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,X]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=Ht({isFileUploadEnabled:s,tenantEmailDomain:y}),ae=zt({currentTenant:k,currentChatSessionId:d,aiCfoView:g,skillsEnabled:D,onCloseSkills:ut,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,q=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;S(!0);const u={...e};delete u[Fe],l(i,{replace:!0,state:u})}),[i.pathname,i.search,i.state,l]);const[bt,ne]=a.useState(null),[vt,oe]=a.useState(!1),[Et,ie]=a.useState(void 0),[Pt,re]=a.useState(void 0),we=a.useRef(!1);a.useEffect((()=>{if(!we.current&&q!=null&&q!==""){const e=i.state;ne(q),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const u=e?.aiCfoSuggestionIndex;re(typeof u=="number"?u:void 0),we.current=!0}}),[q,ye,i.state]);const yt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||d!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,d,t,w]);const G=g.uiState.lastContextMessage;a.useEffect((()=>{G!=null&&G!==""&&d!=null&&(ne(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,d,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(d),H=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=d!=null?g.fetchChatSessionHistoryByChatSessionId?.[d]?.fetchState??"Not-Started":"Not-Started",Ae=d==null||(g.uiState.chatHistoryNextPageToken[d]?.hasMore??!0),Ue=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Je(Ue,d),Rt=xt.length===0;a.useEffect((()=>{x||U||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,l,i.state]);const Tt=a.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),u=k.tenantEmailDomain;l(e.poppedPathname??(u!=null?`/${u}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Qe=a.useRef(void 0),_e=a.useRef(void 0);a.useEffect((()=>{const e=c!==Qe.current,u=d!==_e.current;Qe.current=c,_e.current=d,c!==d&&(!e||c==null||qs(c)?u&&d!=null&&l(`../ai-cfo/${d}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[d,c]);const jt=a.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,u,Q)=>Q.onEventReceived(e,u)})),[je]);a.useEffect((()=>{H!=="In-Progress"&&z&&t(Es())}),[H,z,t]),a.useEffect((()=>{d!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===d||H==="Completed"&&!z)&&t(Ps(d,w.userId))}),[Oe,H,Ae,z,d,w,c,t]);const de=w?.userId,Ot=a.useMemo((()=>{return de==null?[]:[(e=de,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[de]),De=a.useCallback((e=>{const u=e!=null&&(e===P||e===O);(T||u)&&t(he()),u&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>De(P??O),onEvent:(e,u)=>{const Q=(ue=>{if(ue==null||typeof ue!="object")return null;const _=ue;return fe(_.schedule_id)&&fe(_.run_id)?{scheduleId:_.schedule_id,runId:_.run_id,status:Hs.find((Qt=>Qt===_.status))??null,finishedAt:fe(_.finished_at)?_.finished_at:null}:null})(u);Q!=null&&De(Q.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=d!=null&&g.responseStateByChatSessionId?.[d]?.answer?.fetchState==="In-Progress";if(!x&&U)return h.jsxs(Ks,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ae.drawerElement,h.jsx(Ys,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const Ut=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Xt.Event.aiCFOPage)}),U&&ae.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:U?ae.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:n.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,u)=>se(u,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:dt,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:D,promoDismissalScope:y}),p&&U?h.jsx(Bs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Xs,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!U?h.jsx(Jt,{open:p,onClose:()=>S(!1),children:h.jsx(Kt,{children:Ut})}):null]})},ze=$(Ms)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,Js=$.div`
6
+ height: 100vh;
7
+ width: 100%;
8
+ `,Ks=$.div`
9
+ height: 100vh;
10
+ width: 100%;
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 0;
14
+ `,Ys=$.div`
15
+ flex: 1;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ `,Xs=$(Vs)`
20
+ box-shadow: ${({theme:s})=>s.colors.elevation2};
21
+ color: ${({theme:s})=>s.colors.grey4};
22
+ `;export{Ia as default};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-CgHUgeBY.js";import{a as o,R as ya}from"./sentry-DSWD_gIh.js";import{u as Me,j as r,g as Ta,h as $a,q as Z}from"./core-Cc7wW2EM.js";import{fF as Fe,T_ as Ba,T$ as Ue,g9 as xa,gv as K,U0 as W,jE as Ie,jc as ve,U1 as Aa,U2 as _a,gO as Da,p$ as Ma,U3 as Fa,U4 as ye,gm as Ua,U5 as $,fE as Ra,gt as Za,U6 as Ga,U7 as Va,U8 as ja,U9 as Te,Ua as Ha,Ub as $e,Uc as Na,Eb as Pa,gn as La,h1 as Oa,cV as za,Ud as qa,Ue as Ya,qC as Ja,g8 as Ka,j6 as Wa,Uf as Qa,Ug as Xa,wu as et,go as at}from"./zeni-epic-state-BVJjEVAA.js";import{w as tt,i as nt,a as ot,F as st,E as rt,N as it,f as m,c as lt,u as dt,d as ct,V as ut,e as mt,g as Ct,B as pt,h as ht,l as ft,z as gt,j as G,p,m as Be,k as bt,n as St,o as xe,q as kt,D as Ae,r as Et,s as wt,v as X,x as Q,y as It,A as vt,C as yt,L as Tt,H as $t,I as Bt,J as ee,K as xt,O as At}from"./index-vIt7RQvO.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-C4zFSCiU.js";import{u as Ut}from"./InboxNotificationsProvider-CYNlrTK-.js";import{u as Rt}from"./useTaskManagerAccess-BeNfkHpZ.js";import{u as Zt}from"./expenseAutomationHelper-iXuIUZiF.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.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]="7dcc849f-1712-4677-8e90-8f3bc77b754f",a._sentryDebugIdIdentifier="sentry-dbid-7dcc849f-1712-4677-8e90-8f3bc77b754f")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Gt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,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]=ya.useState(!1),[S,Re]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Me(),[Ze,Ge]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[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}=Rt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Le=Ct(i,Pe,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=()=>{Ge(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=Z("/signout")!==null,M=Z("/:tenantEmailDomain/dashboard")!==null,ie=Z("/:tenantEmailDomain/reports")!==null,g=Z("/:tenantEmailDomain/onboarding/*")!==null,le=Zt();o.useEffect((()=>{w&&D&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ye(l))}}}),[le,t.state]);const Ye=qe||g,L=r((e=>e.tenantState)),Je=r((e=>L.fetchState==="Completed"?Ua(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=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=>Ra(e))),ra=r((e=>Za(e).skillsEnabled)),ia=r((e=>Ga(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),[v,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Ut(),U=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return me==="In-Progress"&&F==="Completed"?(n(Te({chatSessionId:v})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(Te({chatSessionId:v})),z(void 0)))}),[n,t.state,s,F,v,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||U.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,U.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=U;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ue({unreadCount:N},"comments")))}}),[N,U.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];Ke===!1&&y.push("accounts_payable_aging"),We===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),se===!1&&y.push("expense_automation_card");const fe=r((e=>Na(e,y).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?La(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),T=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&&G.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(ye(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({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:L.currentTenantId??"",tenants:L.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:P.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:Le,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!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(Tt.TENANT_SWITCHING),T(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&G.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),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(G.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const R=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:R,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=At(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||G.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const R=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${R.month}-${R.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!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:Re,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ze?`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:()=>T(!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(Gt,{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:()=>T(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:X,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(Ue({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"}))))`
1
+ import{j as d}from"./liveblocks-2F3ER8H4.js";import{a as o,R as ya}from"./sentry-Dwi3Xpu2.js";import{u as Ue,j as r,g as Ta,h as $a,q as R}from"./core-BmXpopk3.js";import{fF as Me,U8 as Ba,U9 as Fe,g9 as xa,gv as K,Ua as W,jE as Ie,jc as ve,Ub as Aa,Uc as _a,gO as Da,p$ as Ua,Ud as Ma,Ue as ye,gm as Fa,Uf as $,fE as Ga,gt as Ra,Ug as Za,Uh as ja,Ui as Va,Uj as Te,Uk as Ha,Ul as $e,Um as La,Eb as Pa,gn as Na,h1 as Oa,cV as za,Un as qa,Uo as Ya,qC as Ja,g8 as Ka,j6 as Wa,Up as Qa,Uq as Xa,wu as et,go as at}from"./zeni-epic-state-DtY6MD5C.js";import{w as tt,i as nt,a as ot,c as st,E as rt,d as it,$ as m,e as lt,u as dt,f as ct,l as ut,g as mt,h as Ct,Y as pt,j as ht,k as ft,z as gt,m as Z,p,n as Be,o as bt,q as St,r as xe,s as kt,K as Ae,v as Et,R as wt,x as X,y as Q,A as It,B as vt,C as yt,L as Tt,D as $t,F as Bt,H as ee,I as xt,J as At}from"./index-BH7Z90Ry.js";import{A as _t,b as Dt,I as Ut,a as _e,d as Mt,D as De}from"./mui-DpZKsKJ-.js";import{u as Ft}from"./InboxNotificationsProvider-jZPrqdDf.js";import{u as Gt}from"./useTaskManagerAccess-DvrYqbN3.js";import{u as Rt}from"./expenseAutomationHelper-wsi-w_Qs.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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]="2ad829ea-0bee-44f3-86b5-0df33b4dd27d",a._sentryDebugIdIdentifier="sentry-dbid-2ad829ea-0bee-44f3-86b5-0df33b4dd27d")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Zt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),jt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[j,A]=ya.useState(!1),[S,Ge]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Ue(),[Re,Ze]=o.useState(!1),V=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Me(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:je}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:Ve}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[L,He]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Ne=Ct(i,Pe,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=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=R("/signout")!==null,U=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&D&&!g&&P.fetchState==="Not-Started"&&n(Ua(!0))}),[w,D,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Ma(e);l!=null&&n(ye(l))}}}),[le,t.state]);const Ye=qe||g,N=r((e=>e.tenantState)),Je=r((e=>N.fetchState==="Completed"?Fa(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=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=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>Za(e))),ce=r((e=>ja(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(Va),[v,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,M=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(M),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Ft(),F=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return me==="In-Progress"&&M==="Completed"?(n(Te({chatSessionId:v})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(n(Te({chatSessionId:v})),z(void 0)))}),[n,t.state,s,M,v,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||F.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,F.fetchState,n]),o.useEffect((()=>{if(L!=null){const{fetchState:e}=F;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Fe({unreadCount:L},"comments")))}}),[L,F.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];Ke===!1&&y.push("accounts_payable_aging"),We===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),se===!1&&y.push("expense_automation_card");const fe=r((e=>La(e,y).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Na(e,be.tenantId):void 0)),Ca=U&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!U&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),T=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&&Z.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(ye(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({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:N.currentTenantId??"",tenants:N.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:P.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:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!1);const e=Ve?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=>{je(Tt.TENANT_SWITCHING),T(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&Z.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),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(Z.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=At(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||Z.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!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:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:U,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${V.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Ut,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>T(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),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(Zt,{className:c.root,children:[d.jsx(Mt,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!U?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:j,onClose:()=>T(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Ue(),b=r((A=>Me(A))),j={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Fe({unreadCount:S.data.unread},"tasks"))}};return d.jsx(jt,{tenantEmailDomain:a,...j})},Vt=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};
@@ -0,0 +1 @@
1
+ import{j as u}from"./liveblocks-2F3ER8H4.js";import{a as d}from"./sentry-Dwi3Xpu2.js";import{h as U,g as B,u as j,j as y,N as H,l as V,i as W,n as te,o as x}from"./core-BmXpopk3.js";import{fF as P,Zf as w,YY as R,HL as E,HF as q,HJ as A,Hy as Y,Y_ as K,HC as ae,HN as oe,HB as z,HQ as J,HM as C}from"./zeni-epic-state-DtY6MD5C.js";import{z as O,w as M,b$ as pe,s as T,bV as Q,c0 as le,E as Z,a8 as G,c1 as se,c2 as ne}from"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import{u as X}from"./useEnsureVendorListLoaded-BtOYIHPo.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-La5bMk76.js";import ie from"./NotFoundScreen-CjcmfT5h.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]="a6057f53-5299-464b-8e0f-c784358bd2c0",e._sentryDebugIdIdentifier="sentry-dbid-a6057f53-5299-464b-8e0f-c784358bd2c0")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const m={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...m})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),m=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:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,I,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(de,{currentTenant:m,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const m=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const g=!!re(I.value);return{type:g?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(b);m.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const me=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,m=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=m?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(me,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function Ce(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{Ce as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-CgHUgeBY.js";import{h as J,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-Cc7wW2EM.js";import{fF as W,Yj as Ge,bq as It,Sj as ia,bo as vt,bJ as de,Yk as kt,G$ as wt,Io as Re,HC as oa,bn as Ce,Yl as la,Ym as sa,c8 as ra,Yn as ca,l$ as xt,Yo as Bt,Yp as Ct,IS as Ue,Hi as xe,Yq as da,GP as et,Yr as ua,MH as pa,GT as ma,GZ as At,Ys as Se,Yt as _e,Ip as Me,Hf as Dt,Yu as ba,Yv as ha,Is as Ne,Yw as ga,Iy as Sa,Yx as Et,I1 as tt,I6 as ya,Yy as fa,Yz as ce,YA as Tt,YB as jt,YC as Pt,gV as Ia,Hn as Ve,cG as Ft,YD as va,gh as ka,YE as wa,YF as xa,d_ as Rt,dZ as Vt,YG as Oe,YH as Ba,YI as Ca,WT as Ye,YJ as Aa,WU as ie,WV as ze,YK as Da,YL as Ea,YM as Ta,I8 as at,I5 as ja,YN as Pa,YO as Fa,YP as Ra,HT as Va,YQ as $a,YR as La,cu as $t,da as Lt,ma as Ga,bO as Ua,br as Gt,bP as Ut,G3 as _a,YS as Ma,Mu as Na,MA as Oa,Cd as Ya,Iq as za,IZ as Za,mn as ge,YT as Ha,YU as _t,mR as Wa,mh as Mt,mC as Nt,mB as nt,bE as pe,bN as qa,YV as Ja,YW as ye,kN as Ka,YX as it,YY as Xa,kR as Qa,la as en,Jb as tn,YZ as an,mK as nn,J1 as on,Y_ as ot,J5 as ln,Ja as sn,J8 as rn,I$ as cn,Y$ as Ot,H8 as dn,Z0 as un,Z1 as pn,gG as mn,gF as bn,gE as hn,mq as gn,mI as lt,mT as Sn,uX as yn,mz as fn,J3 as In,kX as vn,mY as kn,Z2 as wn,kP as xn,uO as Bn,Z3 as Cn,HZ as An,bK as Dn,bt as En,Ui as Tn,dd as jn,dc as Pn,cF as Fn,cM as Rn}from"./zeni-epic-state-BVJjEVAA.js";import{E as ue,z as V,P as fe,at as Ze,N as oe,f,bj as He,a8 as se,K as A,a9 as Ae,j as E,bw as Vn,a5 as H,aw as We,p as D,a2 as Ie,bx as st,by as rt,bz as $n,aA as Ln,ag as Gn,aT as Un,ac as Yt,G as De,ah as qe,bA as _n,af as zt,bB as Mn,ar as Nn,U as Zt,w as On,bC as Yn,bD as zn,bE as Zn,bF as Hn,bG as Wn,bH as qn,bI as Jn,bJ as Kn,bK as Xn,F as Qn,bL as ei,bt as ti,bM as ai,aj as ni,bN as ii,g as oi}from"./index-vIt7RQvO.js";import{n as G,S as li}from"./mui-C4zFSCiU.js";import{A as ct}from"./AddressScreen-CrPViFiu.js";import{g as ne,a as Ee,i as Ht,V as Je,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-DQXD1NSK.js";import{a as g}from"./sentry-DSWD_gIh.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-7-6nPEHY.js";import{u as Wt}from"./useInitialThreadRequest-D4Y8xhXu.js";import{u as di}from"./BusinessVerificationPageScreen-C-aPhqey.js";import Be from"./NotFoundScreen-DzxbROot.js";import{D as ui}from"./DrawerScreen-DyQejCID.js";import{M as qt}from"./MobileAppDrawer-DLFLa7hS.js";import{F as Jt}from"./FeaturePreviewScreen-OtBPdCPK.js";import{S as Te}from"./SetupPagesScreen-B8kiMdZf.js";import{B as pi}from"./BillPayApprovalRoutes-CMAUuUUB.js";import{F as mi}from"./ScreenRoutes-Bl2EONFe.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./routePaths-C0UIXwMQ.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-BeNfkHpZ.js";import"./analyticsHelper-Ch9SsWjb.js";import"./ReimbursementApprovalRuleDetailScreen-BxglZgWl.js";import"./getLocaleForTenant-Bgt5rFzV.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]="cc7a48ad-aee2-4c25-9510-bc7c98452d17",e._sentryDebugIdIdentifier="sentry-dbid-cc7a48ad-aee2-4c25-9510-bc7c98452d17")}catch{}})();const bi=X((function(e,t){const l=Ge(e,t.billId),n=V.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??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${We}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(At(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ct({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:l}))}}}))(Vn);function hi(){const e=J(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>W(U))),s=v((U=>Ge(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Wt(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&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:_}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:Y}=$(He.zeniAssistConfig),z=ia(o),w=vt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=Y.user_ids!=null&&r?.userId!=null&&Y.user_ids.includes(r?.userId),{isFeatureEnabled:Z}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,M,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),t(wt(n??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,O,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,q]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:U=>(N=>{n!=null&&N.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Z,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Yt(100,58)},ut=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=J(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(He.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>W(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[O,_]=g.useState(!1),[Y,z]=g.useState(),w=v((P=>_e(P,m,h,n)));let M=w.fetchState,L=w.file,Z=w.showAutofill;const q=v((P=>Ge(P,n??"")));u===!1&&(M=q.fetchState,L=q.transactionDetails?.attachments?.[0],Z=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Me(!0))}),[n,t]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[B,k,u,n,t,S,I,b]);const N={onOkClick:()=>{if(_(!1),!Y)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Ne(Y,m,n))},onCancelClick:()=>{if(_(!1),!Y)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:Y,billId:n}))}},te=g.useCallback((()=>{const P=H(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||q.fetchState==="Error")return a.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:_,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||Z?null:a.jsx(pt,{children:a.jsx(Kt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[Z&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:N,isEditPopup:!0}):null,o==="small"||Z?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:Z,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,q,w),setShowConfirmationPopup:_,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=_n();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-2F3ER8H4.js";import{h as J,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-BmXpopk3.js";import{fF as W,Yy as Ge,bq as It,St as ia,bo as vt,bJ as de,Yz as kt,G$ as wt,Io as Re,HC as oa,bn as Ce,YA as la,YB as sa,c8 as ra,YC as ca,l$ as xt,YD as Bt,YE as Ct,IS as Ue,Hi as xe,YF as da,GP as et,YG as ua,MH as pa,GT as ma,GZ as At,YH as Se,YI as _e,Ip as Me,Hf as Dt,YJ as ba,YK as ha,Is as Oe,YL as ga,Iy as Sa,YM as Et,I1 as tt,I6 as ya,YN as fa,YO as ce,YP as Tt,YQ as jt,YR as Pt,gV as Ia,Hn as Ve,cG as Ft,YS as va,gh as ka,YT as wa,YU as xa,d_ as Rt,dZ as Vt,YV as Ne,YW as Ba,YX as Ca,X1 as Ze,YY as Aa,X2 as ie,X3 as ze,YZ as Da,Y_ as Ea,Y$ as Ta,I8 as at,I5 as ja,Z0 as Pa,Z1 as Fa,Z2 as Ra,HT as Va,Z3 as $a,Z4 as La,cu as $t,da as Lt,ma as Ga,bO as Ua,br as Gt,bP as Ut,G3 as _a,Z5 as Ma,Mu as Oa,MA as Na,Cd as Za,Iq as za,IZ as Ya,mn as ge,Z6 as Ha,Z7 as _t,mR as Wa,mh as Mt,mC as Ot,mB as nt,bE as pe,bN as qa,Z8 as Ja,Z9 as ye,kN as Ka,Za as it,Zb as Xa,kR as Qa,la as en,Jb as tn,Zc as an,mK as nn,J1 as on,Zd as ot,J5 as ln,Ja as sn,J8 as rn,I$ as cn,Ze as Nt,H8 as dn,Zf as un,Zg as pn,gG as mn,gF as bn,gE as hn,mq as gn,mI as lt,mT as Sn,uX as yn,mz as fn,J3 as In,kX as vn,mY as kn,Zh as wn,kP as xn,uO as Bn,Zi as Cn,HZ as An,bK as Dn,bt as En,Us as Tn,dd as jn,dc as Pn,cF as Fn,cM as Rn}from"./zeni-epic-state-DtY6MD5C.js";import{E as ue,z as V,O as fe,at as Ye,d as oe,$ as f,bk as He,a8 as se,I as A,a9 as Ae,m as E,bx as Vn,a5 as H,aw as We,p as D,a2 as Ie,by as st,bz as rt,bA as $n,aA as Ln,ag as Gn,aT as Un,ac as Zt,G as De,ah as qe,bB as _n,af as zt,bC as Mn,ar as On,U as Yt,w as Nn,bD as Zn,bE as zn,bF as Yn,bG as Hn,bH as Wn,bI as qn,bJ as Jn,bK as Kn,bL as Xn,c as Qn,bM as ei,bu as ti,bN as ai,aj as ni,bO as ii,h as oi}from"./index-BH7Z90Ry.js";import{n as G,S as li}from"./mui-DpZKsKJ-.js";import{A as ct}from"./AddressScreen-CvhZrOl1.js";import{g as ne,a as Ee,i as Ht,V as Je,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-BOXpXEFg.js";import{a as g}from"./sentry-Dwi3Xpu2.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-B82QOIYm.js";import{u as Wt}from"./useInitialThreadRequest-DagpMHc1.js";import{u as di}from"./BusinessVerificationPageScreen-wzhfqwbN.js";import Be from"./NotFoundScreen-CjcmfT5h.js";import{D as ui}from"./DrawerScreen-kd-vUIOU.js";import{M as qt}from"./MobileAppDrawer-thURFqdR.js";import{F as Jt}from"./FeaturePreviewScreen-DlYWStt_.js";import{S as Te}from"./SetupPagesScreen-Cx3OOUGr.js";import{B as pi}from"./BillPayApprovalRoutes-D18TxHMc.js";import{F as mi}from"./ScreenRoutes-DUiJb0LC.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.js";import"./routePaths-DuFLBwyX.js";import"./InboxNotificationsProvider-jZPrqdDf.js";import"./useTaskManagerAccess-DvrYqbN3.js";import"./analyticsHelper-DIAaX2E9.js";import"./useEnsureVendorListLoaded-BtOYIHPo.js";import"./ReimbursementApprovalRuleDetailScreen-La5bMk76.js";import"./getLocaleForTenant-CLcFXXBi.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]="0238c019-d877-422e-986f-9928e06406f7",e._sentryDebugIdIdentifier="sentry-dbid-0238c019-d877-422e-986f-9928e06406f7")}catch{}})();const bi=X((function(e,t){const l=Ge(e,t.billId),n=V.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??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${We}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(At(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ct({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:l}))}}}))(Vn);function hi(){const e=J(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>W(U))),s=v((U=>Ge(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Wt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ye({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:N}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:_}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:Z}=$(He.zeniAssistConfig),z=ia(o),w=vt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=Z.user_ids!=null&&r?.userId!=null&&Z.user_ids.includes(r?.userId),{isFeatureEnabled:Y}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,M,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),t(wt(n??"",N,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,N,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,N,L,q]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:U=>(O=>{n!=null&&O.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Y,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Zt(100,58)},ut=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=J(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(He.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>W(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[N,_]=g.useState(!1),[Z,z]=g.useState(),w=v((P=>_e(P,m,h,n)));let M=w.fetchState,L=w.file,Y=w.showAutofill;const q=v((P=>Ge(P,n??"")));u===!1&&(M=q.fetchState,L=q.transactionDetails?.attachments?.[0],Y=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Me(!0))}),[n,t]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[B,k,u,n,t,S,I,b]);const O={onOkClick:()=>{if(_(!1),!Z)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Oe(Z,m,n))},onCancelClick:()=>{if(_(!1),!Z)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:Z,billId:n}))}},te=g.useCallback((()=>{const P=H(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||q.fetchState==="Error")return a.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:_,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||Y?null:a.jsx(pt,{children:a.jsx(Kt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[Y&&o!=="small"?a.jsx(mt,{}):null,N?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:O,isEditPopup:!0}):null,o==="small"||Y?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:Y,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,q,w),setShowConfirmationPopup:_,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=_n();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=G.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -85,11 +85,11 @@ import{j as a}from"./liveblocks-CgHUgeBY.js";import{h as J,u as le,g as K,i as e
85
85
  flex-direction: column;
86
86
  align-items: center;
87
87
  background-color: ${e=>e.theme.colors.grey4};
88
- `,Di=X((function(e,t){const l=V.getSignedInUser(),n=Ce(l),c=Pt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ye(e,"common"),s=e.tenantState.currentTenantId,i=W(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=Aa(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics:E,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${We}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Tt(o))},onSubtabChange:o=>{e(ce()),e(jt(o))},onTransactionClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;E?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=D(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e($a(o))},onReloadTransactions:()=>{e(Ve(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(Va(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Ra({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&E.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&E.trackSpendManagementDownloadClick("bill_pay"),e(Fa({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Pa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(ja(o,s??""));break;case"send_for_approval":e(at("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(at("approve")),t.navigate("./bulk-review");break;case"review":e(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Le)&&e(Ea(!1))},onEventReceived:o=>{o===Xt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(ze({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(On(Yn));function Ei(){const e=J(),t=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=g.useState(!1),[s,i]=g.useState(null),d=aa("/:tenantEmailDomain/bills/bulk-review")!=null;g.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(jt(c?.subTab))),()=>{t(ce())})),[]);const p=V.getSignedInUser(),m=v((F=>W(F))),{areTenantIdsInSync:S}=Nn(),[h,b]=g.useState(!1),{useFeatureGate:C}=oe(),{isFeatureEnabled:I}=C(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:j}=C(f.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:B}=C(f.isBillPayBulkActionEnabled),{isFeatureEnabled:T}=C(f.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:k}=C(f.isBillPayDetectInsufficientFundsEnabled),$=v((F=>Pt(F,ae,B,p?.userId))),{isFeatureEnabled:O}=C(f.isDebitCardFeatureEnabled),_=$.fetchState,{isAiCfoAccessEnabled:Y,onAskAiCfoClick:z}=Xe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:_==="Completed"});const w=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,M=!!m.companyBillPayInfo?.info?.isBillPayEnabled,L=v((F=>Ia(F.companyState,m.companyId))),Z=L?.company.featuresActivationInfo.connectedAccountProvider;if(g.useEffect((()=>{!h&&M&&S&&(b(!0),t(Ve(ae,!0,I,T)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const q=(F,re)=>{t(Ba({uiState:{sortKey:F,sortOrder:re},period:ae}))},U=Ft(r?.loggedInUserRoleMap),N=de(r?.loggedInUserRoleMap),te=F=>{o(F)},{billsProcessed:P,billsProcessing:ve}=v((F=>va(F)));g.useEffect((()=>{P===ve&&s!=null&&(t(ka({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:P>1?ke.headers.bills:ke.texts.bill2},{variableName:"_has_",variableValue:P>1?ke.texts.have:ke.texts.has},{variableName:"_action_",variableValue:wa(s)}]})),t(xa()),setTimeout((()=>{t(Ve(ae,!0,I,!0,T))}),3e3),i(null))}),[P,ve]);const Qt={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Xt}`,`private-encrypted-${m.companyId}.${Le}`]:[],eventCallback:(F,re,Qe)=>{F.endsWith(Le)?Qe.onBillPayApprovalRulesEventReceived?.(F):re?.entity_type==="bill"&&(i(re.operation_type),Qe.onEventReceived(F))}},ea=Rt(O,m),ta=Vt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ea===!0||ta===!0?a.jsx(Jt,{}):M?a.jsxs(a.Fragment,{children:[_==="Completed"?a.jsx(Ae,{analytics:E,onLoad:F=>(re=>re.trackPageLoaded(Zt.Event.billPayHome))(F)}):null,a.jsxs(Ai,{windowSize:n,children:[a.jsx(qt,{isAppContentDrawerOpen:u,handleDrawerToggle:te}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Yt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(ji,{onClick:F=>F.stopPropagation(),children:a.jsx(Ci,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",period:ae,isAdmin:!1,uiState:$.uiState,onColumnSortConfigChanged:q,isUserHasOnlyBillpayAccess:U,isShowDeletedBillsEnabled:I,isShowDeletedReimbursementEnabled:j,isBulkActionEnabled:B,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{te(!0)},isDownloadEnabled:$.isDownloadEnabled,connectedAccountProvider:Z,bulkSubmissionLimit:$.billBulkSubmissionLimit,bulkSubmissionFetchState:$.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:$.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:T,isDetectInsufficientFundsEnabled:k,isAiCfoAccessEnabled:Y,onAskAiCfoClick:z,...Qt})]})]}):w===!0&&N===!0?a.jsx(Q,{to:"../setup"}):r!=null&&Oe(m,r.loggedInUserRoleMap)?a.jsx(Q,{to:"../promo"}):a.jsx(se,{fetchState:_}):a.jsx(Be,{})}const Ti=e=>`/${e}/bills/setup`,ji=G(li)`
88
+ `,Di=X((function(e,t){const l=V.getSignedInUser(),n=Ce(l),c=Pt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ze(e,"common"),s=e.tenantState.currentTenantId,i=W(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=Aa(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics:E,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${We}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Tt(o))},onSubtabChange:o=>{e(ce()),e(jt(o))},onTransactionClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;E?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=D(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e($a(o))},onReloadTransactions:()=>{e(Ve(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(Va(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Ra({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&E.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&E.trackSpendManagementDownloadClick("bill_pay"),e(Fa({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Pa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(ja(o,s??""));break;case"send_for_approval":e(at("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(at("approve")),t.navigate("./bulk-review");break;case"review":e(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Le)&&e(Ea(!1))},onEventReceived:o=>{o===Xt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(ze({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(Nn(Zn));function Ei(){const e=J(),t=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=g.useState(!1),[s,i]=g.useState(null),d=aa("/:tenantEmailDomain/bills/bulk-review")!=null;g.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(jt(c?.subTab))),()=>{t(ce())})),[]);const p=V.getSignedInUser(),m=v((F=>W(F))),{areTenantIdsInSync:S}=On(),[h,b]=g.useState(!1),{useFeatureGate:C}=oe(),{isFeatureEnabled:I}=C(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:j}=C(f.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:B}=C(f.isBillPayBulkActionEnabled),{isFeatureEnabled:T}=C(f.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:k}=C(f.isBillPayDetectInsufficientFundsEnabled),$=v((F=>Pt(F,ae,B,p?.userId))),{isFeatureEnabled:N}=C(f.isDebitCardFeatureEnabled),_=$.fetchState,{isAiCfoAccessEnabled:Z,onAskAiCfoClick:z}=Xe({mobileExploreReferrer:"Bills List"});Ye({isDataReady:_==="Completed"});const w=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,M=!!m.companyBillPayInfo?.info?.isBillPayEnabled,L=v((F=>Ia(F.companyState,m.companyId))),Y=L?.company.featuresActivationInfo.connectedAccountProvider;if(g.useEffect((()=>{!h&&M&&S&&(b(!0),t(Ve(ae,!0,I,T)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const q=(F,re)=>{t(Ba({uiState:{sortKey:F,sortOrder:re},period:ae}))},U=Ft(r?.loggedInUserRoleMap),O=de(r?.loggedInUserRoleMap),te=F=>{o(F)},{billsProcessed:P,billsProcessing:ve}=v((F=>va(F)));g.useEffect((()=>{P===ve&&s!=null&&(t(ka({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:P>1?ke.headers.bills:ke.texts.bill2},{variableName:"_has_",variableValue:P>1?ke.texts.have:ke.texts.has},{variableName:"_action_",variableValue:wa(s)}]})),t(xa()),setTimeout((()=>{t(Ve(ae,!0,I,!0,T))}),3e3),i(null))}),[P,ve]);const Qt={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Xt}`,`private-encrypted-${m.companyId}.${Le}`]:[],eventCallback:(F,re,Qe)=>{F.endsWith(Le)?Qe.onBillPayApprovalRulesEventReceived?.(F):re?.entity_type==="bill"&&(i(re.operation_type),Qe.onEventReceived(F))}},ea=Rt(N,m),ta=Vt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ea===!0||ta===!0?a.jsx(Jt,{}):M?a.jsxs(a.Fragment,{children:[_==="Completed"?a.jsx(Ae,{analytics:E,onLoad:F=>(re=>re.trackPageLoaded(Yt.Event.billPayHome))(F)}):null,a.jsxs(Ai,{windowSize:n,children:[a.jsx(qt,{isAppContentDrawerOpen:u,handleDrawerToggle:te}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(ji,{onClick:F=>F.stopPropagation(),children:a.jsx(Ci,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",period:ae,isAdmin:!1,uiState:$.uiState,onColumnSortConfigChanged:q,isUserHasOnlyBillpayAccess:U,isShowDeletedBillsEnabled:I,isShowDeletedReimbursementEnabled:j,isBulkActionEnabled:B,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{te(!0)},isDownloadEnabled:$.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:$.billBulkSubmissionLimit,bulkSubmissionFetchState:$.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:$.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:T,isDetectInsufficientFundsEnabled:k,isAiCfoAccessEnabled:Z,onAskAiCfoClick:z,...Qt})]})]}):w===!0&&O===!0?a.jsx(Q,{to:"../setup"}):r!=null&&Ne(m,r.loggedInUserRoleMap)?a.jsx(Q,{to:"../promo"}):a.jsx(se,{fetchState:_}):a.jsx(Be,{})}const Ti=e=>`/${e}/bills/setup`,ji=G(li)`
89
89
  display: flex;
90
90
  min-height: 100%;
91
91
  flex-direction: column;
92
- `,{common:{currency:he},spendManagement:{billPay:{billDetails:Pi}},appName:Fi}=De.getLocalizedStrings(),Ri=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ye(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ce(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Fi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ua(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,C=S.add(b,"month").isAfter(h),I=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Ut(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),j=W(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${We}/transaction_attachment`,analytics:E,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:j.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:I,isZeniUser:d,isNewUser:C,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(nt(i));const d=ht(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Mt(d,!1)),e(Nt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(nt());const p=ht(s,void 0,l),m=D(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Me(i))},onSaveChangesToLocalStore:(i,d,p,m,S)=>{const h=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Wa({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(Ue("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(_t("draft"))},reviewBillDetails:()=>{const i=Vi(s,l),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(Ha()),onClickDismiss:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=$i(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Li(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Ht(s,l,i),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(At(l))},onAttachmentClick:(i,d)=>{const p=Ee(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Za(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Wn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(za(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ya("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Oa(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Na(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(_a("bill_pay","bill_pay_detail")),e(Ma({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(zn);function bt(){const e=J(),t=K(),l=le(),{billId:n,tenantEmailDomain:c}=ee(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(f.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:p}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:m}=r(f.isRecurringBillsFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=r(f.isShaDisabled),{isFeatureEnabled:b}=r(f.isOurDisabled),{isFeatureEnabled:C}=r(f.isBillPayDetectInsufficientFundsEnabled),{configValue:I}=u(He.sameDayAchDisablementConfig),j=La(I),B=V.getSignedInUser(),T=v((N=>W(N))),k=v((N=>_e(N,p,S,n))),$=Wt(T?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:O,onAskAiCfoClick:_}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:k.fetchState==="Completed"});const Y=T.companyId??V.getSignedInUserTenant(c)?.companyId,z=fe(),w=$t(z?.loggedInUserRoleMap),M=Lt(z?.loggedInUserRoleMap),L=de(z?.loggedInUserRoleMap),Z=vt(T.userRole);if(g.useEffect((()=>{n!=null&&l(kt(n))}),[n]),g.useEffect((()=>{n!=null&&l(Dt(n))}),[n,l]),B==null)throw Error("Can't access address page without signing in...");const q=v((N=>Ga(N.accountState,N.accountListState,"billPayAccountList"))),U={pathname:"../",search:t.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?a.jsx(Q,{to:U}):k.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:k.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:N=>(te=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&te.trackBillPayEditBill(n,k.isRecurring)})(N)}),a.jsx(Ri,{initialOpenThreadRequest:$??void 0,location:t,navigate:e,currentTenant:T,billId:n,companyId:Y,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:p,isLocalCurrencyEnabled:d,uncategorizedAccounts:q,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isShaDisabled:h,isOurDisabled:b,isRecurringBillsFeatureEnabled:m,hasZeniAccountsAdminAccess:w,isZeniAccountsUser:M,isBillPayAdmin:L,isSuperAdmin:Z,isDetectInsufficientFundsEnabled:C,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:O,onAskAiCfoClick:_})]})}const ht=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Vi=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},$i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",Gi=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?pe(t.whatFor.invoiceDate.toString()):Gt(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(qa)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Pi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ja(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=Ui(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Zn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Ui=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Hn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??he.currencyCode,currencySymbol:o.currency?.currencySymbol??he.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??he.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??he.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},_i=G.div`
92
+ `,{common:{currency:he},spendManagement:{billPay:{billDetails:Pi}},appName:Fi}=De.getLocalizedStrings(),Ri=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ce(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Fi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ua(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,C=S.add(b,"month").isAfter(h),I=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Ut(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),j=W(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${We}/transaction_attachment`,analytics:E,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:j.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:I,isZeniUser:d,isNewUser:C,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(nt(i));const d=ht(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Mt(d,!1)),e(Ot({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(nt());const p=ht(s,void 0,l),m=D(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Oe(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Me(i))},onSaveChangesToLocalStore:(i,d,p,m,S)=>{const h=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Wa({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(Ue("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(_t("draft"))},reviewBillDetails:()=>{const i=Vi(s,l),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(Ha()),onClickDismiss:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=$i(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Li(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Ht(s,l,i),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(At(l))},onAttachmentClick:(i,d)=>{const p=Ee(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Ya(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Wn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(za(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Za("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Na(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Oa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(_a("bill_pay","bill_pay_detail")),e(Ma({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(zn);function bt(){const e=J(),t=K(),l=le(),{billId:n,tenantEmailDomain:c}=ee(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(f.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:p}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:m}=r(f.isRecurringBillsFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=r(f.isShaDisabled),{isFeatureEnabled:b}=r(f.isOurDisabled),{isFeatureEnabled:C}=r(f.isBillPayDetectInsufficientFundsEnabled),{configValue:I}=u(He.sameDayAchDisablementConfig),j=La(I),B=V.getSignedInUser(),T=v((O=>W(O))),k=v((O=>_e(O,p,S,n))),$=Wt(T?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:N,onAskAiCfoClick:_}=Xe({mobileExploreReferrer:"Bill Details"});Ye({isDataReady:k.fetchState==="Completed"});const Z=T.companyId??V.getSignedInUserTenant(c)?.companyId,z=fe(),w=$t(z?.loggedInUserRoleMap),M=Lt(z?.loggedInUserRoleMap),L=de(z?.loggedInUserRoleMap),Y=vt(T.userRole);if(g.useEffect((()=>{n!=null&&l(kt(n))}),[n]),g.useEffect((()=>{n!=null&&l(Dt(n))}),[n,l]),B==null)throw Error("Can't access address page without signing in...");const q=v((O=>Ga(O.accountState,O.accountListState,"billPayAccountList"))),U={pathname:"../",search:t.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?a.jsx(Q,{to:U}):k.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:k.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:O=>(te=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&te.trackBillPayEditBill(n,k.isRecurring)})(O)}),a.jsx(Ri,{initialOpenThreadRequest:$??void 0,location:t,navigate:e,currentTenant:T,billId:n,companyId:Z,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:p,isLocalCurrencyEnabled:d,uncategorizedAccounts:q,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isShaDisabled:h,isOurDisabled:b,isRecurringBillsFeatureEnabled:m,hasZeniAccountsAdminAccess:w,isZeniAccountsUser:M,isBillPayAdmin:L,isSuperAdmin:Y,isDetectInsufficientFundsEnabled:C,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:N,onAskAiCfoClick:_})]})}const ht=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Vi=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},$i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",Gi=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?pe(t.whatFor.invoiceDate.toString()):Gt(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(qa)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Pi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ja(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=Ui(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Yn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Ui=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Hn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??he.currencyCode,currencySymbol:o.currency?.currencySymbol??he.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??he.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??he.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},_i=G.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-CgHUgeBY.js";import{h as J,u as le,g as K,i as e
98
98
  align-items: center;
99
99
  background-color: ${e=>e.theme.colors.grey4};
100
100
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
101
- `,Mi=X((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=_e(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(en(s))},onSaveHandler:()=>{e(Qa(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Xa({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??gt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(it())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ka({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??gt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(it())}}}))(qn);function Ni(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),{useFeatureGate:r}=oe(),u=ue(),o=V.getSignedInUser(),s=v((h=>W(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v((h=>ye(h,n))),{isFeatureEnabled:m}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(_i,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Mi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const gt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Oi=G.div`
101
+ `,Mi=X((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=_e(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(en(s))},onSaveHandler:()=>{e(Qa(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Xa({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??gt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(it())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ka({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??gt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(it())}}}))(qn);function Oi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),{useFeatureGate:r}=oe(),u=ue(),o=V.getSignedInUser(),s=v((h=>W(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v((h=>ye(h,n))),{isFeatureEnabled:m}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(_i,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Mi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const gt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Ni=G.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-CgHUgeBY.js";import{h as J,u as le,g as K,i as e
107
107
  align-items: center;
108
108
  background-color: ${e=>e.theme.colors.grey4};
109
109
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
110
- `,Yi=X((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=an(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[nn(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(cn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(sn(s)),p&&e(rn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(ln(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??St();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(on({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??St(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Jn);function zi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),r=le(),u=ue(),o=V.getSignedInUser(),s=v((B=>W(B))),i=H(t.state?.pathnameStackToGoBack),[d,p]=g.useState(!1),m=v((B=>B.vendorViewState.newVendorState.fetchStatus.fetchState)),S=v((B=>n!=null?B.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;g.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,C]=g.useState(!1);g.useEffect((()=>{b||h==="In-Progress"||(C(!0),r(tn(c,n)))}),[b,h,r]);const I=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",j=v((B=>ye(B,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return I==="billDetail"&&j.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:j.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Oi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Yi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:I})]})}const St=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},yt=G.div`
110
+ `,Zi=X((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=an(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[nn(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(cn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(sn(s)),p&&e(rn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(ln(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??St();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(on({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??St(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Jn);function zi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),r=le(),u=ue(),o=V.getSignedInUser(),s=v((B=>W(B))),i=H(t.state?.pathnameStackToGoBack),[d,p]=g.useState(!1),m=v((B=>B.vendorViewState.newVendorState.fetchStatus.fetchState)),S=v((B=>n!=null?B.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;g.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,C]=g.useState(!1);g.useEffect((()=>{b||h==="In-Progress"||(C(!0),r(tn(c,n)))}),[b,h,r]);const I=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",j=v((B=>ye(B,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return I==="billDetail"&&j.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:j.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Ni,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:I})]})}const St=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},yt=G.div`
111
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-CgHUgeBY.js";import{h as J,u as le,g as K,i as e
116
116
  align-items: center;
117
117
  background-color: ${e=>e.theme.colors.grey4};
118
118
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
119
- `,Zi=X((function(e,t){const l=V.getSignedInUser(),n=Ot(e,t.billId),c=un(e),r=Ce(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Ut(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:E,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=D(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},saveBillDetails:(o,s)=>{o&&e(Ct({billId:n,data:s})),e(Ue(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(_t("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(xe(t.billId,"retry"))}}}))(Xn);function ft(){const e=J(),t=le(),l=K(),{billId:n}=ee(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(f.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=V.getSignedInUser(),{isFeatureEnabled:i}=c(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(f.isVendorRecommendationFeatureEnabled),p=H(l.state?.pathnameStackToGoBack),{poppedPathname:m}=p,{isFeatureEnabled:S}=c(f.isRecurringBillsFeatureEnabled),h=v((I=>W(I))),b=v((I=>Ot(I,n))),C=b.fetchState??"Not-Started";if(g.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),g.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),g.useEffect((()=>{const I=b.vendor?.name,j=b.vendor?.id,B=b.totalAmount.amount,T=b.recipientTotalAmount.amount,k=b.invoiceNumber;I&&j&&t(dn(I,j,B,T,k,n))}),[]),m==null)return a.jsx(Q,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return C==="In-Progress"?a.jsx(yt,{windowSize:o,children:a.jsx(Kn,{})}):a.jsx(yt,{windowSize:o,children:a.jsx(Zi,{location:l,navigate:e,currentTenant:h,billId:n,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:S,isDetectInsufficientFundsEnabled:u})})}const Hi=X((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ye(e,"common"),r=l!=null?"edit":"create",u=W(e),o=V.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${zt.fileMicroServiceBaseUrl}`,authParams:i,analytics:E,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(Bn(i))},saveVendorDetailLocalData:i=>{e(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(wn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(lt(u))},updateSelectedVendorForCreate:i=>{e(kn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Ht(s,t.billId,u):ci(s,t.billId,u):p=ri(s,t.billId,u);const m=D(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?In(i,"vendor",u):vn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ke(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(fn({files:i}))},onEditFileName:(i,d)=>{e(yn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(lt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(Sn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(gn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??si(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(hn(i,"BillPayVendor"))},onResendOtp:i=>{e(bn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(mn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(pn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Mt(i,!1))}}}))(ai),we=()=>{const e=J(),t=le(),l=Qn(),n=K(),{billId:c,vendorId:r}=ee(),u=v((b=>W(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(f.isBillPayLocalCurrencyFeatureEnabled),[i,d]=g.useState(!1),p=v((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=v((b=>ye(b,r))),S=v((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return g.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ei,{}):h==="Error"?a.jsx(ti,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(Hi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Wi=X((function(e,t){const{companyId:l}=t;return{billPaySetupView:Cn(e,l),analytics:E,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(An(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(ii),qi=()=>{const e=ni(),t=J(),l=K(),{tenantEmailDomain:n}=ee(),[c,r]=g.useState(!1),u=ue(),o=v((h=>W(h))),s=o.companyId??V.getSignedInUserTenant(n)?.companyId,i=V.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(Q,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(Q,{to:"../../bills/setup"}):p===!1||d!=null&&Oe(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:h=>(b=>b.trackPageLoaded(Zt.Event.billPayPromoPage))(h)}),a.jsx(qt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(Wi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function To(){const e=v((Z=>W(Z))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?zi:Ni,{isFeatureEnabled:o}=c(f.isDebitCardFeatureEnabled),s=Rt(o,e),i=Vt(e),d=K(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Ft(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,C=b&&$t(t?.loggedInUserRoleMap),{isFeatureEnabled:I}=c(f.isChargeCardFeatureEnabled),j=oi(e,I,o)&&!p,B=j&&En(t?.loggedInUserRoleMap),T=Tn(t?.loggedInUserRoleMap),k=Lt(t?.loggedInUserRoleMap),$=jn(t?.loggedInUserRoleMap),O=b&&k,_=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&$,Y=Pn(t?.loggedInUserRoleMap),z=Fn(t?.loggedInUserRoleMap),w=Rn(t?.loggedInUserRoleMap),M=j&&Y,{tenantEmailDomain:L}=ee();return a.jsxs(na,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(qi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{showZeniAccountRoute:O,isUserHasBillPayAccess:z,isUserHasReimbursementAccess:w,showTreasuryRoute:_,isTenantBankingOnly:s,showChargeCardRoute:M,tenantEmailDomain:L??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ei,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../setup"})}),t!=null&&Oe(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(x,{appContent:a.jsx(hi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]})}export{To as default};
119
+ `,Yi=X((function(e,t){const l=V.getSignedInUser(),n=Nt(e,t.billId),c=un(e),r=Ce(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Ut(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:E,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=D(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},saveBillDetails:(o,s)=>{o&&e(Ct({billId:n,data:s})),e(Ue(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(_t("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(xe(t.billId,"retry"))}}}))(Xn);function ft(){const e=J(),t=le(),l=K(),{billId:n}=ee(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(f.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=V.getSignedInUser(),{isFeatureEnabled:i}=c(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(f.isVendorRecommendationFeatureEnabled),p=H(l.state?.pathnameStackToGoBack),{poppedPathname:m}=p,{isFeatureEnabled:S}=c(f.isRecurringBillsFeatureEnabled),h=v((I=>W(I))),b=v((I=>Nt(I,n))),C=b.fetchState??"Not-Started";if(g.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),g.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),g.useEffect((()=>{const I=b.vendor?.name,j=b.vendor?.id,B=b.totalAmount.amount,T=b.recipientTotalAmount.amount,k=b.invoiceNumber;I&&j&&t(dn(I,j,B,T,k,n))}),[]),m==null)return a.jsx(Q,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return C==="In-Progress"?a.jsx(yt,{windowSize:o,children:a.jsx(Kn,{})}):a.jsx(yt,{windowSize:o,children:a.jsx(Yi,{location:l,navigate:e,currentTenant:h,billId:n,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:S,isDetectInsufficientFundsEnabled:u})})}const Hi=X((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=W(e),o=V.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${zt.fileMicroServiceBaseUrl}`,authParams:i,analytics:E,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(Bn(i))},saveVendorDetailLocalData:i=>{e(Ot({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(wn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(lt(u))},updateSelectedVendorForCreate:i=>{e(kn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Ht(s,t.billId,u):ci(s,t.billId,u):p=ri(s,t.billId,u);const m=D(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?In(i,"vendor",u):vn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ke(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(fn({files:i}))},onEditFileName:(i,d)=>{e(yn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(lt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(Sn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(gn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??si(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(hn(i,"BillPayVendor"))},onResendOtp:i=>{e(bn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(mn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(pn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Mt(i,!1))}}}))(ai),we=()=>{const e=J(),t=le(),l=Qn(),n=K(),{billId:c,vendorId:r}=ee(),u=v((b=>W(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(f.isBillPayLocalCurrencyFeatureEnabled),[i,d]=g.useState(!1),p=v((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=v((b=>ye(b,r))),S=v((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return g.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ei,{}):h==="Error"?a.jsx(ti,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(Hi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Wi=X((function(e,t){const{companyId:l}=t;return{billPaySetupView:Cn(e,l),analytics:E,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(An(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(ii),qi=()=>{const e=ni(),t=J(),l=K(),{tenantEmailDomain:n}=ee(),[c,r]=g.useState(!1),u=ue(),o=v((h=>W(h))),s=o.companyId??V.getSignedInUserTenant(n)?.companyId,i=V.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(Q,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(Q,{to:"../../bills/setup"}):p===!1||d!=null&&Ne(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:h=>(b=>b.trackPageLoaded(Yt.Event.billPayPromoPage))(h)}),a.jsx(qt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(Wi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function jo(){const e=v((Y=>W(Y))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?zi:Oi,{isFeatureEnabled:o}=c(f.isDebitCardFeatureEnabled),s=Rt(o,e),i=Vt(e),d=K(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Ft(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,C=b&&$t(t?.loggedInUserRoleMap),{isFeatureEnabled:I}=c(f.isChargeCardFeatureEnabled),j=oi(e,I,o)&&!p,B=j&&En(t?.loggedInUserRoleMap),T=Tn(t?.loggedInUserRoleMap),k=Lt(t?.loggedInUserRoleMap),$=jn(t?.loggedInUserRoleMap),N=b&&k,_=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&$,Z=Pn(t?.loggedInUserRoleMap),z=Fn(t?.loggedInUserRoleMap),w=Rn(t?.loggedInUserRoleMap),M=j&&Z,{tenantEmailDomain:L}=ee();return a.jsxs(na,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(qi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{showZeniAccountRoute:N,isUserHasBillPayAccess:z,isUserHasReimbursementAccess:w,showTreasuryRoute:_,isTenantBankingOnly:s,showChargeCardRoute:M,tenantEmailDomain:L??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ei,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../setup"})}),t!=null&&Ne(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(x,{appContent:a.jsx(hi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]})}export{jo as default};