@zeniai/web-app-ui 5.4.13-prod → 5.4.14-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/assets/{AccountMappingScreen-Bi-qExPt.js → AccountMappingScreen-BZk8jrAP.js} +2 -2
  2. package/dist/assets/ActualMatchingMatchDetailScreen-DdqC6TYo.js +1 -0
  3. package/dist/assets/AddressRoutes-DZnn8xs0.js +1 -0
  4. package/dist/assets/AddressScreen-DpzckL13.js +9 -0
  5. package/dist/assets/AiCfoScreen-BuC0DF7-.js +22 -0
  6. package/dist/assets/{AppDrawer-BLU1xY8w.js → AppDrawer-BnkAekbe.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-BIgsGpG2.js → BillPayApprovalRoutes-2Q-AgKCr.js} +1 -1
  8. package/dist/assets/BillPayRoutes-CV19o_tt.js +119 -0
  9. package/dist/assets/BusinessVerificationPageScreen-NPjj2cPM.js +9 -0
  10. package/dist/assets/CardsAiCfoScreen-CadRu1yE.js +14 -0
  11. package/dist/assets/ChargeCardRoutes-BRNnHx29.js +71 -0
  12. package/dist/assets/CompanyPassportScreen-d_xThxF-.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-B-GQ_uXR.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-Dv-djr6z.js +1 -0
  15. package/dist/assets/CustomerOnboardingRoutes-KQwdDIjg.js +30 -0
  16. package/dist/assets/{DashboardRoutes-Cwz9-Sy1.js → DashboardRoutes-VCRBM_Lo.js} +4 -4
  17. package/dist/assets/{DefaultTenantHome-DuObeLye.js → DefaultTenantHome-Bnjp4uin.js} +1 -1
  18. package/dist/assets/DomesticWireDetailScreen-FhF-Oy51.js +18 -0
  19. package/dist/assets/DrawerScreen-DOVfIfbY.js +1 -0
  20. package/dist/assets/EntityDetailRoutes-BKu8bIme.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-CYc91nC7.js → ExpenseAutomationRoutes-C-dPVJak.js} +6 -6
  22. package/dist/assets/FallBackRoute-BsefzYi4.js +2 -0
  23. package/dist/assets/FeaturePreviewScreen-CEvvSUOY.js +1 -0
  24. package/dist/assets/HubSpotOAuthCallbackScreen-BRLjqcM8.js +1 -0
  25. package/dist/assets/{InboxNotificationsProvider-D9DYV7pO.js → InboxNotificationsProvider-CPjcPE2w.js} +1 -1
  26. package/dist/assets/InvoicingRoutes-Cn0ho2Ac.js +3 -0
  27. package/dist/assets/MagicLinkRoutes-DETheAv8.js +72 -0
  28. package/dist/assets/MagicLinkSignInScreen-hwNEJu9D.js +12 -0
  29. package/dist/assets/MobileAppDrawer-YElMwyTk.js +1 -0
  30. package/dist/assets/NotFoundScreen-DD1ftXbM.js +1 -0
  31. package/dist/assets/NotificationRoutes-j31qfFA3.js +1 -0
  32. package/dist/assets/OAuthConsentScreen-CQV1J_Nj.js +1 -0
  33. package/dist/assets/PandLWithForecastRoutes-CUitXoy8.js +1 -0
  34. package/dist/assets/{PaymentLinkScreen-CCWHfFNq.js → PaymentLinkScreen-B77tcNGP.js} +5 -5
  35. package/dist/assets/PeopleRoutes-BbZuMgKW.js +22 -0
  36. package/dist/assets/PerformanceRoutes-D6iGCdx1.js +1 -0
  37. package/dist/assets/{Preview-BtPyzCV5.js → Preview-DyDyLMFa.js} +1 -1
  38. package/dist/assets/{QBOConnectionScreen-3qvBgt1Y.js → QBOConnectionScreen-DdhMvyre.js} +2 -2
  39. package/dist/assets/ReimbursementApprovalRoutes-lGHZV1sd.js +1 -0
  40. package/dist/assets/ReimbursementApprovalRuleDetailScreen-CtdOG2XT.js +1 -0
  41. package/dist/assets/ReimbursementRoutes-DjGiFO3h.js +68 -0
  42. package/dist/assets/ReportsRoutes-DNhWXb3T.js +1 -0
  43. package/dist/assets/RewardsRoutes-C0czxWPN.js +1 -0
  44. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CkM33AZC.js +33 -0
  45. package/dist/assets/ScreenRoutes-DYGYxgwA.js +2 -0
  46. package/dist/assets/SettingsRoutes-DRSU5I7g.js +49 -0
  47. package/dist/assets/{SetupPagesScreen-Bb_5u-Vc.js → SetupPagesScreen-CfUfKDWM.js} +5 -5
  48. package/dist/assets/SignInScreen-DDQ1e38Q.js +1 -0
  49. package/dist/assets/SignOutScreen-CmYRhks4.js +9 -0
  50. package/dist/assets/TaskListScreen-D8jqZbNF.js +9 -0
  51. package/dist/assets/TaskRoutes-Cu7kReic.js +9 -0
  52. package/dist/assets/TransactionDetailRoutes-B7AzD4hg.js +1 -0
  53. package/dist/assets/TransactionDetailScreen-CpvJY1a3.js +5 -0
  54. package/dist/assets/TransactionListRoutes-BejbKDzL.js +1 -0
  55. package/dist/assets/TreasuryRoutes-DTax48Tc.js +37 -0
  56. package/dist/assets/{VendorsRoutes-BtIdvSJ8.js → VendorsRoutes-DWNg-EPe.js} +20 -20
  57. package/dist/assets/WiseConfirmationScreen-C4KbEpAc.js +12 -0
  58. package/dist/assets/{ZeniAccountRoutes-BdY4DCzs.js → ZeniAccountRoutes-BI00gqox.js} +11 -11
  59. package/dist/assets/ZeniAccountStatementScreen-BUg2sDXI.js +9 -0
  60. package/dist/assets/{accountMappingHelper-mqAKlyM6.js → accountMappingHelper-DPBaxZAX.js} +1 -1
  61. package/dist/assets/{analytics-BCTIyTI2.js → analytics-D_VVN36A.js} +4 -4
  62. package/dist/assets/analyticsHelper-DcUdLdtd.js +1 -0
  63. package/dist/assets/{core-BXs_LseZ.js → core-Cc1CwF93.js} +1 -1
  64. package/dist/assets/{decodeURIComponentSafe-C_xvkxkX.js → decodeURIComponentSafe-BhSMetwg.js} +1 -1
  65. package/dist/assets/{dnd-Da-8Cv7M.js → dnd-AdUHoEcy.js} +1 -1
  66. package/dist/assets/{empty-DU-qdnkd.js → empty-DhAh77JM.js} +1 -1
  67. package/dist/assets/{empty-CP4UL7lL.js → empty-PD8ivveW.js} +1 -1
  68. package/dist/assets/{emptyVideoElement-BZP9pksD.js → emptyVideoElement-BKPO_tn0.js} +1 -1
  69. package/dist/assets/epic-BJGEeb_3.js +2 -0
  70. package/dist/assets/expenseAutomationHelper-CCv2kRkH.js +1 -0
  71. package/dist/assets/getLocaleForTenant-CSUvt8Gt.js +1 -0
  72. package/dist/assets/{index-ByCTERVI.js → index-BJ8vYoNR.js} +1 -1
  73. package/dist/assets/{index-B4YZBFRB.js → index-BJg1S6MG.js} +2 -2
  74. package/dist/assets/{index-D4PB4ylX.js → index-Bp8ijVbG.js} +1 -1
  75. package/dist/assets/{index-B2KwlqiO.js → index-Cxx08j41.js} +1 -1
  76. package/dist/assets/{index-BEJFA-WY.js → index-cHP9lO1h.js} +1 -1
  77. package/dist/assets/index-foi_vl2g.js +1 -0
  78. package/dist/assets/{index-C0L--H5g.js → index-zhmkax0y.js} +1 -1
  79. package/dist/assets/{index-B7Ju9Rj1.js → index-zmOdoQIt.js} +14592 -14592
  80. package/dist/assets/{lexical-BSpayCww.js → lexical-BRekJTpF.js} +1 -1
  81. package/dist/assets/{liveblocks-D6cQIpJt.js → liveblocks-CM1vcHN_.js} +15 -15
  82. package/dist/assets/{lottie-CF7Z74Gc.js → lottie-BXg_FLck.js} +1 -1
  83. package/dist/assets/{mui-CZNXDlL8.js → mui-ehyt9jca.js} +2 -2
  84. package/dist/assets/{pathToGoBack-B7H0ikDH.js → pathToGoBack-jAeSfAQ9.js} +1 -1
  85. package/dist/assets/{pdf-D5OHaPzx.js → pdf-CHwZP-Er.js} +3 -3
  86. package/dist/assets/{pdf-lib-MYA8X-JA.js → pdf-lib-kwPPw7gn.js} +1 -1
  87. package/dist/assets/{plaid-BD2tv3-y.js → plaid-WRjvFkFp.js} +1 -1
  88. package/dist/assets/{pusher-DrsXplF0.js → pusher-C0WLqP6E.js} +1 -1
  89. package/dist/assets/{react-8lNlUbXm.js → react-Bw2LIZU7.js} +1 -1
  90. package/dist/assets/{react-B-NoxRHA.js → react-CQgMB5FX.js} +1 -1
  91. package/dist/assets/{react-BrSUwqBY.js → react-CvCXtyEQ.js} +1 -1
  92. package/dist/assets/{react-DLLmxJGe.js → react-L2WtUuXe.js} +1 -1
  93. package/dist/assets/{react-Bbafl4Gk.js → react-ZP71p6P6.js} +1 -1
  94. package/dist/assets/{react-CN6KARLQ.js → react-miDI-z35.js} +1 -1
  95. package/dist/assets/{recharts-CQ1IP2bc.js → recharts-tLFME7sM.js} +1 -1
  96. package/dist/assets/{reportTimeframe-D-wUbJBc.js → reportTimeframe-DX5pHUc_.js} +1 -1
  97. package/dist/assets/routePaths-RxstHRDw.js +1 -0
  98. package/dist/assets/{sentry-Cg-8xB9l.js → sentry-Bh68thgn.js} +2 -2
  99. package/dist/assets/stripSplatSuffix-B0jus2nC.js +1 -0
  100. package/dist/assets/{url-DV6t-V7o.js → url-BTt3PKLo.js} +1 -1
  101. package/dist/assets/{url-CkEla8bb.js → url-DqRIAQ9M.js} +4 -4
  102. package/dist/assets/useActualMatchingMatchDetail-Dr6cKA7B.js +1 -0
  103. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CC8PIy8S.js +1 -0
  104. package/dist/assets/useAskAiCfoHostNavButtonProps-Bl76c5H-.js +1 -0
  105. package/dist/assets/useChargeCardPusherEvents-C6oeFa4_.js +1 -0
  106. package/dist/assets/{useDeviceId-DK2ueKK5.js → useDeviceId-B4dK-Ywm.js} +1 -1
  107. package/dist/assets/useEmailConnectResultRefresh-nv6tTKw5.js +1 -0
  108. package/dist/assets/useEnsureVendorListLoaded-zh5PaZPv.js +1 -0
  109. package/dist/assets/useInitialThreadRequest-DqCJRXyQ.js +1 -0
  110. package/dist/assets/useTaskManagerAccess-DhT542co.js +1 -0
  111. package/dist/assets/useTaskManagerPusherEvents-B9F1i19u.js +1 -0
  112. package/dist/assets/{utils-BBl15X5w.js → utils-CjDqL2uk.js} +2 -2
  113. package/dist/assets/withTransactionSidePanel-BaaDGWl5.js +25 -0
  114. package/dist/assets/{zeni-epic-state-BtBA3ky4.js → zeni-epic-state-DFhlE0W3.js} +7 -7
  115. package/dist/index.html +1 -1
  116. package/package.json +4 -4
  117. package/dist/assets/ActualMatchingMatchDetailScreen-Cl-Pu0GM.js +0 -1
  118. package/dist/assets/AddressRoutes-CvSYFPDI.js +0 -1
  119. package/dist/assets/AddressScreen-CgdwO8Ra.js +0 -9
  120. package/dist/assets/AiCfoScreen-LIOW6xfk.js +0 -22
  121. package/dist/assets/BillPayRoutes-CLzHR69A.js +0 -119
  122. package/dist/assets/BusinessVerificationPageScreen-BiIaZFT1.js +0 -9
  123. package/dist/assets/CardsAiCfoScreen-3zHmwl94.js +0 -14
  124. package/dist/assets/ChargeCardRoutes-BscWp3vQ.js +0 -71
  125. package/dist/assets/CompanyPassportScreen-BU4vcfRN.js +0 -1
  126. package/dist/assets/ConnectionAuthScreen-k5m8hluF.js +0 -11
  127. package/dist/assets/CustomerOnboardingAuthScreen-CCp1S2vg.js +0 -1
  128. package/dist/assets/CustomerOnboardingRoutes-CUDQvi7S.js +0 -30
  129. package/dist/assets/DomesticWireDetailScreen-gY_r5UI0.js +0 -18
  130. package/dist/assets/DrawerScreen-CRDPpqiu.js +0 -1
  131. package/dist/assets/EntityDetailRoutes-D_ZTGOtD.js +0 -1
  132. package/dist/assets/FeaturePreviewScreen-DfxDuA0M.js +0 -1
  133. package/dist/assets/HubSpotOAuthCallbackScreen-CDDOVadk.js +0 -1
  134. package/dist/assets/InvoicingRoutes-VLqm6UwK.js +0 -3
  135. package/dist/assets/MagicLinkRoutes-BEcrYT1K.js +0 -72
  136. package/dist/assets/MagicLinkSignInScreen-CZgM1fFa.js +0 -12
  137. package/dist/assets/MobileAppDrawer-CLzaVxWw.js +0 -1
  138. package/dist/assets/NotFoundScreen-Dbsd5Y0P.js +0 -1
  139. package/dist/assets/NotificationRoutes-B1ZUALvi.js +0 -1
  140. package/dist/assets/OAuthConsentScreen-DIEPEaLw.js +0 -1
  141. package/dist/assets/PandLWithForecastRoutes-BJaROJH3.js +0 -1
  142. package/dist/assets/PeopleRoutes-C7UEcS-W.js +0 -22
  143. package/dist/assets/PerformanceRoutes-CXeH-dVU.js +0 -1
  144. package/dist/assets/ReimbursementApprovalRoutes-6NGfzK53.js +0 -1
  145. package/dist/assets/ReimbursementApprovalRuleDetailScreen-DnnNSpGE.js +0 -1
  146. package/dist/assets/ReimbursementRoutes-BDvTRTRz.js +0 -68
  147. package/dist/assets/ReportsRoutes-BWly-uDq.js +0 -1
  148. package/dist/assets/RewardsRoutes-u8Ah8kQl.js +0 -1
  149. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CtgiSq3e.js +0 -33
  150. package/dist/assets/ScreenRoutes-DRd1UKTV.js +0 -2
  151. package/dist/assets/SettingsRoutes-jTnj5Tuf.js +0 -49
  152. package/dist/assets/SignInScreen-DIxWq2wC.js +0 -1
  153. package/dist/assets/SignOutScreen-CBlmnP95.js +0 -9
  154. package/dist/assets/TaskListScreen-zclXOysg.js +0 -9
  155. package/dist/assets/TaskRoutes-CHX0Ssug.js +0 -9
  156. package/dist/assets/TransactionDetailRoutes-CKmqJgT2.js +0 -1
  157. package/dist/assets/TransactionDetailScreen-QSUeF4Kl.js +0 -5
  158. package/dist/assets/TransactionListRoutes-BcbMNyjd.js +0 -1
  159. package/dist/assets/TreasuryRoutes-ONBvqP-O.js +0 -37
  160. package/dist/assets/WiseConfirmationScreen-CBTy4wB7.js +0 -12
  161. package/dist/assets/ZeniAccountStatementScreen-CUY9VDQP.js +0 -9
  162. package/dist/assets/analyticsHelper-CPrabsD2.js +0 -1
  163. package/dist/assets/epic-22WM_5RV.js +0 -2
  164. package/dist/assets/expenseAutomationHelper-B6P56jsX.js +0 -1
  165. package/dist/assets/getLocaleForTenant-CmSoXYyo.js +0 -1
  166. package/dist/assets/index-BNs-3q81.js +0 -1
  167. package/dist/assets/routePaths-BAEOqCrA.js +0 -1
  168. package/dist/assets/stripSplatSuffix-L1e_cn9-.js +0 -1
  169. package/dist/assets/useActualMatchingMatchDetail-CFDhlpxq.js +0 -1
  170. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BG_FT67r.js +0 -1
  171. package/dist/assets/useAskAiCfoHostNavButtonProps-DrUccDGT.js +0 -1
  172. package/dist/assets/useChargeCardPusherEvents-DW_wGhHA.js +0 -1
  173. package/dist/assets/useEmailConnectResultRefresh-CfH6hGoU.js +0 -1
  174. package/dist/assets/useEnsureVendorListLoaded-Cn69S1Jq.js +0 -1
  175. package/dist/assets/useInitialThreadRequest-CbKJkiBn.js +0 -1
  176. package/dist/assets/useTaskManagerAccess-B3F_UubP.js +0 -1
  177. package/dist/assets/useTaskManagerPusherEvents-DoQWnrCQ.js +0 -1
  178. package/dist/assets/withTransactionSidePanel-D3kvypOU.js +0 -25
@@ -1,4 +1,4 @@
1
- import{j as R}from"./liveblocks-D6cQIpJt.js";import{a as i}from"./sentry-Cg-8xB9l.js";import{h as H,g as K,u as X,j as A,s as W,l as Y}from"./core-BXs_LseZ.js";import{ag as ee,p as te,d as B,z as ne,q as $,ah as ae,k as ce,O as oe}from"./index-B7Ju9Rj1.js";import{bn as se,fI as ie,gZ as ue,oJ as J,Vv as re,ic as G,gk as le,ow as de,Vw as pe,Vx as ge,Vy as me,ul as Ae,m3 as be,ou as Ie,oq as fe,oF as ye,oB as Se,ie as he,Vz as Ee,VA as ve}from"./zeni-epic-state-BtBA3ky4.js";import{n as we}from"./mui-CZNXDlL8.js";import{M as Ce}from"./MobileAppDrawer-CLzaVxWw.js";import{q as Q}from"./QBOConnectionScreen-3qvBgt1Y.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-mqAKlyM6.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="aefd55e2-515f-4b7a-9d3f-65acfc48df95",n._sentryDebugIdIdentifier="sentry-dbid-aefd55e2-515f-4b7a-9d3f-65acfc48df95")}catch{}})();const r="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},Ve=we.div`
1
+ import{j as U}from"./liveblocks-CM1vcHN_.js";import{a as i}from"./sentry-Bh68thgn.js";import{h as Z,g as H,u as K,j as A,s as W,l as X}from"./core-Cc1CwF93.js";import{az as ee,p as te,b as B,z as ne,D as $,be as ae,e as ce,U as oe}from"./index-zmOdoQIt.js";import{bm as se,fI as ie,gZ as ue,oQ as q,Yy as re,ik as G,gk as le,oD as de,Yz as pe,YA as ge,YB as me,ur as Ae,ma as be,oB as Ie,ox as ye,oM as fe,oI as Se,im as he,YC as Ee,YD as ve}from"./zeni-epic-state-DFhlE0W3.js";import{n as we}from"./mui-ehyt9jca.js";import{M as ze}from"./MobileAppDrawer-YElMwyTk.js";import{q as Q}from"./QBOConnectionScreen-DdhMvyre.js";import{g as h,a as E,m as Ce}from"./accountMappingHelper-DPBaxZAX.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="ccb0d895-3db9-425a-aee9-2e9f3ae0031d",n._sentryDebugIdIdentifier="sentry-dbid-ccb0d895-3db9-425a-aee9-2e9f3ae0031d")}catch{}})();const r="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},xe=we.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as R}from"./liveblocks-D6cQIpJt.js";import{a as i}from"./sentry-Cg-8xB9
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${n=>n.theme.colors.grey4};
9
- `,xe=Y((function(n,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:be(n),isAccountingClassesUpdateInProgress:n.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:Ae(n),isAccountingProjectsUpdateInProgress:(()=>{const u=sessionStorage.getItem(r),a=u===l.pending||u===l.ready;return n.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||a})(),isAutoReviewIncomeWithoutCustomerEnabled:me(n),isAutoReviewIncomeWithoutCustomerUpdateInProgress:n.companyViewState.passportView?.autoReviewIncomeWithoutCustomerUpdateStatus?.fetchState==="In-Progress",isRevenueAutomationEnabled:e.isRevenueAutomationEnabled,isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(n,e){const{navigate:u,location:a,isFiling1099FeatureEnabled:p}=e;return{onAccountMappingChange:s=>{const{uncategorizedAccountSection:d,billsAccountSection:v,reimbursementsAccountSection:w,vendorsAccountSection:C,filing1099Section:z}=s,{incomeAccount:V,expenseAccount:x}=d,{billPayAccount:F}=v,{reimbursementsAccount:c}=w,{prepaidExpensesAccount:T,fixedAssetsAccount:g,accruedExpensesAccount:O}=C,{bankAccount:P,expenseCategory1099:k}=z,M=h(e.accountMappingView.incomeAccountList,V.selectedOption),b=h(e.accountMappingView.expenseAccountList,x.selectedOption),j=h(e.accountMappingView.billPayAccountList,F.selectedOption),I=h(e.accountMappingView.reimbursementsAccountList,c.selectedOption),_=E(e.accountMappingView.prepaidExpensesAccountList,T.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,g.selectedOptions),L=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),f=E(e.accountMappingView.bankAccounts1099FilingAccountList,P.selectedOptions),U=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,k),y={selectedIncomeAccountId:M?.accountId,selectedExpenseAccountId:b?.accountId,selectedBillPayAccountId:j?.accountId,selectedReimbursementsAccountId:I?.accountId,selectedPrepaidExpensesAccountIds:_.map((t=>t.accountId)),selectedFixedAssetsAccountIds:D.map((t=>t.accountId)),selectedAccruedExpensesAccountIds:L.map((t=>t.accountId)),selectedBankAccounts1099FilingAccountIds:f.map((t=>t.accountId)),selectedExpenseAccounts1099FilingAccountIds:U};n(ve({data:y}))},onBackClick:()=>{$(a)===!1?(u("../../dashboard"),n(Ee())):n(G())},onSaveClick:()=>{n(he()),p&&ce.track(oe.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:s=>{n(Se(e.currentTenant.companyId,s))},onAutoReviewIncomeWithoutCustomerToggle:s=>{n(ye(e.currentTenant.companyId,s))},onAccountingProjectsToggle:s=>{const d=sessionStorage.getItem(r);d===l.pending||d===l.ready||n(s?Ie(e.currentTenant.companyId):fe(e.currentTenant.companyId))}}}))(ae),Le=()=>{const n=ee(),e=H(),u=K(),a=X(),{useFeatureGate:p,useDynamicConfig:s}=te(),{isFeatureEnabled:d}=p(B.isFiling1099FeatureEnabled),{isFeatureEnabled:v}=p(B.isScheduledJEAccruedExpensesFeatureEnabled),{isFeatureEnabled:w}=p(B.isRevenueAutomationEnabled),{configValue:C,isDynamicConfigLoading:z}=s("transaction_categorization_config"),V=!z&&C?.capitalization_enabled===!0,x=ne.getSignedInUser(),F=se(x),c=A((t=>ie(t))),{capitalizableAccounts:T,capitalizableAccountOverrides:g,isCapitalizationThresholdSaving:O,currencySymbol:P}=A((t=>{const o=t.tenantState.currentTenantId,m=o!=null?t.tenantState.tenantsById[o]:void 0,S=ue(t.companyState,c.companyId);return{capitalizableAccounts:m?.capitalizableAccounts??null,capitalizableAccountOverrides:m?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),W),k=i.useCallback(((t,o)=>{a(J(c.companyId,t,o))}),[a,c.companyId]),M=i.useCallback((t=>{const o={...g??{}},m=Object.entries(t);for(const[N,q]of m)q===null?delete o[N]:o[N]=q;const[S,Z]=m[0]??[];S!=null&&a(J(c.companyId,S,Z,void 0,Object.keys(o).length>0?o:null))}),[a,c.companyId,g]),b=A((t=>re(t.accountState)),W),j=i.useMemo((()=>{const t={};for(const o of b)o.accountId!=null&&o.accountName!=null&&(t[o.accountId]=o.accountName);return t}),[b]),[I,_]=i.useState(!1),[D,L]=i.useState(!1);i.useEffect((()=>{I===!1&&(a(G()),_(!0))}),[I]);const f=A((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));i.useEffect((()=>{sessionStorage.getItem(r)===l.pending&&(sessionStorage.removeItem(r),a(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[a]),i.useEffect((()=>{sessionStorage.getItem(r)===l.ready&&c?.companyId!=null&&(sessionStorage.removeItem(r),a(de(c.companyId)))}),[c?.companyId,a]),i.useEffect((()=>{f&&c?.tenantEmailDomain!=null&&(sessionStorage.setItem(r,l.pending),a(pe()),Q.init("/connection/auth",c.tenantEmailDomain),Q.handleClick())}),[f,c?.tenantEmailDomain,a]);const U=A((t=>ge(t))),y=t=>{L(t)};return R.jsxs(Ve,{children:[R.jsx(Ce,{isAppContentDrawerOpen:D,handleDrawerToggle:y}),R.jsx(xe,{currentTenant:c,navigate:e,meetingUrl:n("account_mapping"),accountMappingView:U,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:v,isRevenueAutomationEnabled:w,isCapitalizationFeatureEnabled:V,capitalizableAccounts:T,accountNamesById:j,capitalizableAccountOverrides:g,currencySymbol:P,isCapitalizationThresholdSaving:O,onSaveCapitalizationAccountThreshold:k,onSaveCapitalizationAccountThresholds:M,location:u,isSettings:$(u),onClickMenuIcon:()=>y(!0)})]})};export{r as P,Le as U,l as a};
9
+ `,Fe=X((function(n,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:be(n),isAccountingClassesUpdateInProgress:n.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:Ae(n),isAccountingProjectsUpdateInProgress:(()=>{const u=sessionStorage.getItem(r),a=u===l.pending||u===l.ready;return n.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||a})(),isAutoReviewIncomeWithoutCustomerEnabled:me(n),isAutoReviewIncomeWithoutCustomerUpdateInProgress:n.companyViewState.passportView?.autoReviewIncomeWithoutCustomerUpdateStatus?.fetchState==="In-Progress",isRevenueAutomationEnabled:e.isRevenueAutomationEnabled,isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(n,e){const{navigate:u,location:a,isFiling1099FeatureEnabled:p}=e;return{onAccountMappingChange:s=>{const{uncategorizedAccountSection:d,billsAccountSection:v,reimbursementsAccountSection:w,vendorsAccountSection:z,filing1099Section:C}=s,{incomeAccount:x,expenseAccount:F}=d,{billPayAccount:T}=v,{reimbursementsAccount:c}=w,{prepaidExpensesAccount:V,fixedAssetsAccount:g,accruedExpensesAccount:M}=z,{bankAccount:O,expenseCategory1099:P}=C,k=h(e.accountMappingView.incomeAccountList,x.selectedOption),b=h(e.accountMappingView.expenseAccountList,F.selectedOption),_=h(e.accountMappingView.billPayAccountList,T.selectedOption),I=h(e.accountMappingView.reimbursementsAccountList,c.selectedOption),j=E(e.accountMappingView.prepaidExpensesAccountList,V.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,g.selectedOptions),L=E(e.accountMappingView.accruedExpensesAccountList,M.selectedOptions),y=E(e.accountMappingView.bankAccounts1099FilingAccountList,O.selectedOptions),R=Ce(e.accountMappingView.expenseAccounts1099FilingAccountList,P),f={selectedIncomeAccountId:k?.accountId,selectedExpenseAccountId:b?.accountId,selectedBillPayAccountId:_?.accountId,selectedReimbursementsAccountId:I?.accountId,selectedPrepaidExpensesAccountIds:j.map((t=>t.accountId)),selectedFixedAssetsAccountIds:D.map((t=>t.accountId)),selectedAccruedExpensesAccountIds:L.map((t=>t.accountId)),selectedBankAccounts1099FilingAccountIds:y.map((t=>t.accountId)),selectedExpenseAccounts1099FilingAccountIds:R};n(ve({data:f}))},onBackClick:()=>{$(a)===!1?(u("../../dashboard"),n(Ee())):n(G())},onSaveClick:()=>{n(he()),p&&ce.track(oe.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:s=>{n(Se(e.currentTenant.companyId,s))},onAutoReviewIncomeWithoutCustomerToggle:s=>{n(fe(e.currentTenant.companyId,s))},onAccountingProjectsToggle:s=>{const d=sessionStorage.getItem(r);d===l.pending||d===l.ready||n(s?Ie(e.currentTenant.companyId):ye(e.currentTenant.companyId))}}}))(ae),Le=()=>{const n=ee(),e=Z(),u=H(),a=K(),{useFeatureGate:p,useDynamicConfig:s}=te(),{isFeatureEnabled:d}=p(B.isFiling1099FeatureEnabled),{isFeatureEnabled:v}=p(B.isScheduledJEAccruedExpensesFeatureEnabled),{isFeatureEnabled:w}=p(B.isRevenueAutomationEnabled),{configValue:z,isDynamicConfigLoading:C}=s("transaction_categorization_config"),x=!C&&z?.capitalization_enabled===!0,F=ne.getSignedInUser(),T=se(F),c=A((t=>ie(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:g,isCapitalizationThresholdSaving:M,currencySymbol:O}=A((t=>{const o=t.tenantState.currentTenantId,m=o!=null?t.tenantState.tenantsById[o]:void 0,S=ue(t.companyState,c.companyId);return{capitalizableAccounts:m?.capitalizableAccounts??null,capitalizableAccountOverrides:m?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),W),P=i.useCallback(((t,o)=>{a(q(c.companyId,t,o))}),[a,c.companyId]),k=i.useCallback((t=>{const o={...g??{}},m=Object.entries(t);for(const[Y,N]of m)N===null?delete o[Y]:o[Y]=N;const[S,J]=m[0]??[];S!=null&&a(q(c.companyId,S,J,void 0,Object.keys(o).length>0?o:null))}),[a,c.companyId,g]),b=A((t=>re(t.accountState)),W),_=i.useMemo((()=>{const t={};for(const o of b)o.accountId!=null&&o.accountName!=null&&(t[o.accountId]=o.accountName);return t}),[b]),[I,j]=i.useState(!1),[D,L]=i.useState(!1);i.useEffect((()=>{I===!1&&(a(G()),j(!0))}),[I]);const y=A((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));i.useEffect((()=>{sessionStorage.getItem(r)===l.pending&&(sessionStorage.removeItem(r),a(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[a]),i.useEffect((()=>{sessionStorage.getItem(r)===l.ready&&c?.companyId!=null&&(sessionStorage.removeItem(r),a(de(c.companyId)))}),[c?.companyId,a]),i.useEffect((()=>{y&&c?.tenantEmailDomain!=null&&(sessionStorage.setItem(r,l.pending),a(pe()),Q.init("/connection/auth",c.tenantEmailDomain),Q.handleClick())}),[y,c?.tenantEmailDomain,a]);const R=A((t=>ge(t))),f=t=>{L(t)};return U.jsxs(xe,{children:[U.jsx(ze,{isAppContentDrawerOpen:D,handleDrawerToggle:f}),U.jsx(Fe,{currentTenant:c,navigate:e,meetingUrl:n("account_mapping"),accountMappingView:R,isFiling1099FeatureEnabled:d&&T,isAccruedExpensesFeatureEnabled:v,isRevenueAutomationEnabled:w,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:_,capitalizableAccountOverrides:g,currencySymbol:O,isCapitalizationThresholdSaving:M,onSaveCapitalizationAccountThreshold:P,onSaveCapitalizationAccountThresholds:k,location:u,isSettings:$(u),onClickMenuIcon:()=>f(!0)})]})};export{r as P,Le as U,l as a};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-CM1vcHN_.js";import{a as y}from"./sentry-Bh68thgn.js";import{a5 as A,c1 as R}from"./index-zmOdoQIt.js";import"./mui-ehyt9jca.js";import{u as F}from"./useActualMatchingMatchDetail-Dr6cKA7B.js";import b from"./NotFoundScreen-DD1ftXbM.js";import{i as P,h as U,g as w}from"./core-Cc1CwF93.js";import"./zeni-epic-state-DFhlE0W3.js";import"./recharts-tLFME7sM.js";import"./analytics-D_VVN36A.js";import"./plaid-WRjvFkFp.js";import"./dnd-AdUHoEcy.js";import"./stripe-cKAAJElX.js";import"./lottie-BXg_FLck.js";import"./lexical-BRekJTpF.js";import"./pdf-CHwZP-Er.js";import"./utils-CjDqL2uk.js";import"./stripSplatSuffix-B0jus2nC.js";import"./decodeURIComponentSafe-BhSMetwg.js";import"./routePaths-RxstHRDw.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]="5d1e58e7-9d32-481b-a5a9-fbb96cf6d066",t._sentryDebugIdIdentifier="sentry-dbid-5d1e58e7-9d32-481b-a5a9-fbb96cf6d066")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:h,handleUndoReversal:d,handleApproveAndReverse:c,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:f,onRefresh:h,onUndoReversal:d,lastMatchResults:p,lastUndoResults:g})}export{V as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-CM1vcHN_.js";import{A as i}from"./AddressScreen-DpzckL13.js";import s from"./NotFoundScreen-DD1ftXbM.js";import"./sentry-Bh68thgn.js";import{n as d,o as r}from"./core-Cc1CwF93.js";import"./zeni-epic-state-DFhlE0W3.js";import"./recharts-tLFME7sM.js";import"./index-zmOdoQIt.js";import"./mui-ehyt9jca.js";import"./analytics-D_VVN36A.js";import"./plaid-WRjvFkFp.js";import"./dnd-AdUHoEcy.js";import"./stripe-cKAAJElX.js";import"./lottie-BXg_FLck.js";import"./lexical-BRekJTpF.js";import"./pdf-CHwZP-Er.js";import"./utils-CjDqL2uk.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]="759b3caa-23db-47f6-8a7f-f9beb9346558",t._sentryDebugIdIdentifier="sentry-dbid-759b3caa-23db-47f6-8a7f-f9beb9346558")}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-CM1vcHN_.js";import{a as h}from"./sentry-Bh68thgn.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-Cc1CwF93.js";import{a2 as $,z as D,V as L,a8 as K,a9 as U,e as _,U as S,a4 as z,_ as b,a5 as F}from"./index-zmOdoQIt.js";import{a1z as C,iA as N,fI as R,a1a as V,c7 as G,_g as O,mS as q}from"./zeni-epic-state-DFhlE0W3.js";import{u as H,n as J}from"./mui-ehyt9jca.js";import Q from"./NotFoundScreen-DD1ftXbM.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]="2acea80b-03d5-4c66-ad37-78d8a71c2a0e",e._sentryDebugIdIdentifier="sentry-dbid-2acea80b-03d5-4c66-ad37-78d8a71c2a0e")}catch{}})();const W=J.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ `,X=M((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=R(e),t=s.roleMap!=null&&V(s.roleMap),d=i||c==="user_address"||G(l?.userRole??[])||t?void 0:"readonly";if(o==null){const a=O(c,e);return{addressToEdit:a?.addressToCreate,loadingState:a?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=C(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})),_?.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=$(),w=H(),I=D.getSignedInUser(),[p,k]=h.useState(a==null),f=B((m=>a!=null?C(m,a).fetchState:"Not-Started")),x=L();if(I==null)throw Error("Can't access address page without signing in...");const A=m=>m.trackPageLoaded(a!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{p||a==null||(k(!0),d(N(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:w.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:_,onLoad:A}),n.jsx(W,{windowSize:g,children:n.jsx(X,{location:r,navigate:t,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:a,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):n.jsx(Q,{})}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 S}from"./liveblocks-CM1vcHN_.js";import{a}from"./sentry-Bh68thgn.js";import{u as Qt,h as Lt,i as Bt,g as Mt,j as v,l as Ft}from"./core-Cc1CwF93.js";import{ec as Vt,j as $t,q as Nt,ed as Gt,z as qt,a2 as Ht,ee as zt,ef as Wt,eg as Jt,aE as Be,eh as We,ei as Xt,aD as Je,a5 as ge,a9 as ce,e as V,ej as me,ek as Yt,el as Zt,ax as Kt,U as es,w as ts,em as ss,en as as,aj as ns,eo as os,ep as is,eq as rs,er as ls,v as us,aw as Me,es as ds}from"./index-zmOdoQIt.js";import{fH as F,gw as R,UZ as cs,a3l as ms,a3m as Ss,jX as hs,a3n as ps,jU as fs,a3o as Se,jA as X,k1 as Y,jG as Ie,jn as he,jl as gs,k3 as Is,jP as Xe,V5 as Fe,gy as $,gN as Cs,V4 as ks,US as Ve,fI as bs,je as vs,a3p as Es,gb as Ps,jw as ws,js as ys,fJ as pe,gi as xs,a3q as Rs,a3r as Ts,a3s as Os,gx as js,gr as $e,kf as Ne,gt as Ge,gz as As,a3t as qe,k4 as Ds,jp as _s,jJ as Us,j$ as He,jM as Qs,gA as Ls,gB as Bs,gC as Ms,gD as Fs}from"./zeni-epic-state-DFhlE0W3.js";import{D as Vs,n as N,S as $s,v as Ns}from"./mui-ehyt9jca.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-CC8PIy8S.js";import{p as qs}from"./pathToGoBack-jAeSfAQ9.js";import{k as Hs}from"./routePaths-RxstHRDw.js";import{u as zs}from"./useTaskManagerPusherEvents-B9F1i19u.js";import"./recharts-tLFME7sM.js";import"./analytics-D_VVN36A.js";import"./plaid-WRjvFkFp.js";import"./dnd-AdUHoEcy.js";import"./stripe-cKAAJElX.js";import"./lottie-BXg_FLck.js";import"./lexical-BRekJTpF.js";import"./pdf-CHwZP-Er.js";import"./utils-CjDqL2uk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="585a61ba-d1b3-48a0-bac4-328c2f2621db",t._sentryDebugIdIdentifier="sentry-dbid-585a61ba-d1b3-48a0-bac4-328c2f2621db")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ye="chat-response-generated";function Js(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Xs=Ft((function(t,r){const h=F(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=as(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=Os(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ns}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:Y(t).detail,skillDetailError:Y(t).fetchState==="Error",skillDetailLoading:Y(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,O=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:j,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Je(g,E);O!=="answer"?V.trackAICFOChatResponseGenerated(O,G?.question.questionText??"",c.text,E,ds(A,j),c.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Ms({chatSessionId:c.metadata.chat_session_id,responseType:O,fetchState:{fetchState:"Completed",error:void 0}})),t(Fs({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,O,E)=>{n&&Me(t,n,o,i,g,d,O,c,void 0,E)},onFetchSkills:()=>{t(Xe())},onOpenSkill:n=>{t(Ie({macroId:n})),t(Qs({macroId:n}))},onSaveSkill:(n,o)=>{t(He({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";t(He({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{t(Us({macroId:n,version:o}))},onDeleteSkill:n=>{t(_s({macroId:n}))},onSetSkillVisibility:(n,o)=>{t(Ds({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{t(qe())},onRunSkill:(n,o)=>{t($()),t($e()),Me(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,n),t(qe())},updateCurrentInput:n=>{t(Ge(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{t(As(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??qs(1);l(o,{state:{...h.state,pathnameStackToGoBack:n.newStack}}),t(Ge(""))},togglePageView:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const n=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{t(js({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),ka=({isFileUploadEnabled:t})=>{const r=Vt(),{setIsAiCfoOpen:h}=$t(),s=Qt(),d=Lt(),{session_id:l}=Bt(),i=Mt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=a.useState(!1),L=v((e=>F(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),n=v((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),O=v((e=>Ss(e))),[E,j]=a.useState(void 0),[G,A]=a.useState(!1),[Ze,Ce]=a.useState(void 0),Ke=a.useCallback((()=>{Ce(void 0),j(void 0),A(!0)}),[]),et=a.useCallback((e=>{j(e),A(!0)}),[]),tt=a.useCallback((()=>{j(void 0),A(!1)}),[]),st=a.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),j(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),at=a.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{s(P!=null?X({scheduleId:P}):Se())}),[s,P]);const M=ke?.macroId,nt=v((e=>Y(e))),be=M!=null&&M!==""&&nt.fetchState==="Not-Started";a.useEffect((()=>{be&&M!=null&&s(Ie({macroId:M}))}),[s,be,M]);const ot=v((e=>F(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Nt(ot))),T=k?.scheduleId??null,[ve,it]=a.useState(!0);a.useEffect((()=>{T!=null&&s(X({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(X({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=a.useCallback((e=>{Ce(e),j(void 0),A(!0)}),[]),lt=a.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=a.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{n&&s(he())}),[s,n]);const Pe=v((e=>R(e).skills)),Z=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=a.useCallback((e=>{s(Ie({macroId:e}))}),[s]),K=a.useCallback((()=>{s(Xe()),s(Fe())}),[s]),ct=a.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();a.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>F(e))),y=qt.getSignedInUser();a.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ve()),void s(Fe())):(T==null&&s(Se()),s(Ve()),void s($()))),[s,T,g,l]);const ft=Ht(),D=Kt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,Q=w!=null&&w!=="",ee=a.useCallback((e=>{Q&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[Q,d,w]),te=a.useCallback((()=>{Q&&d(`/${w}/ai-cfo/routines`)}),[Q,d,w]),se=a.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&Q&&d(`/${w}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[Q,d,C.sessionId,w]),gt=a.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:zt(k),skillName:k.isAdHoc===!0?void 0:Z.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:K,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[K,te,ee,se,ve,k,C.fetchState,C.runs,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ae=Jt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:K}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),q=i.state,H=q?.aiCfoInitialQuestion,we=!!q?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ne]=a.useState(null),[Et,oe]=a.useState(!1),[Pt,ie]=a.useState(void 0),[wt,re]=a.useState(void 0),ye=a.useRef(!1);a.useEffect((()=>{if(!ye.current&&H!=null&&H!==""){const e=i.state;ne(H),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[H,we,i.state]);const yt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??q?.aiCfoRef,le=xe.get("emailRefId")??q?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);const z=I.uiState.lastContextMessage;a.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ne(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:Oe}=Xt(u),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,je=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),De=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(De,u),Tt=Rt.length===0;a.useEffect((()=>{x||D||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,D,d,i.state]);const Ot=a.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),_e=a.useRef(void 0),Ue=a.useRef(void 0);a.useEffect((()=>{const e=l!==_e.current,m=u!==Ue.current;_e.current=l,Ue.current=u,l!==u&&(!e||l==null||Hs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const jt=a.useMemo((()=>({events:Oe.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[Oe]);a.useEffect((()=>{W!=="In-Progress"&&J&&s(ws())}),[W,J,s]),a.useEffect((()=>{u!=null&&je!=="In-Progress"&&Ae&&y!=null&&(l===u||W==="Completed"&&!J)&&s(ys(u,y.userId))}),[je,W,Ae,J,u,y,l,s]);const ue=y?.userId,At=a.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Qe=a.useCallback((e=>{const m=e!=null&&(e===P||e===T);(n||m)&&s(he()),m&&s(X({scheduleId:e}))}),[s,n,T,P]);zs({events:At,onSubscribed:()=>Qe(P??T),onEvent:(e,m)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const U=de;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);_!=null&&Qe(_.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const Dt=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&D)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:V,onLoad:Le}),ae.drawerElement,S.jsx(Ks,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:Ot,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:V,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ys,{children:[S.jsx(ce,{analytics:V,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),D&&ae.drawerElement,S.jsx(Xs,{answerExportEndPoint:r,...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:De,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Dt,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:D?ae.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:n,routineCanCreate:O,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:Z,routines:o.routines,onRoutineCreate:Ke,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:at,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:w}),p&&D?S.jsx(Vs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ea,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!D?S.jsx(Yt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:_t})}):null]})},ze=N($s)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,Ys=N.div`
6
+ height: 100vh;
7
+ width: 100%;
8
+ `,Zs=N.div`
9
+ height: 100vh;
10
+ width: 100%;
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 0;
14
+ `,Ks=N.div`
15
+ flex: 1;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ `,ea=N(Ns)`
20
+ box-shadow: ${({theme:t})=>t.colors.elevation2};
21
+ color: ${({theme:t})=>t.colors.grey4};
22
+ `;export{ka as default};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-D6cQIpJt.js";import{a as o,R as Ta}from"./sentry-Cg-8xB9l.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-BXs_LseZ.js";import{fI as Ze,UL as xa,UM as Ge,gc as Aa,gy as K,UN as ee,jI as ye,jg as Te,UO as _a,UP as Da,gS as Ma,q7 as Ua,UQ as Fa,UR as $e,gp as Za,US as x,fH as Ga,gw as Ra,UT as Va,UU as Ha,UV as Pa,UW as Be,UX as ja,UY as xe,UZ as La,EH as Na,gq as Oa,h5 as qa,cX as za,U_ as Ya,U$ as Xa,qK as Qa,gb as Wa,ja as Ja,V0 as Ka,V1 as et,wP as at,gr as tt}from"./zeni-epic-state-BtBA3ky4.js";import{w as nt,i as ot,a as st,c as rt,p as it,d as m,e as lt,u as dt,f as ct,r as ut,g as mt,h as Ct,Q as pt,U as ht,j as ft,z as gt,k as P,l as h,m as Ae,n as bt,X as St,o as _e,q as kt,s as De,v as Et,x as wt,y as te,A as ae,B as It,C as vt,D as yt,L as Tt,E as $t,F as Bt,H as xt,J as At}from"./index-B7Ju9Rj1.js";import{u as _t,q as Dt,r as Mt,I as Ut,p as Me,t as Ft,D as Ue,s as ne}from"./mui-CZNXDlL8.js";import{u as Zt}from"./InboxNotificationsProvider-D9DYV7pO.js";import{u as Gt}from"./useTaskManagerAccess-B3F_UubP.js";import{u as Rt}from"./expenseAutomationHelper-B6P56jsX.js";import"./recharts-CQ1IP2bc.js";import"./analytics-BCTIyTI2.js";import"./plaid-BD2tv3-y.js";import"./dnd-Da-8Cv7M.js";import"./stripe-cKAAJElX.js";import"./lottie-CF7Z74Gc.js";import"./lexical-BSpayCww.js";import"./pdf-D5OHaPzx.js";import"./utils-BBl15X5w.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]="5292b4ea-4482-41b2-af69-7458b5b69e1f",a._sentryDebugIdIdentifier="sentry-dbid-5292b4ea-4482-41b2-af69-7458b5b69e1f")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Vt=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,_]=Ta.useState(!1),[k,Re]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[Ve,He]=o.useState(!1),L=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(K()),n(ee()))}),[n,re]),o.useEffect((()=>{n(K()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ze(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:je}=Gt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const J=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(J)}const R=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(R)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Le]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:U}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Xe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Rt();o.useEffect((()=>{M&&I&&U&&!b&&q.fetchState==="Not-Started"&&n(Ua(!0))}),[M,I,U,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Qe=Xe||b,z=r((e=>e.tenantState)),We=r((e=>z.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Je}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Ga(e))),la=r((e=>Ra(e).skillsEnabled)),da=r((e=>Va(e))),Ce=r((e=>Ha(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Pa),[y,X]=o.useState(void 0),Q=Y.uiState.currentChatSessionId,Z=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(Z),{inboxNotifications:W,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Zt(),G=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&Z==="Completed"?(n(Be({chatSessionId:y})),X(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(Z==="Error"&&(n(Be({chatSessionId:y})),X(void 0)))}),[n,t.state,s,Z,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&W!=null){const e=`dashboard_${i.companyId}`;Le(W.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,W]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||G.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,G.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=G;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ge({unreadCount:O},"comments")))}}),[O,G.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Je===!1&&T.push("accounts_payable_aging"),Ke===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),U===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>La(e,T).fetchState)),ke=r((e=>Na(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Xa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Qa({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?We:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:U,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ne,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Ka()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return N?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",Q??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const V=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:V,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,R=At(B)&&B!=="command_center";if(B!=="command_center"&&!R||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),R&&f[i.tenantId]!=null){const V=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${V.month}-${V.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const J=vt(e.type);yt(e.type)?(Q!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${J}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),Q===e&&X(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Re,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Ve?`1px solid ${L.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Ut,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Vt,{className:c.root,children:[d.jsx(Ft,{}),Qe===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ue,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ue,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Ze(_))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ge({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...j})},Pt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
1
+ import{j as d}from"./liveblocks-CM1vcHN_.js";import{a as o,R as Ta}from"./sentry-Bh68thgn.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-Cc1CwF93.js";import{fI as Re,UQ as xa,UR as Ze,gc as Aa,gy as X,US as ee,jP as ye,jn as Te,UT as _a,UU as Da,gS as Ma,qd as Va,UV as Fa,UW as $e,gp as Ra,UX as x,fH as Za,gw as Ga,UY as Ua,UZ as Ha,U_ as Pa,U$ as Be,V0 as ja,V1 as xe,V2 as Na,EM as La,gq as Oa,h5 as qa,cM as za,V3 as Ya,h8 as Qa,qQ as Wa,gb as Ja,jh as Ka,V4 as Xa,V5 as et,wV as at,gr as tt}from"./zeni-epic-state-DFhlE0W3.js";import{w as nt,h as ot,j as st,k as rt,p as it,b as m,m as lt,u as dt,a as ct,f as ut,n as mt,i as Ct,o as pt,q as ht,s as ft,z as gt,e as P,v as h,x as Ae,y as bt,A as St,C as _e,D as kt,E as De,F as Et,H as wt,I as te,J as ae,K as It,M as vt,N as yt,c as Tt,O as $t,Q as Bt,R as xt,S as At}from"./index-zmOdoQIt.js";import{u as _t,q as Dt,r as Mt,I as Vt,p as Me,t as Ft,D as Ve,s as ne}from"./mui-ehyt9jca.js";import{u as Rt}from"./InboxNotificationsProvider-CPjcPE2w.js";import{u as Zt}from"./useTaskManagerAccess-DhT542co.js";import{u as Gt}from"./expenseAutomationHelper-CCv2kRkH.js";import"./recharts-tLFME7sM.js";import"./analytics-D_VVN36A.js";import"./plaid-WRjvFkFp.js";import"./dnd-AdUHoEcy.js";import"./stripe-cKAAJElX.js";import"./lottie-BXg_FLck.js";import"./lexical-BRekJTpF.js";import"./pdf-CHwZP-Er.js";import"./utils-CjDqL2uk.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]="c5b2a0c9-d219-44cc-88de-be607ea2b78f",a._sentryDebugIdIdentifier="sentry-dbid-c5b2a0c9-d219-44cc-88de-be607ea2b78f")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ut=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,_]=Ta.useState(!1),[k,Ge]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[Ue,He]=o.useState(!1),N=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Re(e))),L=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:je}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const K=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(K)}const G=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(G)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Ne]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:V}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Qe=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Gt();o.useEffect((()=>{M&&I&&V&&!b&&q.fetchState==="Not-Started"&&n(Va(!0))}),[M,I,V,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const We=Qe||b,z=r((e=>e.tenantState)),Je=r((e=>z.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Za(e))),la=r((e=>Ga(e).skillsEnabled)),da=r((e=>Ua(e))),Ce=r((e=>Ha(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Pa),[y,Q]=o.useState(void 0),W=Y.uiState.currentChatSessionId,R=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(R),{inboxNotifications:J,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Rt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&R==="Completed"?(n(Be({chatSessionId:y})),Q(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(R==="Error"&&(n(Be({chatSessionId:y})),Q(void 0)))}),[n,t.state,s,R,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&J!=null){const e=`dashboard_${i.companyId}`;Ne(J.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,J]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,D,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Ke===!1&&T.push("accounts_payable_aging"),Xe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),V===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Na(e,T).fetchState)),ke=r((e=>La(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{_(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Qa(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Wa({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?Je:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:V,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Le,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return L?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return L?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",W??null,null),!L)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const U=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:U,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,G=At(B)&&B!=="command_center";if(B!=="command_center"&&!G||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),G&&f[i.tenantId]!=null){const U=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${U.month}-${U.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const K=vt(e.type);yt(e.type)?(W!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${K}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ka(e)),W===e&&Q(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ge,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ja({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Ue?`1px solid ${N.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Vt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ut,{className:c.root,children:[d.jsx(Ft,{}),We===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ve,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ve,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:N.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Re(_))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...j})},Pt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
2
2
  height: 20px;
3
3
  width: 20px;
4
4
  color: ${a=>a.theme.colors.primary};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-D6cQIpJt.js";import{a as d}from"./sentry-Cg-8xB9l.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as x}from"./core-BXs_LseZ.js";import{fI as P,_0 as w,ZJ as R,Ig as E,Ia as K,Ie as A,I3 as Z,ZL as z,I7 as ae,Ii as oe,I6 as J,Il as G,Ih as C}from"./zeni-epic-state-BtBA3ky4.js";import{z as _,w as M,b_ as pe,q as O,bU as H,b$ as le,a5 as Q,c0 as se,c1 as ne}from"./index-B7Ju9Rj1.js";import{u as X}from"./mui-CZNXDlL8.js";import{u as Y}from"./useEnsureVendorListLoaded-Cn69S1Jq.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-DnnNSpGE.js";import ie from"./NotFoundScreen-Dbsd5Y0P.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]="30d04742-c48a-4d53-97bd-51ba749bc272",e._sentryDebugIdIdentifier="sentry-dbid-30d04742-c48a-4d53-97bd-51ba749bc272")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(K(!0,!0,!1)))}),[a,p,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},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(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=H(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));Y();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(K(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},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 m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},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(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=_.getSignedInUser(),n=X(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(J(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=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=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!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}=H(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=_.getSignedInUser(),n=X(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Y(),d.useEffect((()=>{p||(f(!0),l(J(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{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
+ import{j as u}from"./liveblocks-CM1vcHN_.js";import{a as d}from"./sentry-Bh68thgn.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as x}from"./core-Cc1CwF93.js";import{fI as P,Xi as w,W$ as R,Il as E,If as K,Ij as A,I8 as X,X1 as z,Ic as ae,In as oe,Ib as G,Iq as H,Im as C}from"./zeni-epic-state-DFhlE0W3.js";import{z as k,w as J,bh as pe,D as O,b0 as M,bi as le,a8 as Q,bj as se,bk as ne}from"./index-zmOdoQIt.js";import{u as Y}from"./mui-ehyt9jca.js";import{u as Z}from"./useEnsureVendorListLoaded-zh5PaZPv.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-CtdOG2XT.js";import ie from"./NotFoundScreen-DD1ftXbM.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]="5dce9717-27b4-4d9a-98e5-b04706c1d0fa",e._sentryDebugIdIdentifier="sentry-dbid-5dce9717-27b4-4d9a-98e5-b04706c1d0fa")}catch{}})();const _="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(_)&&e(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(K(!0,!0,!1)))}),[a,p,e,o]),k.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 S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${_}`]:[],eventCallback:(r,h,I)=>{r.endsWith(_)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},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(z(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=M(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));Z();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(K(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},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 m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},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(H(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(G(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=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=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H(!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}=M(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=k.getSignedInUser(),n=Y(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Z(),d.useEffect((()=>{p||(f(!0),l(G(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{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};
@@ -0,0 +1,119 @@
1
+ import{j as t}from"./liveblocks-CM1vcHN_.js";import{h as q,u as le,g as K,i as ee,j as v,N as Q,l as Y,q as tt,n as nt,o as y}from"./core-Cc1CwF93.js";import{fI as X,WB as _e,bp as Ia,T8 as it,bn as va,bJ as de,WC as ka,HB as wa,I_ as Re,Ic as ot,bm as Ce,WD as lt,WE as st,c7 as rt,WF as ct,ma as xa,WG as Ba,WH as Ca,Js as Ue,HU as xe,WI as dt,Hp as ea,WJ as ut,Nk as pt,Ht as mt,Hz as Aa,WK as Se,WL as Ge,I$ as Me,HR as Da,WM as bt,WN as ht,J2 as Ne,WO as gt,J8 as St,WP as Ea,ID as aa,II as yt,WQ as ft,WR as ce,WS as Ta,WT as ja,WU as Pa,gZ as It,HZ as Ve,cx as Fa,WV as vt,gk as kt,WW as wt,WX as xt,eq as Ra,ep as Va,WY as Oe,WZ as Bt,W_ as Ct,VH as We,W$ as At,VJ as ie,VI as ze,X0 as Dt,X1 as Et,X2 as Tt,IK as ta,IH as jt,X3 as Pt,X4 as Ft,X5 as Rt,It as Vt,X6 as $t,X7 as Lt,cl as $a,eb as La,ml as _t,bO as Ut,bv as _a,bP as Ua,GF as Gt,X8 as Mt,N7 as Nt,Nd as Ot,CJ as Wt,J0 as zt,Jz as Ht,my as ge,X9 as Zt,Xa as Ga,n0 as Xt,ms as Ma,mN as Na,mM as na,bE as pe,bN as Jt,Xb as qt,Xc as ye,kY as Kt,Xd as ia,Xe as Yt,l0 as Qt,ll as en,JN as an,Xf as tn,mV as nn,JD as on,Xg as oa,JH as ln,JM as sn,JK as rn,JB as cn,Xh as Oa,HK as dn,Xi as un,Xj as pn,gJ as mn,gI as bn,gH as hn,mB as gn,mT as la,n2 as Sn,vc as yn,mK as fn,JF as In,l6 as vn,n7 as kn,Xk as wn,k_ as xn,v3 as Bn,Xl as Cn,Iz as An,bK as Dn,br as En,ha as Tn,ee as jn,ed as Pn,cw as Fn,cD as Rn}from"./zeni-epic-state-DFhlE0W3.js";import{z as V,V as fe,al as He,p as oe,b as f,au as Ze,a8 as se,R as A,a9 as Ae,e as E,aH as Vn,a5 as Z,aj as Xe,v as D,a2 as Ie,aI as sa,aJ as ra,aK as $n,aL as Ln,ag as _n,aM as Un,ac as Wa,G as De,ah as Je,aN as Gn,af as za,aO as Mn,aC as Nn,U as Ha,w as On,aP as Wn,aQ as zn,aR as Hn,aS as Zn,aT as Xn,aU as Jn,aV as qn,aW as Kn,aX as Yn,k as Qn,aY as ei,aZ as ai,a_ as ti,az as ni,a$ as ii,i as oi}from"./index-zmOdoQIt.js";import{u as ue,n as _,S as li}from"./mui-ehyt9jca.js";import{A as ca}from"./AddressScreen-DpzckL13.js";import{g as ne,a as Ee,i as Za,V as qe,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-FhF-Oy51.js";import{a as g}from"./sentry-Bh68thgn.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Bl76c5H-.js";import{u as Xa}from"./useInitialThreadRequest-DqCJRXyQ.js";import{u as di}from"./BusinessVerificationPageScreen-NPjj2cPM.js";import Be from"./NotFoundScreen-DD1ftXbM.js";import{D as ui}from"./DrawerScreen-DOVfIfbY.js";import{M as Ja}from"./MobileAppDrawer-YElMwyTk.js";import{F as qa}from"./FeaturePreviewScreen-CEvvSUOY.js";import{S as Te}from"./SetupPagesScreen-CfUfKDWM.js";import{B as pi}from"./BillPayApprovalRoutes-2Q-AgKCr.js";import{F as mi}from"./FallBackRoute-BsefzYi4.js";import"./recharts-tLFME7sM.js";import"./analytics-D_VVN36A.js";import"./plaid-WRjvFkFp.js";import"./dnd-AdUHoEcy.js";import"./stripe-cKAAJElX.js";import"./lottie-BXg_FLck.js";import"./lexical-BRekJTpF.js";import"./pdf-CHwZP-Er.js";import"./utils-CjDqL2uk.js";import"./routePaths-RxstHRDw.js";import"./InboxNotificationsProvider-CPjcPE2w.js";import"./useTaskManagerAccess-DhT542co.js";import"./analyticsHelper-DcUdLdtd.js";import"./useEnsureVendorListLoaded-zh5PaZPv.js";import"./ReimbursementApprovalRuleDetailScreen-CtdOG2XT.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="03e5c061-3c03-4a56-8e70-2bca02e2619a",e._sentryDebugIdIdentifier="sentry-dbid-03e5c061-3c03-4a56-8e70-2bca02e2619a")}catch{}})();const bi=Y((function(e,a){const l=_e(e,a.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(a.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}=lt(l.billActivities,st(a.currentTenant),n);i=S,d=h}const p=rt(a.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ct(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xa(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Xe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:a.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:a.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,a){const{billId:l,currentTenant:n,location:c,navigate:r}=a,{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(Aa(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(mt(l,s))},onSaveRealTimeApprovals:o=>{e(pt(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ut({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(ea(l,o.type,"")):e(ea(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=Z(a.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(dt({billId:a.billId}))},onRefundPaymentClick:()=>{e(xe(a.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ca({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Ba({billId:l}))}}}))(Vn);function hi(){const e=q(),a=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>X(U))),s=v((U=>_e(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Xa(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&Ia(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:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:W}=$(Ze.zeniAssistConfig),z=it(o),w=va(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=W.user_ids!=null&&r?.userId!=null&&W.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||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&&a(ka(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),a(wa(n??"",O,L,!1)))}),[b,s,n,a]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),a(Re(!1,O,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&a(ot()))}),[I,s,n,a,O,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?t.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?t.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[t.jsx(Ae,{analytics:E,onLoad:U=>(N=>{n!=null&&N.trackBillPayBillDetails(n,s.isRecurring)})(U)}),t.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,da=De.getLocalizedStrings().common,gi={containerWidth:new Wa(100,58)},ua=Y((function(e,a){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=a.showActionButtons,u=r&&a.file==null;return{uploadInvoiceEndPoint:`${za.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:a.billId,file:a.file,showAutofill:a.showAutofill,analytics:E,entityId:a.billId,showTitlebarIcon:r,showTitlebar:r&&a?.file!=null,uploadStatus:a.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...a.showAutofill?{}:{backgroundColor:a.backgroundColor,paddingBottom:"128px"}}}}),(function(e,a){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(a.file!=null||a.billId!=null||a.isInitialEdit?(a.setPayload(n),a.setShowConfirmationPopup(!0)):e(Ne(n,a.isVendorRecommendationEnabled,a.billId)))},updateInvoiceUploadFetchState:n=>{e(St({fetchState:{fetchState:n,error:void 0},billId:a.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(gt({billId:a.billId})),E?.trackInvoiceActionClick(a.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const a=le(),l=q(),{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(Ze.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>X(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[O,G]=g.useState(!1),[W,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let M=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(M=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&a(Me(!0))}),[n,a]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),a(wa(n,S,I,!1)),a(Da(n)),k||($(!0),a(Re(!1,S,I,b,n)))),u&&!k&&($(!0),a(Re(!1,S,I,b,n)))}),[B,k,u,n,a,S,I,b]);const N={onOkClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),a(ht({replaceBillData:!0,billId:n})),a(Ne(W,m,n))},onCancelClick:()=>{if(G(!1),!W)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),a(bt({file:W,billId:n}))}},ae=g.useCallback((()=>{const P=Z(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);a(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,a,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||J.fetchState==="Error")return t.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[t.jsx(ma,{}),t.jsx(Pe,{}),t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:!0})})]})}):t.jsxs(je,{windowSize:o,children:[o==="small"||H?null:t.jsx(pa,{children:t.jsx(Ka,{onClick:ae,"data-testid":"nav-bar-back-click"})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx($n,{}),t.jsx(Fe,{windowSize:o,children:t.jsx(ra,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return t.jsx(sa,{fallback:ae,children:t.jsxs(je,{windowSize:o,children:[H&&o!=="small"?t.jsx(ma,{}):null,O?t.jsx(Ln,{titleComponent:t.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:t.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:da.yes,secondaryButtonText:da.no,action:N,isEditPopup:!0}):null,o==="small"||H?null:t.jsx(pa,{children:t.jsx(Si,{})}),o!=="small"?t.jsx(Pe,{}):null,t.jsx(ua,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),t.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return t.jsx(Ka,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,a,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=a.transactionDetails?.recurringBillInstance,c=a.recurringBillConfigDetail?.totalPaymentCycles),a?.isRecurring===!0?t.jsxs(Ii,{children:[t.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
2
+ ${n}/${c}`}),t.jsx(ki,{})]}):void 0}function fi(e,a){const l=a.billActivities?.[0],n=a.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(a.billStage==="draft"||n)}const pa=_.div`
3
+ margin-bottom: 20px;
4
+ margin-top: 20px;
5
+ margin-left: ${A.sp5};
6
+ position: absolute;
7
+ display: flex;
8
+ align-items: center;
9
+ `,Ii=_.div`
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ padding-top: 9px;
14
+ gap: ${A.sp2};
15
+ margin-bottom: -${A.sp2};
16
+ `,vi=_(Je.StandardMedium)``,ki=_((e=>g.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},g.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
17
+ color: ${e=>e.theme.colors.hero};
18
+ height: ${A.sp3};
19
+ width: ${A.sp3};
20
+ `,Ka=_((e=>g.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},g.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))))`
21
+ width: ${A.sp3};
22
+ height: ${A.sp3};
23
+ cursor: pointer;
24
+ color: ${e=>e.theme.colors.champion};
25
+ &:hover {
26
+ color: ${e=>e.theme.colors.primary};
27
+ }
28
+ `,je=_.div`
29
+ display: flex;
30
+ height: 100vh;
31
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
32
+ background-color: ${e=>e.theme.colors.grey4};
33
+ position: relative;
34
+ &::after {
35
+ content: "";
36
+ position: absolute;
37
+ top: 57px;
38
+ left: 42%;
39
+ width: 1px;
40
+ height: calc(100% - 57px);
41
+ background-color: ${e=>e.theme.colors.grey2};
42
+ pointer-events: none;
43
+ z-index: 3;
44
+ display: ${e=>e.windowSize==="small"?"none":"block"};
45
+ }
46
+ `,Pe=_.div`
47
+ position: absolute;
48
+ top: 56px;
49
+ left: 0;
50
+ width: 42%;
51
+ height: 1px;
52
+ background-color: ${e=>e.theme.colors.grey2};
53
+ z-index: 3;
54
+ `,ma=_.div`
55
+ position: fixed;
56
+ top: 0;
57
+ left: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ background-color: ${_n.overlayBackgroundBlack};
61
+ z-index: 5;
62
+ `,Fe=_.div`
63
+ display: flex;
64
+ flex-direction: column;
65
+ width: ${e=>`${gi.containerWidth.value(e.windowSize)}%`};
66
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
+ `,wi=_(Je.H6Regular)`
68
+ margin-top: ${A.sp7};
69
+ padding-left: ${A.sp8};
70
+ padding-right: ${A.sp8};
71
+ color: ${e=>e.theme.colors.primary};
72
+ word-break: break-word;
73
+ `,xi=_(Je.LargeRegularSp)`
74
+ color: ${e=>e.theme.colors.hero};
75
+ padding-left: ${A.sp8};
76
+ padding-right: ${A.sp8};
77
+ margin-bottom: 30px;
78
+ margin-top: ${A.sp4};
79
+ white-space: pre-line;
80
+ `,Bi=Y((function(e,a){return{billsReviewView:Ea(e),analytics:a.analytics}}),(function(e,a){return{onCloseOverlay:()=>{a.navigate(`/${a.tenantEmailDomain}/bills`),e(ce())},onCloseReviewItem:l=>{e(ft(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(yt());break;case"approve":case"review":e(aa("approved",n??""));break;case"reject":e(aa("rejected",n??""))}}}}))(Mn);function Ci({tenantEmailDomain:e}){const a=q(),l=v((c=>c.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:n}=v((c=>Ea(c)));return g.useEffect((()=>{l!=="Completed"&&n.length!==0||a(`/${e}/bills`)}),[l,n.length,e]),t.jsx(Bi,{navigate:a,analytics:E,tenantEmailDomain:e})}const te=Ct(),Ya="bulk-operation-update",Le="bill-approval-rule-update",{common:ke}=De.getLocalizedStrings(),Ai=_.div`
81
+ display: flex;
82
+ min-height: 100%;
83
+ width: 100%;
84
+ flex: 1 1 auto;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ background-color: ${e=>e.theme.colors.grey4};
88
+ `,Di=Y((function(e,a){const l=V.getSignedInUser(),n=Ce(l),c=Pa(e,te,a.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;a.isUserHasOnlyBillpayAccess&&a.roleMap&&c.currentTab==="pending_approval"&&(a.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):a.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),a.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=We(e,"common"),s=e.tenantState.currentTenantId,i=X(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=At(e);return{transactionList:a.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:te,spendManagementEndPoint:`${Xe}/spendManagement`,isShowDeletedBillsEnabled:a.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:a.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,a){const{navigate:l,currentTenant:n,location:c,period:r}=a,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Ta(o))},onSubtabChange:o=>{e(ce()),e(ja(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}=a.currentTenant;E?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e($t(o))},onReloadTransactions:()=>{e(Ve(r,!0,a.isShowDeletedBillsEnabled,a.isInternationalWireEnabled)),e(Vt(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Rt({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(Ft({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Pt(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(jt(o,s??""));break;case"send_for_approval":e(ta("send_for_approval")),a.navigate("./bulk-review");break;case"approve":e(ta("approve")),a.navigate("./bulk-review");break;case"review":e(Tt()),a.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Le)&&e(Et(!1))},onEventReceived:o=>{o===Ya&&e(Dt())},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(Wn));function Ei(){const e=q(),a=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=g.useState(!1),[s,i]=g.useState(null),d=tt("/:tenantEmailDomain/bills/bulk-review")!=null;g.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(a(Ta(c?.tab)),a(ja(c?.subTab))),()=>{a(ce())})),[]);const p=V.getSignedInUser(),m=v((F=>X(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=>Pa(F,te,B,p?.userId))),{isFeatureEnabled:O}=C(f.isDebitCardFeatureEnabled),G=$.fetchState,{isAiCfoAccessEnabled:W,onAskAiCfoClick:z}=Ye({mobileExploreReferrer:"Bills List"});He({isDataReady:G==="Completed"});const w=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,M=!!m.companyBillPayInfo?.info?.isBillPayEnabled,L=v((F=>It(F.companyState,m.companyId))),H=L?.company.featuresActivationInfo.connectedAccountProvider;if(g.useEffect((()=>{!h&&M&&S&&(b(!0),a(Ve(te,!0,I,T)))}),[h,te,S,a]),p==null)throw Error("Can't access address page without signing in...");const J=(F,re)=>{a(Bt({uiState:{sortKey:F,sortOrder:re},period:te}))},U=Fa(r?.loggedInUserRoleMap),N=de(r?.loggedInUserRoleMap),ae=F=>{o(F)},{billsProcessed:P,billsProcessing:ve}=v((F=>vt(F)));g.useEffect((()=>{P===ve&&s!=null&&(a(kt({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:wt(s)}]})),a(xt()),setTimeout((()=>{a(Ve(te,!0,I,!0,T))}),3e3),i(null))}),[P,ve]);const Qa={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Ya}`,`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))}},et=Ra(O,m),at=Va(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?et===!0||at===!0?t.jsx(qa,{}):M?t.jsxs(t.Fragment,{children:[G==="Completed"?t.jsx(Ae,{analytics:E,onLoad:F=>(re=>re.trackPageLoaded(Ha.Event.billPayHome))(F)}):null,t.jsxs(Ai,{windowSize:n,children:[t.jsx(Ja,{isAppContentDrawerOpen:u,handleDrawerToggle:ae}),t.jsx(ui,{isOpen:d,drawerLeftMargin:new Wa(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),a(ce())},children:t.jsx(ji,{onClick:F=>F.stopPropagation(),children:t.jsx(Ci,{tenantEmailDomain:m.tenantEmailDomain})})}),t.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",period:te,isAdmin:!1,uiState:$.uiState,onColumnSortConfigChanged:J,isUserHasOnlyBillpayAccess:U,isShowDeletedBillsEnabled:I,isShowDeletedReimbursementEnabled:j,isBulkActionEnabled:B,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ae(!0)},isDownloadEnabled:$.isDownloadEnabled,connectedAccountProvider:H,bulkSubmissionLimit:$.billBulkSubmissionLimit,bulkSubmissionFetchState:$.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:$.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:T,isDetectInsufficientFundsEnabled:k,isAiCfoAccessEnabled:W,onAskAiCfoClick:z,...Qa})]})]}):w===!0&&N===!0?t.jsx(Q,{to:"../setup"}):r!=null&&Oe(m,r.loggedInUserRoleMap)?t.jsx(Q,{to:"../promo"}):t.jsx(se,{fetchState:G}):t.jsx(Be,{})}const Ti=e=>`/${e}/bills/setup`,ji=_(li)`
89
+ display: flex;
90
+ min-height: 100%;
91
+ flex-direction: column;
92
+ `,{common:{currency:he},spendManagement:{billPay:{billDetails:Pi}},appName:Fi}=De.getLocalizedStrings(),Ri=Y((function(e,a){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=Z(a.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=We(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ce(l);a.billId!=null&&a.billDetailsView!=null&&(i=`${a.billDetailsView.createdBy?.firstName??Fi} ${a.billDetailsView.createdBy?.lastName??""}`),d||!a.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=a.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ut(a.billDetailsView.paymentDetailsSection?.paymentType?.method),S=a.currentTenant.createTime,h=_a(),b=a.sameDayAchDisablementConfig.newTenantTenureLimitMonths,C=S.add(b,"month").isAfter(h),I=!!(a.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Ua(p,a.billDetailsView.approvalRules.allApprovalRules,l,a.billDetailsView.vendor?.id,a.billDetailsView.classId),j=X(e);return{billDetails:a.billDetailsView,isAccountingClassesEnabled:xa(e),billId:a.billId,createdBy:i,createTime:a.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${Xe}/transaction_attachment`,analytics:E,showBackButton:u,isAdmin:a.isBillPayAdmin,isSuperAdmin:a.isSuperAdmin,connectedAccountProvider:j.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:I,isZeniUser:d,isNewUser:C,sameDayAchDisablementConfig:a.sameDayAchDisablementConfig}}),(function(e,a){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=a,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(na(i));const d=ha(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??a.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ma(d,!1)),e(Na({localData:{vendorName:i??a.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(na());const p=ha(s,void 0,l),m=D(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,a.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Me(i))},onSaveChangesToLocalStore:(i,d,p,m,S)=>{const h=_i(a.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,a.isInternationalPaymentShaVsOurEnabled,m,a.vendor);e(Xt({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(Ue("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Ga("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(Zt()),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=Za(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:()=>{a.navigate("../")},deleteBill:()=>{l!=null&&e(Aa(l))},onAttachmentClick:(i,d)=>{const p=Ee(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=Z(a.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(Ht(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Xn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(zt(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Wt("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Ot(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Nt(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Gt("bill_pay","bill_pay_detail")),e(Mt({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(zn);function ba(){const e=q(),a=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(Ze.sameDayAchDisablementConfig),j=Lt(I),B=V.getSignedInUser(),T=v((N=>X(N))),k=v((N=>Ge(N,p,S,n))),$=Xa(T?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:O,onAskAiCfoClick:G}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:k.fetchState==="Completed"});const W=T.companyId??V.getSignedInUserTenant(c)?.companyId,z=fe(),w=$a(z?.loggedInUserRoleMap),M=La(z?.loggedInUserRoleMap),L=de(z?.loggedInUserRoleMap),H=va(T.userRole);if(g.useEffect((()=>{n!=null&&l(ka(n))}),[n]),g.useEffect((()=>{n!=null&&l(Da(n))}),[n,l]),B==null)throw Error("Can't access address page without signing in...");const J=v((N=>_t(N.accountState,N.accountListState,"billPayAccountList"))),U={pathname:"../",search:a.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?t.jsx(Q,{to:U}):k.deleteStatus.fetchState==="In-Progress"||s?t.jsx(se,{fetchState:k.deleteStatus.fetchState}):t.jsxs(t.Fragment,{children:[t.jsx(Ae,{analytics:E,onLoad:N=>(ae=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&ae.trackBillPayEditBill(n,k.isRecurring)})(N)}),t.jsx(Ri,{initialOpenThreadRequest:$??void 0,location:a,navigate:e,currentTenant:T,billId:n,companyId:W,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:p,isLocalCurrencyEnabled:d,uncategorizedAccounts:J,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isShaDisabled:h,isOurDisabled:b,isRecurringBillsFeatureEnabled:m,hasZeniAccountsAdminAccess:w,isZeniAccountsUser:M,isBillPayAdmin:L,isSuperAdmin:H,isDetectInsufficientFundsEnabled:C,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:O,onAskAiCfoClick:G})]})}const ha=(e,a,l)=>{let n=`/${e}/bill/`;return l==null?n=a!=null?n.concat(`new/vendor/${encodeURIComponent(a)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=a!=null?n.concat(`${encodeURIComponent(a)}/edit`):n.concat("create")),n},Vi=(e,a)=>{let l=`/${e}/bill/`;return l=a===void 0?l.concat("new/review"):l.concat(`${a}/edit/review`),l},$i=(e,a,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(a)}/edit/ach`),n},Li=(e,a,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(a)}/edit/domestic`),n},R="paymentDetails",_i=(e,a,l,n,c,r,u)=>{const o={invoiceNumber:a.whatFor.invoiceNumber,memo:a.whatFor.memo,invoiceDate:a.whatFor.invoiceDate?pe(a.whatFor.invoiceDate.toString()):_a(),billDueDate:a.whatFor.billDueDate?pe(a.whatFor.billDueDate.toString()):void 0,currencyCode:a.whatFor.currency,recipientCurrencyCode:a.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:a.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:a[R]?.paymentDate?pe(a[R].paymentDate.toString()):void 0,paymentType:a[R]?.paymentType!=null?a[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===a[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:a[R]?.paymentType?.method!=null&&a[R].paymentType.method.includes(Jt)&&u?.vendorCurrencyCode===he.currencyCode&&c?a[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=a[R]?.recurringPaymentType?.selectedOption===Pi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:a[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:qt(a[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:a[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(a[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:a[R]?.recurringPaymentDetails?.startDate?pe(a[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:a[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:a[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:a[R]?.recurringPaymentDetails?.updateRecurringBills},S=Ui(e.accountList.accounts,e.classList.classes,e.lineDetailSection,a.lineItems,n,l),h=Object.keys(S).length>0?Hn(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,a,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=a.find((p=>p.classId===o.class.selectedOption)));const d=Zn(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},Gi=_.div`
93
+ display: flex;
94
+ height: 100vh;
95
+ width: 100%;
96
+ flex: 1 1 auto;
97
+ flex-direction: column;
98
+ align-items: center;
99
+ background-color: ${e=>e.theme.colors.grey4};
100
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
101
+ `,Mi=Y((function(e,a){const{vendorId:l,billId:n}=a,c=ye(e,l),r=Ge(e,a.isVendorRecommendationEnabled,a.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:a.bankAccountContext}}),(function(e,a){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=a,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(en(s))},onSaveHandler:()=>{e(Qt(a.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Yt({data:i}))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ga();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ia())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Kt({fetchState:"Not-Started"}));const s=Z(a.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ga(0);a.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ia())}}}))(Jn);function Ni(){const e=q(),a=K(),l=Ie(),{vendorId:n,billId:c}=ee(),{useFeatureGate:r}=oe(),u=ue(),o=V.getSignedInUser(),s=v((h=>X(h))),i=Z(a.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"?t.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):t.jsxs(Gi,{windowSize:l,children:[t.jsx(qe,{vendorId:n,billId:c}),t.jsx(Mi,{location:a,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const ga=(e=2)=>{let a="../";for(let l=0;l<e;l++)a=`${a}../`;return a},Oi=_.div`
102
+ display: flex;
103
+ height: 100vh;
104
+ width: 100%;
105
+ flex: 1 1 auto;
106
+ flex-direction: column;
107
+ align-items: center;
108
+ background-color: ${e=>e.theme.colors.grey4};
109
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
110
+ `,Wi=Y((function(e,a){const{vendorId:l}=a,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=tn(e,c||"international_business",a.billId),u=n.editVendorState??n.newVendorState,o=a.billId!=null?e.editBillDetailViewState.editBillStateById[nn(a.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:a.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,a){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=a,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(cn(a.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=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??Sa();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(oa())},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=Z(a.location.state?.pathnameStackToGoBack),i=s.poppedPathname??Sa(0);a.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(oa())}}}))(qn);function zi(){const e=q(),a=K(),l=Ie(),{vendorId:n,billId:c}=ee(),r=le(),u=ue(),o=V.getSignedInUser(),s=v((B=>X(B))),i=Z(a.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(an(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"?t.jsx(se,{fetchState:j.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):t.jsxs(Oi,{windowSize:l,children:[t.jsx(qe,{vendorId:n,billId:c}),t.jsx(Wi,{location:a,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:I})]})}const Sa=(e=2)=>{let a="../";for(let l=0;l<e;l++)a=`${a}../`;return a},ya=_.div`
111
+ display: flex;
112
+ height: 100vh;
113
+ width: 100%;
114
+ flex: 1 1 auto;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ background-color: ${e=>e.theme.colors.grey4};
118
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
119
+ `,Hi=Y((function(e,a){const l=V.getSignedInUser(),n=Oa(e,a.billId),c=un(e),r=Ce(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Ua(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:a.billId,billpayApprovalView:c,analytics:E,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,a){const{location:l,billId:n,currentTenant:c,navigate:r}=a,{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(Ca({billId:n,data:s})),e(Ue(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Ba({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Ga("pending_approval"))},onClickEdit:()=>{a.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{a.billId!=null&&e(xe(a.billId,"retry"))}}}))(Yn);function fa(){const e=q(),a=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=Z(l.state?.pathnameStackToGoBack),{poppedPathname:m}=p,{isFeatureEnabled:S}=c(f.isRecurringBillsFeatureEnabled),h=v((I=>X(I))),b=v((I=>Oa(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&&a(dn(I,j,B,T,k,n))}),[]),m==null)return t.jsx(Q,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return C==="In-Progress"?t.jsx(ya,{windowSize:o,children:t.jsx(Kn,{})}):t.jsx(ya,{windowSize:o,children:t.jsx(Hi,{location:l,navigate:e,currentTenant:h,billId:n,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:S,isDetectInsufficientFundsEnabled:u})})}const Zi=Y((function(e,a){const{vendorId:l}=a,n=e.entityAutoCompleteState.autoCompleteText.common,c=We(e,"common"),r=l!=null?"edit":"create",u=X(e),o=V.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:a.vendorViewDetails,screenType:r,filesEndPoint:`${za.fileMicroServiceBaseUrl}`,authParams:i,analytics:E,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,a){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=a,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,a.billId)),i!=null&&e(Bn(i))},saveVendorDetailLocalData:i=>{e(Na({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(wn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(la(u))},updateSelectedVendorForCreate:i=>{e(kn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Za(s,a.billId,u):ci(s,a.billId,u):p=ri(s,a.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(la(a.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=Z(a.location.state?.pathnameStackToGoBack),d=i.poppedPathname??si(n.tenantEmailDomain,a.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(Ma(i,!1))}}}))(ti),we=()=>{const e=q(),a=le(),l=Qn(),n=K(),{billId:c,vendorId:r}=ee(),u=v((b=>X(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&&(a(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?t.jsx(ei,{}):h==="Error"?t.jsx(ai,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):t.jsxs(t.Fragment,{children:[t.jsx(qe,{vendorId:r,billId:c}),t.jsx(Zi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Xi=Y((function(e,a){const{companyId:l}=a;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,a){const{companyId:l,navigate:n}=a;return{onButtonClick:()=>{e(An(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(ii),Ji=()=>{const e=ni(),a=q(),l=K(),{tenantEmailDomain:n}=ee(),[c,r]=g.useState(!1),u=ue(),o=v((h=>X(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?t.jsx(Q,{to:"../../../bills"}):p===!0&&m===!0?t.jsx(Q,{to:"../../bills/setup"}):p===!1||d!=null&&Oe(o,d.loggedInUserRoleMap)?t.jsxs(t.Fragment,{children:[t.jsx(Ae,{analytics:E,onLoad:h=>(b=>b.trackPageLoaded(Ha.Event.billPayPromoPage))(h)}),t.jsx(Ja,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),t.jsx(Xi,{companyId:s,navigate:a,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):t.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function To(){const e=v((H=>X(H))),a=fe(),l=de(a?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?zi:Ni,{isFeatureEnabled:o}=c(f.isDebitCardFeatureEnabled),s=Ra(o,e),i=Va(e),d=K(),p=e?.userRole!=null&&Ia(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(a?.loggedInUserRoleMap),S=Fa(a?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(a?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,C=b&&$a(a?.loggedInUserRoleMap),{isFeatureEnabled:I}=c(f.isChargeCardFeatureEnabled),j=oi(e,I,o)&&!p,B=j&&En(a?.loggedInUserRoleMap),T=Tn(a?.loggedInUserRoleMap),k=La(a?.loggedInUserRoleMap),$=jn(a?.loggedInUserRoleMap),O=b&&k,G=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&$,W=Pn(a?.loggedInUserRoleMap),z=Fn(a?.loggedInUserRoleMap),w=Rn(a?.loggedInUserRoleMap),M=j&&W,{tenantEmailDomain:L}=ee();return t.jsxs(nt,{children:[d.pathname.includes("/bills")?t.jsxs(t.Fragment,{children:[t.jsx(y,{path:"setup",element:t.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"setup"})}),t.jsx(y,{path:"verification",element:t.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"verification"})}),t.jsx(y,{path:"promo",element:t.jsx(Ji,{})}),t.jsx(y,{path:"approval-rules/*",element:m?t.jsx(pi,{}):t.jsx(mi,{showZeniAccountRoute:O,isUserHasBillPayAccess:z,isUserHasReimbursementAccess:w,showTreasuryRoute:G,isTenantBankingOnly:s,showChargeCardRoute:M,tenantEmailDomain:L??""})}),t.jsx(y,{path:"international-wire",element:t.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&&t.jsx(y,{path:"*",element:t.jsx(Ei,{})}),(s===!0||i===!0)&&t.jsx(y,{path:"/*",element:t.jsx(qa,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&t.jsx(y,{path:"*",element:t.jsx(Q,{to:"../setup"})}),a!=null&&Oe(e,a.loggedInUserRoleMap)&&t.jsx(y,{path:"*",element:t.jsx(Q,{to:"../promo"})})]}):d.pathname.includes("/bill")?t.jsxs(t.Fragment,{children:[t.jsx(y,{path:"new",element:t.jsx(x,{appContent:t.jsx(ba,{})})}),t.jsx(y,{path:":billId",element:t.jsx(x,{appContent:t.jsx(hi,{})})}),t.jsx(y,{path:":billId/edit",element:t.jsx(x,{appContent:t.jsx(ba,{})})}),t.jsx(y,{path:"new/review",element:t.jsx(x,{appContent:t.jsx(fa,{})})}),t.jsx(y,{path:":billId/edit/review",element:t.jsx(x,{appContent:t.jsx(fa,{})})}),t.jsx(y,{path:"/:billId/:addressType",element:t.jsx(x,{appContent:t.jsx(ca,{isSubPage:!0})})}),t.jsx(y,{path:"/new/:addressType",element:t.jsx(x,{appContent:t.jsx(ca,{isSubPage:!0})})}),t.jsx(y,{path:"new/vendor/create",element:t.jsx(x,{appContent:t.jsx(we,{})})}),t.jsx(y,{path:"new/vendor/:vendorId/edit",element:t.jsx(x,{appContent:t.jsx(we,{})})}),t.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:t.jsx(x,{appContent:t.jsx(me,{})})}),t.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:t.jsx(x,{appContent:t.jsx(be,{})})}),t.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:t.jsx(x,{appContent:t.jsx(u,{})})}),t.jsx(y,{path:"new/vendor/create/ach",element:t.jsx(x,{appContent:t.jsx(me,{})})}),t.jsx(y,{path:"new/vendor/create/domestic",element:t.jsx(x,{appContent:t.jsx(be,{})})}),t.jsx(y,{path:"new/vendor/create/international",element:t.jsx(x,{appContent:t.jsx(u,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/ach",element:t.jsx(x,{appContent:t.jsx(me,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/domestic",element:t.jsx(x,{appContent:t.jsx(be,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/international",element:t.jsx(x,{appContent:t.jsx(u,{})})}),t.jsx(y,{path:":billId/edit/vendor/create",element:t.jsx(x,{appContent:t.jsx(we,{})})}),t.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:t.jsx(x,{appContent:t.jsx(we,{})})}),t.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:t.jsx(x,{appContent:t.jsx(me,{})})}),t.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:t.jsx(x,{appContent:t.jsx(be,{})})}),t.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:t.jsx(x,{appContent:t.jsx(u,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/ach",element:t.jsx(x,{appContent:t.jsx(me,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/domestic",element:t.jsx(x,{appContent:t.jsx(be,{})})}),t.jsx(y,{path:":billId/edit/vendor/create/international",element:t.jsx(x,{appContent:t.jsx(u,{})})}),t.jsx(y,{path:"*",element:t.jsx(Be,{})})]}):t.jsx(y,{path:"*",element:t.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),t.jsx(y,{path:"*",element:t.jsx(Be,{})})]})}export{To as default};
@@ -0,0 +1,9 @@
1
+ import{a as O}from"./sentry-Bh68thgn.js";import{u as q,j as h,h as se,g as oe,i as ie,N as re,l as ce}from"./core-Cc1CwF93.js";import{fI as z,If as ue,It as de,LF as le,Ov as pe,P9 as fe,P_ as me,a0T as ye,C8 as Se,Tc as ge,a14 as Ie,a15 as he,a16 as be,a17 as Te,a18 as De,a19 as Ce,a1a as Oe,YE as ke,a1b as Ve,MR as Ae,MJ as ve,a1c as we,MN as Ne,mS as Fe,gJ as _e,gI as Ee,gH as xe,vc as Re,v3 as ze,v0 as Pe,mK as Be,Ch as Me,Cf as P,bE as B,Ct as M,cv as Ue}from"./zeni-epic-state-DFhlE0W3.js";import{b0 as Le,V as je,p as Ge,au as Ke,z as R,a9 as qe,e as U,D as E,U as x,d0 as Je,af as Ze,v as L,bg as j}from"./index-zmOdoQIt.js";import{n as $e}from"./mui-ehyt9jca.js";import{j as A}from"./liveblocks-CM1vcHN_.js";import{d as G}from"./routePaths-RxstHRDw.js";import{M as He}from"./MobileAppDrawer-YElMwyTk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="3fa0ab64-e01e-40a0-8647-186a4fbaf628",e._sentryDebugIdIdentifier="sentry-dbid-3fa0ab64-e01e-40a0-8647-186a4fbaf628")}catch{}})();function it(){const e=q(),r=h((u=>z(u))),a=r?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Le(a),p=h((u=>u.billPaySetupApproverViewState.fetchState));O.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function K(e,r,a,s=!1){switch(r){case"zeni_accounts":e(me(a,!0,s));break;case"zeni_treasury":e(fe(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const We=$e.div`
2
+ display: flex;
3
+ min-height: 100%;
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
+ `,Ye=ce((function(e,r){const{businessVerificationDetails:a}=r,s=z(e),l=R.getSignedInUser(),p=s.tenantId,u={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:p??""},b=Oe(r.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${Ze.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,r){const{companyId:a,productType:s,currentTenant:l,navigate:p,location:u}=r,{tenantEmailDomain:b}=l;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:f,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:m,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:T,primaryContactSyncToken:D,syncToken:c,fileIds:C,incDate:n,typeOfIncorporation:g,stateOfIncorporation:v,sourceOfFunds:w,companySubIndustry:N,countriesOfOperations:I,companySourceOfFunds:J,companySourceOfFundsDescription:Z,transactionVolume:$,transactionVolumeDescription:H,purposeOfAccount:W,purposeOfAccountDescription:Y,regulatedStatus:Q,regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te}=t,F=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:f.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:V,taxIdOrEIN:y,website:m!=""&&m!=null?Ue(m):void 0,phone:S,syncToken:c,fileIds:C,incDate:n!=null?B(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:v?.selectedOption??"",sourceOfFunds:w?.selectedOption??"",companySubIndustry:N?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:j(_)))??[],companySourceOfFunds:J?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:H,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:Y,regulatedStatus:Q??"",regulatedStatusDescription:X,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:T,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:D};e(M({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((f=>{const{officerType:k,userId:V,name:y,email:m,nationalityCountryCode:S,ssn:d,dob:i,phone:T,syncToken:D,selectDocument:c,role:C,ownership:n,isSelectedForVerification:g,userVerificationStatus:v,treasuryUserVerificationStatus:w,fileIds:N}=f;let I;return c.selectDocumentType==="driverLicense"?I="driving_license":c.selectDocumentType==="passport"?I="passport":c.selectDocumentType==="stateId"?I="id_document":c.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:m,ssn:d,nationalityCountryCode:S?.selectedOption!=null?j(S.selectedOption):void 0,phone:T,birthday:i!=null?B(i?.toString()):i,syncToken:D,titleAtCompany:C.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:v,treasuryUserVerificationStatus:w,fileIds:N,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(M({officers:o}))},onSaveDetailsClick:t=>{e(P(a,t,s))},onSendForVerificationClick:t=>{e(P(a,t,s,!0))},onAddressClick:t=>{const o=G(b,t),f=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:f}})},onRegisteredAddressClick:t=>{const o=G(b,t),f=L(u.state?.pathnameStackToGoBack,u.pathname);p(o,{state:{pathnameStackToGoBack:f}})},onBackClick:()=>{e(Me({companyId:a})),p("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(Pe(t))},onDeleteFileList:t=>{e(ze(t))},onEditFileName:(t,o)=>{e(Re(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(Fe({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=we(t.documentType);o!=null&&e(Ne({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(ve({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))(Je),rt=({productType:e})=>{const r=se(),a=oe(),s=q(),[l,p]=O.useState(!1),[u,b]=O.useState(!1),{tenantEmailDomain:t}=ie(),o=je(),{useDynamicConfig:f}=Ge(),{configValue:k}=f(Ke.zeniAccountsConfig),V=ye(k),y=h((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),m=h((n=>n.companyConfigState.fetchState)),S=h((n=>n.userRoleConfigState.fetchState)),d=h((n=>z(n))),i=d.companyId??R.getSignedInUserTenant(t)?.companyId;O.useEffect((()=>{m==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[m,S,s]),O.useEffect((()=>{l||y!=="Not-Started"||i==null||(p(!0),K(s,e,i))}),[l,y,i,s]);const T=h((n=>{switch(e){case"zeni_accounts":return De(n,i);case"zeni_treasury":return Te(n,i);case"charge_cards":return be(n,i);case"reimbursement":return he(n,i);default:return Ie(n,i)}})),D=T.kycKybResetStatus.fetchState;if(O.useEffect((()=>{D==="Completed"&&i!=null&&(K(s,e,i,!0),s(Ce()))}),[D,i,e,s]),R.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(e){case"zeni_accounts":c=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const C=n=>{b(n)};return c===!1?A.jsx(re,{to:"../promo"}):A.jsxs(We,{children:[A.jsx(qe,{analytics:U,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(He,{isAppContentDrawerOpen:u,handleDrawerToggle:C}):null,A.jsx(Ye,{businessVerificationDetails:T,navigate:r,location:a,companyId:i,analytics:U,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{C(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{rt as B,K as d,it as u};