@zeniai/web-app-ui 5.3.65-dev → 5.3.66-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 (172) hide show
  1. package/dist/assets/AccountMappingScreen-qzaB7mmI.js +9 -0
  2. package/dist/assets/ActualMatchingMatchDetailScreen-DqHcloug.js +1 -0
  3. package/dist/assets/AddressRoutes-CSHbftqG.js +1 -0
  4. package/dist/assets/AddressScreen-C6LJsN0I.js +9 -0
  5. package/dist/assets/{AiCfoScreen-HIFRX9qy.js → AiCfoScreen-69iCdaWe.js} +5 -5
  6. package/dist/assets/AppDrawer-BetwU_4-.js +10 -0
  7. package/dist/assets/{BillPayApprovalRoutes-CJFVAxhN.js → BillPayApprovalRoutes-DzANWOc3.js} +1 -1
  8. package/dist/assets/BillPayRoutes-D2aY2x5B.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-ClHDLcIn.js → BusinessVerificationPageScreen-BgP8jWXu.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-B0vefglp.js +14 -0
  11. package/dist/assets/ChargeCardRoutes-giQdoPks.js +71 -0
  12. package/dist/assets/CompanyPassportScreen-B-V7cvQm.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-BXN_6nzp.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-DU6fAlNg.js +1 -0
  15. package/dist/assets/CustomerOnboardingRoutes-BxjXFm9y.js +30 -0
  16. package/dist/assets/DashboardRoutes-B8Is8VU8.js +20 -0
  17. package/dist/assets/DefaultTenantHome-DeP5rQNd.js +1 -0
  18. package/dist/assets/DomesticWireDetailScreen-BQJTKZiM.js +18 -0
  19. package/dist/assets/DrawerScreen-BUdO6BQE.js +1 -0
  20. package/dist/assets/EntityDetailRoutes-DUH9-vmY.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-CoKP5vlI.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-DLzs5A8g.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-Zi2fxuEj.js +1 -0
  24. package/dist/assets/InboxNotificationsProvider-C8gkRzEM.js +1 -0
  25. package/dist/assets/InvoicingRoutes-Bl5-2g9q.js +2 -0
  26. package/dist/assets/MagicLinkRoutes-BkB3vELP.js +72 -0
  27. package/dist/assets/MagicLinkSignInScreen-BQa7bOA3.js +12 -0
  28. package/dist/assets/MobileAppDrawer-BdOhYCo5.js +1 -0
  29. package/dist/assets/NotFoundScreen-D_hX2Dzv.js +1 -0
  30. package/dist/assets/NotificationRoutes-BlXrAcVL.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-DV9AMjuQ.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-DQr_dvG9.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-CAg7Uc1V.js → PaymentLinkScreen-BU0e_SRM.js} +5 -5
  34. package/dist/assets/PeopleRoutes-BGMNmycG.js +22 -0
  35. package/dist/assets/PerformanceRoutes-Bx4cQFIn.js +1 -0
  36. package/dist/assets/{Preview-DB5CbRio.js → Preview-CdZ2j2v9.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-CRdIfjOg.js → QBOConnectionScreen-DPCQAZIh.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-BNnc3IUS.js +1 -0
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-ChXGgpkg.js → ReimbursementApprovalRuleDetailScreen-DZMnuINe.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-CzK-ajwk.js +68 -0
  41. package/dist/assets/ReportsRoutes-FipSeC9E.js +1 -0
  42. package/dist/assets/RewardsRoutes-BXICRfw-.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CuQHddsr.js → ScheduleDetailsPrepaidExpensesScreen-BF-khYnD.js} +5 -5
  44. package/dist/assets/ScreenRoutes-6gUtsuNq.js +2 -0
  45. package/dist/assets/{SettingsRoutes-B7gRIVJU.js → SettingsRoutes-ZSOCIcz1.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-CabDNVlS.js → SetupPagesScreen-DLgnlxEs.js} +5 -5
  47. package/dist/assets/SignInScreen-C1w5fnGW.js +1 -0
  48. package/dist/assets/SignOutScreen-DCUrMwdu.js +9 -0
  49. package/dist/assets/{TaskListScreen-d8rT1QCC.js → TaskListScreen-DJlJsvJO.js} +2 -2
  50. package/dist/assets/TaskRoutes-Bwnv9rhn.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-Dw-xx0H2.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-BH-OIB8S.js +5 -0
  53. package/dist/assets/TransactionListRoutes-DcrtQayK.js +1 -0
  54. package/dist/assets/TreasuryRoutes-BNsP_RFF.js +37 -0
  55. package/dist/assets/{VendorsRoutes-Dd9qfBZi.js → VendorsRoutes-Bzdw0VNh.js} +10 -10
  56. package/dist/assets/WiseConfirmationScreen-Cs6ZZr7W.js +12 -0
  57. package/dist/assets/ZeniAccountRoutes-CbW2U8iU.js +57 -0
  58. package/dist/assets/ZeniAccountStatementScreen-Dbn9Qd0C.js +9 -0
  59. package/dist/assets/{accountMappingHelper-mjWJVrZb.js → accountMappingHelper-BBlKWvqF.js} +1 -1
  60. package/dist/assets/analytics-Cd5J-GpX.js +68 -0
  61. package/dist/assets/{analyticsHelper-DoCIxX19.js → analyticsHelper-1gGrcOYN.js} +1 -1
  62. package/dist/assets/{core-BBG4mxvC.js → core-vR5k5yHJ.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-DgKmvHaP.js → decodeURIComponentSafe-dlx9EsSm.js} +1 -1
  64. package/dist/assets/{dnd-oIrpOltC.js → dnd-CNeE6eVY.js} +1 -1
  65. package/dist/assets/{empty-zUa_Ywzm.js → empty-BCyx7s6I.js} +1 -1
  66. package/dist/assets/{empty-BVUnugO_.js → empty-BaVMrwvd.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-WG4m8gNp.js → emptyVideoElement-BsSkwvra.js} +1 -1
  68. package/dist/assets/epic-BY4nSR9p.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-DhbRqzrb.js +1 -0
  70. package/dist/assets/getLocaleForTenant-DlNsSiyY.js +1 -0
  71. package/dist/assets/{index-De2R2YuA.js → index-1ujiYIu0.js} +29082 -29221
  72. package/dist/assets/{index-CD8RychW.js → index-B8gT7z4T.js} +1 -1
  73. package/dist/assets/{index-lbu92FYh.js → index-BNIWZiV_.js} +1 -1
  74. package/dist/assets/{index-BlZF-J3g.js → index-C-u59Z-A.js} +1 -1
  75. package/dist/assets/{index-DlbH0-p0.js → index-DC9buFXh.js} +1 -1
  76. package/dist/assets/{index-Bgwcwudg.js → index-DT7mcNKS.js} +1 -1
  77. package/dist/assets/{index-B9QH_oKn.js → index-DglCggLh.js} +2 -2
  78. package/dist/assets/{index-CyCQjJen.js → index-bBDyOWrB.js} +1 -1
  79. package/dist/assets/{lexical-BRrdO5Cu.js → lexical-DgMW3HzT.js} +1 -1
  80. package/dist/assets/{liveblocks-CzCs-qU3.js → liveblocks-DVkNRe2z.js} +1 -1
  81. package/dist/assets/{lottie-ULJlrwjP.js → lottie-w9LOAwHI.js} +1 -1
  82. package/dist/assets/{mui-B2F_PvWe.js → mui-Bf4yQzNc.js} +1 -1
  83. package/dist/assets/{pathToGoBack-e0pJACvC.js → pathToGoBack-C6FxxwA3.js} +1 -1
  84. package/dist/assets/{pdf-CeVn9A9c.js → pdf-HKvehc9b.js} +4 -4
  85. package/dist/assets/{pdf-lib-DiMa7ymi.js → pdf-lib-1kn73-Ho.js} +1 -1
  86. package/dist/assets/{plaid-BWZxX3Bn.js → plaid-TFLEc35h.js} +1 -1
  87. package/dist/assets/{pusher-wcP4-1ih.js → pusher-tJC8UB03.js} +1 -1
  88. package/dist/assets/{react-D7hd8riP.js → react-BKyIT5tt.js} +1 -1
  89. package/dist/assets/{react-CGMaXwI-.js → react-BtmyM_-m.js} +1 -1
  90. package/dist/assets/{react-Chuw6ptT.js → react-CiN9hWuS.js} +1 -1
  91. package/dist/assets/{react-3Jh1nOTX.js → react-DLVu_DIJ.js} +1 -1
  92. package/dist/assets/{react-Dv-IwMT5.js → react-DrY897mF.js} +1 -1
  93. package/dist/assets/{react-BrDYknqm.js → react-YQhQ1aSJ.js} +1 -1
  94. package/dist/assets/{recharts-CzGMTm3v.js → recharts-BajLe7QJ.js} +1 -1
  95. package/dist/assets/{routePaths-BRju88LA.js → routePaths-Du4I9ue1.js} +1 -1
  96. package/dist/assets/{sentry-CWp8Ph3h.js → sentry-BcU4ynZK.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-BWJSV6oD.js → stripSplatSuffix-CGuqfZ54.js} +1 -1
  98. package/dist/assets/{url-CnTmKJO0.js → url-ee1pOdF5.js} +1 -1
  99. package/dist/assets/{url-DV6CtKQ5.js → url-l4mUxam0.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CNkjnN75.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CB15Xjw5.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-Daw0Xdbp.js +1 -0
  103. package/dist/assets/useChargeCardPusherEvents-B1XaK23y.js +1 -0
  104. package/dist/assets/{useDeviceId-Bzw6IkAe.js → useDeviceId-D80AOehv.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DxMN-FLO.js +1 -0
  106. package/dist/assets/useInitialThreadRequest-CujqTgMw.js +1 -0
  107. package/dist/assets/useTaskManagerAccess-DmtbEonm.js +1 -0
  108. package/dist/assets/useTaskManagerPusherEvents-Cieei3Tg.js +1 -0
  109. package/dist/assets/{utils-u0mlLj2I.js → utils-BJrHoU4M.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-D7CS7WiP.js +25 -0
  111. package/dist/assets/{zeni-epic-state-FRanwwFO.js → zeni-epic-state-BmF1nplD.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -4
  114. package/dist/assets/AccountMappingScreen-6_GKC9vx.js +0 -9
  115. package/dist/assets/ActualMatchingMatchDetailScreen-BtJ1PRf_.js +0 -1
  116. package/dist/assets/AddressRoutes-BGo6E_l0.js +0 -1
  117. package/dist/assets/AddressScreen-BYfgTsTg.js +0 -9
  118. package/dist/assets/AppDrawer-HGV6a9mb.js +0 -10
  119. package/dist/assets/BillPayRoutes-9qxDDuw-.js +0 -119
  120. package/dist/assets/CardsAiCfoScreen-HQpPf571.js +0 -14
  121. package/dist/assets/ChargeCardRoutes-D5HxBR-m.js +0 -71
  122. package/dist/assets/CompanyPassportScreen-NKCcjvTx.js +0 -1
  123. package/dist/assets/ConnectionAuthScreen-5_efBSJK.js +0 -11
  124. package/dist/assets/CustomerOnboardingAuthScreen-LnGpx7c7.js +0 -1
  125. package/dist/assets/CustomerOnboardingRoutes-DvA4xflo.js +0 -30
  126. package/dist/assets/DashboardRoutes-BrD8wr4t.js +0 -20
  127. package/dist/assets/DefaultTenantHome-UgTfgsWU.js +0 -1
  128. package/dist/assets/DomesticWireDetailScreen-CnA3RoGS.js +0 -18
  129. package/dist/assets/DrawerScreen-Uxjfm6D_.js +0 -1
  130. package/dist/assets/EntityDetailRoutes-DtNSByJA.js +0 -1
  131. package/dist/assets/ExpenseAutomationRoutes-CyGyQy2q.js +0 -38
  132. package/dist/assets/FeaturePreviewScreen-C1hVuos1.js +0 -1
  133. package/dist/assets/HubSpotOAuthCallbackScreen-BZRaCcdu.js +0 -1
  134. package/dist/assets/InboxNotificationsProvider-J2K-16R3.js +0 -1
  135. package/dist/assets/InvoicingRoutes-BER5-vbp.js +0 -2
  136. package/dist/assets/MagicLinkRoutes-BGZcWo6O.js +0 -72
  137. package/dist/assets/MagicLinkSignInScreen-BclRPUfZ.js +0 -12
  138. package/dist/assets/MobileAppDrawer-B_zpLZqx.js +0 -1
  139. package/dist/assets/NotFoundScreen-BXryZNID.js +0 -1
  140. package/dist/assets/NotificationRoutes-CQasJ3IU.js +0 -1
  141. package/dist/assets/OAuthConsentScreen-Bo-ewMPc.js +0 -1
  142. package/dist/assets/PandLWithForecastRoutes-DdmupK5y.js +0 -1
  143. package/dist/assets/PeopleRoutes-CYUsZeQt.js +0 -22
  144. package/dist/assets/PerformanceRoutes-DqTbj0rB.js +0 -1
  145. package/dist/assets/ReimbursementApprovalRoutes-CgCsp1OP.js +0 -1
  146. package/dist/assets/ReimbursementRoutes-DKUCzczr.js +0 -68
  147. package/dist/assets/ReportsRoutes-CSUm6Emn.js +0 -1
  148. package/dist/assets/RewardsRoutes-DWpcmti-.js +0 -1
  149. package/dist/assets/ScreenRoutes-evald5rF.js +0 -2
  150. package/dist/assets/SignInScreen-DfTwbUKW.js +0 -1
  151. package/dist/assets/SignOutScreen-CH6sLo8r.js +0 -9
  152. package/dist/assets/TaskRoutes-DVZrk18e.js +0 -9
  153. package/dist/assets/TransactionDetailRoutes-CkeAEzHU.js +0 -1
  154. package/dist/assets/TransactionDetailScreen-hIkUAVjY.js +0 -5
  155. package/dist/assets/TransactionListRoutes-BVLahxTu.js +0 -1
  156. package/dist/assets/TreasuryRoutes-D4vqz1Fs.js +0 -37
  157. package/dist/assets/WiseConfirmationScreen-B9ReE25J.js +0 -12
  158. package/dist/assets/ZeniAccountRoutes-BtAMcoNj.js +0 -57
  159. package/dist/assets/ZeniAccountStatementScreen-B3egvFmp.js +0 -9
  160. package/dist/assets/analytics-cC2XJoxx.js +0 -68
  161. package/dist/assets/epic-Du6qCFYI.js +0 -2
  162. package/dist/assets/expenseAutomationHelper-BkZxz0F-.js +0 -1
  163. package/dist/assets/getLocaleForTenant-BYuz_wJa.js +0 -1
  164. package/dist/assets/useActualMatchingMatchDetail-lnPRleqr.js +0 -1
  165. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-DuZAl-a1.js +0 -1
  166. package/dist/assets/useAskAiCfoHostNavButtonProps-Bq-fQXG8.js +0 -1
  167. package/dist/assets/useChargeCardPusherEvents-CrB7Excu.js +0 -1
  168. package/dist/assets/useEmailConnectResultRefresh-x1GFiNhw.js +0 -1
  169. package/dist/assets/useInitialThreadRequest-C1rKRZSH.js +0 -1
  170. package/dist/assets/useTaskManagerAccess-CoE1FF6T.js +0 -1
  171. package/dist/assets/useTaskManagerPusherEvents-CgOrop-a.js +0 -1
  172. package/dist/assets/withTransactionSidePanel-CbnU34fe.js +0 -25
@@ -0,0 +1,9 @@
1
+ import{j as D}from"./liveblocks-DVkNRe2z.js";import{a as o}from"./sentry-BcU4ynZK.js";import{h as H,g as W,u as X,j as m,s as q,l as Y}from"./core-vR5k5yHJ.js";import{aj as Z,o as ee,S as $,z as te,q as G,ak as ne,k as ae,V as ce}from"./index-1ujiYIu0.js";import{bn as se,fF as oe,gV as ie,oB as Q,UK as re,i8 as J,gh as le,os as ue,UL as de,UM as pe,ua as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as Ie,UN as ye,UO as Se}from"./zeni-epic-state-BmF1nplD.js";import{n as he}from"./mui-Bf4yQzNc.js";import{M as Ee}from"./MobileAppDrawer-BdOhYCo5.js";import{q as R}from"./QBOConnectionScreen-DPCQAZIh.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-BBlKWvqF.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="3f8ac0be-de4f-4c6d-8741-ab5d2ed146c8",a._sentryDebugIdIdentifier="sentry-dbid-3f8ac0be-de4f-4c6d-8741-ab5d2ed146c8")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
2
+ display: flex;
3
+ height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${a=>a.theme.colors.grey4};
9
+ `,we=Y((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:v,vendorsAccountSection:w,filing1099Section:x}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=v,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=w,{bankAccount:M,expenseCategory1099:k}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),L=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),U=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,k),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:L.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:U.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(Ie()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(fe(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=H(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),k=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[B,N]of g)N===null?delete n[B]:n[B]=N;const[S,K]=g[0]??[];S!=null&&c(Q(s.companyId,S,K,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[f,_]=o.useState(!1),[P,L]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const I=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const U=m((t=>pe(t))),y=t=>{L(t)};return D.jsxs(ve,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),D.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:U,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:k,location:i,isSettings:G(i),onClickMenuIcon:()=>y(!0)})]})};export{l as P,_e as U,u as a};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-DVkNRe2z.js";import{a as k}from"./sentry-BcU4ynZK.js";import{a5 as I,dQ as g}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{u as y}from"./useActualMatchingMatchDetail-CNkjnN75.js";import b from"./NotFoundScreen-D_hX2Dzv.js";import{i as v,h as U,g as w}from"./core-vR5k5yHJ.js";import"./zeni-epic-state-BmF1nplD.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./stripSplatSuffix-CGuqfZ54.js";import"./decodeURIComponentSafe-dlx9EsSm.js";import"./routePaths-Du4I9ue1.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]="0b9cbf63-f788-4a28-96e6-d5ee605ae585",t._sentryDebugIdIdentifier="sentry-dbid-0b9cbf63-f788-4a28-96e6-d5ee605ae585")}catch{}})();function J(){const{matchId:t,tenantEmailDomain:e}=v(),n=U(),r=w(),R=y(t??""),a=k.useCallback((()=>{const S=I(r.state?.pathnameStackToGoBack);n(S.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:S.newStack}})}),[r.state,n,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:o,handleOpenBill:l,handleRefresh:c,handleUndoReversal:d,handleContinueMatch:h,lastMatchResults:f,lastUndoResults:m,refreshStatus:p,undoReversalStatus:u}=R;return i==null?o.fetchState==="Not-Started"||o.fetchState==="In-Progress"?s.jsx(g,{detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m}):s.jsx(b,{}):s.jsx(g,{match:i,detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m})}export{J as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DVkNRe2z.js";import{A as i}from"./AddressScreen-C6LJsN0I.js";import s from"./NotFoundScreen-D_hX2Dzv.js";import"./sentry-BcU4ynZK.js";import{n as d,o as r}from"./core-vR5k5yHJ.js";import"./zeni-epic-state-BmF1nplD.js";import"./recharts-BajLe7QJ.js";import"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="81cbb5c1-1b56-4d87-a240-ae6c03b91825",t._sentryDebugIdIdentifier="sentry-dbid-81cbb5c1-1b56-4d87-a240-ae6c03b91825")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
@@ -0,0 +1,9 @@
1
+ import{j as n}from"./liveblocks-DVkNRe2z.js";import{a as b}from"./sentry-BcU4ynZK.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-vR5k5yHJ.js";import{a2 as V,E as $,z as D,K,a8 as L,a9 as F,k as _,V as S,a4 as z,_ as h,a5 as N}from"./index-1ujiYIu0.js";import{Vp as C,ip as R,fF as U,Vq as q,c8 as G,Vr as H,mH as O}from"./zeni-epic-state-BmF1nplD.js";import{n as J}from"./mui-Bf4yQzNc.js";import Q from"./NotFoundScreen-D_hX2Dzv.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]="bab592ad-36da-452a-9078-b03a4e037789",e._sentryDebugIdIdentifier="sentry-dbid-bab592ad-36da-452a-9078-b03a4e037789")}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=U(e),t=s.roleMap!=null&&q(s.roleMap),d=i||c==="user_address"||G(l?.userRole??[])||t?void 0:"readonly";if(o==null){const a=H(c,e);return{addressToEdit:a?.addressToCreate,loadingState:a?.status?.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=C(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=t=>{if(t==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=N(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(O({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=V(),I=$(),k=D.getSignedInUser(),[p,w]=b.useState(a==null),f=B((m=>a!=null?C(m,a).fetchState:"Not-Started")),x=K();if(k==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 b.useEffect((()=>{p||a==null||(w(!0),d(R(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(L,{fetchState:f,style:{backgroundColor:I.colors.grey5}}):a!=null&&f==="Error"?(t(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(F,{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};
@@ -1,22 +1,22 @@
1
- import{j as h}from"./liveblocks-CzCs-qU3.js";import{a as n}from"./sentry-CWp8Ph3h.js";import{u as Qt,h as Ut,i as Lt,g as Bt,j as b,l as Ft}from"./core-BBG4mxvC.js";import{a as Mt,x as $t,e6 as Vt,z as Nt,a1 as Ht,e7 as Gt,e8 as qt,e9 as zt,bp as Be,ea as We,eb as Wt,bo as Ye,a4 as ge,a8 as ce,j as M,ec as me,ed as Yt,ee as Jt,au as Xt,T as Kt,w as Zt,ef as es,eg as ts,av as ss,eh as ns,ei as as,ej as os,ek as is,p as rs,bk as Fe,el as ls}from"./index-De2R2YuA.js";import{fH as F,gw as R,Ud as us,a2q as ds,a2r as cs,jP as ms,a2s as Ss,jM as hs,a2t as Se,js as W,jV as Y,jy as Ie,jf as he,jd as ps,jX as fs,jH as Je,Um as Me,gy as $,gN as gs,Ul as Is,U6 as $e,fI as Cs,j6 as ks,a2u as bs,gb as vs,jo as Es,jk as Ps,fJ as pe,gi as ys,a2v as ws,a2w as xs,a2x as Rs,gx as Ts,gr as Ve,k7 as Ne,gt as He,gz as js,a2y as Ge,jY as Os,jh as As,jB as _s,jT as qe,jE as Ds,gA as Qs,gB as Us,gC as Ls,gD as Bs}from"./zeni-epic-state-FRanwwFO.js";import{D as Fs,n as V,S as Ms,P as $s}from"./mui-B2F_PvWe.js";import{u as Vs}from"./useAiCfoDashboardSuggestedQuestionsChips-DuZAl-a1.js";import{p as Ns}from"./pathToGoBack-e0pJACvC.js";import{j as Hs}from"./routePaths-BRju88LA.js";import{u as Gs}from"./useTaskManagerPusherEvents-CgOrop-a.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="bc042c8d-69d3-4ecf-ac9d-07574c190674",s._sentryDebugIdIdentifier="sentry-dbid-bc042c8d-69d3-4ecf-ac9d-07574c190674")}catch{}})();const qs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Xe="chat-response-generated";function zs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Ft((function(s,r){const t=F(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:Y(s).detail,skillDetailError:Y(s).fetchState==="Error",skillDetailLoading:Y(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:as(s),resolveSyntheticAnswerPolicyTile:ns(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:U}=r,T=l.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Xe&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=Qs(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:J,currentQuestionAnswer:j,currentQuestionAnswerSummary:X}=Ye(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(X,J),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Us(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(a,o,m,E,v)=>{a&&Fe(s,a,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Je())},onOpenSkill:a=>{s(Ie({macroId:a})),s(Ds({macroId:a}))},onSaveSkill:(a,o)=>{s(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",m=a.name?.trim()??"";s(qe({draft:{name:o.length>0?o:m,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{s(_s({macroId:a,version:o}))},onDeleteSkill:a=>{s(As({macroId:a}))},onSetSkillVisibility:(a,o)=>{s(Os({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(a,o)=>{s($()),s(Ve()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,a),s(Ge())},updateCurrentInput:a=>{s(He(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{s(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),s(He(""))},togglePageView:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),U(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s($()),f!=null&&s(Ve());const a=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{s(Ts({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{U(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{U(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Cn=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=Qt(),l=Ut(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=n.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),U=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),a=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=n.useState(void 0),[J,j]=n.useState(!1),[X,Ce]=n.useState(void 0),Ke=n.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=n.useCallback((e=>{v(e),j(!0)}),[]),et=n.useCallback((()=>{v(void 0),j(!1)}),[]),tt=n.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=a.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=n.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,nt=b((e=>Y(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const at=b((e=>F(e).uiState.currentChatSessionId))??c,C=a.routines.find((e=>e.scheduleId===f))??a.routines.find((e=>e.scheduleId===$t(at))),O=C?.scheduleId??null,[ve,ot]=n.useState(!0);n.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=n.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=n.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=n.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=n.useCallback((()=>{t(Je()),t(Me())}),[t]),dt=n.useCallback((()=>{t($())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=Vt();n.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();n.useEffect((()=>c==="routines"?(t($()),void t(Is())):c==="skills"?(t(Se()),t($e()),void t(Me())):(O==null&&t(Se()),t($e()),void t($()))),[t,O,f,c]);const pt=Ht(),_=Xt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=n.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=n.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=n.useCallback(((e,d)=>{const D=e.sessionId??I.sessionId;D!=null&&L&&l(`/${y}/ai-cfo/${D}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=n.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:K.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,K]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=qt({isFileUploadEnabled:s,tenantEmailDomain:y}),ne=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:U,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=Vs(),N=i.state,H=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;S(!0);const d={...e};delete d[Be],l(i,{replace:!0,state:d})}),[i.pathname,i.search,i.state,l]);const[bt,ae]=n.useState(null),[vt,oe]=n.useState(!1),[Et,ie]=n.useState(void 0),[Pt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&H!=null&&H!==""){const e=i.state;ae(H),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[H,ye,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const G=g.uiState.lastContextMessage;n.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ae(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),q=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Ye(_e,u),Rt=xt.length===0;n.useEffect((()=>{x||_||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,l,i.state]);const Tt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),d=k.tenantEmailDomain;l(e.poppedPathname??(d!=null?`/${d}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),De=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=c!==De.current,d=u!==Qe.current;De.current=c,Qe.current=u,c!==u&&(!e||c==null||Hs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Xe}`)),eventCallback:(e,d,D)=>D.onEventReceived(e,d)})),[je]);n.useEffect((()=>{q!=="In-Progress"&&z&&t(Es())}),[q,z,t]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||q==="Completed"&&!z)&&t(Ps(u,w.userId))}),[Oe,q,Ae,z,u,w,c,t]);const ue=w?.userId,Ot=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Ue=n.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>Ue(P??O),onEvent:(e,d)=>{const D=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:qs.find((Dt=>Dt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(d);D!=null&&Ue(D.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ne.drawerElement,h.jsx(Xs,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const _t=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Ys,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Kt.Event.aiCFOPage)}),_&&ne.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:J,routineListError:a.fetchState==="Error",routineListLoading:a.fetchState==="In-Progress",routineMaxRoutines:a.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:K,routines:a.routines,onRoutineCreate:Ke,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:X,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:U,promoDismissalScope:y}),p&&_?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ks,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!_?h.jsx(Yt,{open:p,onClose:()=>S(!1),children:h.jsx(Jt,{children:_t})}):null]})},ze=V(Ms)`
1
+ import{j as h}from"./liveblocks-DVkNRe2z.js";import{a as n}from"./sentry-BcU4ynZK.js";import{u as _t,h as Dt,i as Lt,g as Bt,j as b,l as Ft}from"./core-vR5k5yHJ.js";import{a as Mt,h as Vt,e7 as $t,z as Nt,a2 as qt,e8 as Gt,e9 as Ht,ea as zt,bq as Be,eb as We,ec as Wt,bp as Je,a5 as ge,a9 as ce,k as M,ed as me,ee as Jt,ef as Kt,av as Yt,V as Xt,w as Zt,eg as es,eh as ts,aw as ss,ei as ns,ej as as,ek as os,el as is,p as rs,bl as Fe,em as ls}from"./index-1ujiYIu0.js";import{fE as F,gt as R,U7 as us,a2h as ds,a2i as cs,jM as ms,a2j as Ss,jJ as hs,a2k as Se,jp as W,jS as J,jv as Ie,jc as he,ja as ps,jU as fs,jE as Ke,Ug as Me,gv as V,gK as gs,Uf as Is,U0 as Ve,fF as Cs,j3 as ks,a2l as bs,g8 as vs,jl as Es,jh as Ps,fG as pe,gf as ys,a2m as ws,a2n as xs,a2o as Rs,gu as Ts,go as $e,k4 as Ne,gq as qe,gw as js,a2p as Ge,jV as Os,je as As,jy as Qs,jQ as He,jB as Us,gx as _s,gy as Ds,gz as Ls,gA as Bs}from"./zeni-epic-state-BmF1nplD.js";import{D as Fs,n as $,S as Ms,P as Vs}from"./mui-Bf4yQzNc.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-CB15Xjw5.js";import{p as Ns}from"./pathToGoBack-C6FxxwA3.js";import{j as qs}from"./routePaths-Du4I9ue1.js";import{u as Gs}from"./useTaskManagerPusherEvents-Cieei3Tg.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="a593901a-509c-411e-932b-b29979432478",s._sentryDebugIdIdentifier="sentry-dbid-a593901a-509c-411e-932b-b29979432478")}catch{}})();const Hs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Ye="chat-response-generated";function zs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Ft((function(s,r){const t=F(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:J(s).detail,skillDetailError:J(s).fetchState==="Error",skillDetailLoading:J(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:as(s),resolveSyntheticAnswerPolicyTile:ns(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:D}=r,T=l.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=_s(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:K,currentQuestionAnswer:j,currentQuestionAnswerSummary:Y}=Je(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(Y,K),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Ds(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(a,o,m,E,v)=>{a&&Fe(s,a,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:a=>{s(Ie({macroId:a})),s(Us({macroId:a}))},onSaveSkill:(a,o)=>{s(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",m=a.name?.trim()??"";s(He({draft:{name:o.length>0?o:m,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{s(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{s(As({macroId:a}))},onSetSkillVisibility:(a,o)=>{s(Os({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(a,o)=>{s(V()),s($e()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,a),s(Ge())},updateCurrentInput:a=>{s(qe(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{s(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),s(qe(""))},togglePageView:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),D(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const a=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{s(Ts({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{D(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{D(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Cn=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=_t(),l=Dt(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=n.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),D=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),a=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=n.useState(void 0),[K,j]=n.useState(!1),[Y,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=n.useCallback((e=>{v(e),j(!0)}),[]),et=n.useCallback((()=>{v(void 0),j(!1)}),[]),tt=n.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=a.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=n.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,nt=b((e=>J(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const at=b((e=>F(e).uiState.currentChatSessionId))??c,C=a.routines.find((e=>e.scheduleId===f))??a.routines.find((e=>e.scheduleId===Vt(at))),O=C?.scheduleId??null,[ve,ot]=n.useState(!0);n.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=n.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=n.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=n.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=n.useCallback((()=>{t(Ke()),t(Me())}),[t]),dt=n.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();n.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();n.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=qt(),Q=Yt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=n.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=n.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=n.useCallback(((e,d)=>{const U=e.sessionId??I.sessionId;U!=null&&L&&l(`/${y}/ai-cfo/${U}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=n.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:X.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,X]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=Ht({isFileUploadEnabled:s,tenantEmailDomain:y}),ne=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:D,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,q=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;S(!0);const d={...e};delete d[Be],l(i,{replace:!0,state:d})}),[i.pathname,i.search,i.state,l]);const[bt,ae]=n.useState(null),[vt,oe]=n.useState(!1),[Et,ie]=n.useState(void 0),[Pt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[q,ye,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const G=g.uiState.lastContextMessage;n.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ae(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),H=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Qe=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Je(Qe,u),Rt=xt.length===0;n.useEffect((()=>{x||Q||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,Q,l,i.state]);const Tt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),d=k.tenantEmailDomain;l(e.poppedPathname??(d!=null?`/${d}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Ue=n.useRef(void 0),_e=n.useRef(void 0);n.useEffect((()=>{const e=c!==Ue.current,d=u!==_e.current;Ue.current=c,_e.current=u,c!==u&&(!e||c==null||qs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,d,U)=>U.onEventReceived(e,d)})),[je]);n.useEffect((()=>{H!=="In-Progress"&&z&&t(Es())}),[H,z,t]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||H==="Completed"&&!z)&&t(Ps(u,w.userId))}),[Oe,H,Ae,z,u,w,c,t]);const ue=w?.userId,Ot=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>De(P??O),onEvent:(e,d)=>{const U=(de=>{if(de==null||typeof de!="object")return null;const _=de;return fe(_.schedule_id)&&fe(_.run_id)?{scheduleId:_.schedule_id,runId:_.run_id,status:Hs.find((Ut=>Ut===_.status))??null,finishedAt:fe(_.finished_at)?_.finished_at:null}:null})(d);U!=null&&De(U.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&Q)return h.jsxs(Ks,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ne.drawerElement,h.jsx(Ys,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const Qt=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Xt.Event.aiCFOPage)}),Q&&ne.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Qe,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:Q?ne.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:a.fetchState==="Error",routineListLoading:a.fetchState==="In-Progress",routineMaxRoutines:a.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:a.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:D,promoDismissalScope:y}),p&&Q?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Xs,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!Q?h.jsx(Jt,{open:p,onClose:()=>S(!1),children:h.jsx(Kt,{children:Qt})}):null]})},ze=$(Ms)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
- `,Ys=V.div`
5
+ `,Js=$.div`
6
6
  height: 100vh;
7
7
  width: 100%;
8
- `,Js=V.div`
8
+ `,Ks=$.div`
9
9
  height: 100vh;
10
10
  width: 100%;
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  min-height: 0;
14
- `,Xs=V.div`
14
+ `,Ys=$.div`
15
15
  flex: 1;
16
16
  min-height: 0;
17
17
  display: flex;
18
18
  flex-direction: column;
19
- `,Ks=V($s)`
19
+ `,Xs=$(Vs)`
20
20
  box-shadow: ${({theme:s})=>s.colors.elevation2};
21
21
  color: ${({theme:s})=>s.colors.grey4};
22
22
  `;export{Cn as default};
@@ -0,0 +1,10 @@
1
+ import{j as d}from"./liveblocks-DVkNRe2z.js";import{a as o,R as ya}from"./sentry-BcU4ynZK.js";import{u as Me,j as r,g as Ta,h as $a,q as R}from"./core-vR5k5yHJ.js";import{fF as Fe,T_ as Ba,T$ as Ue,g9 as xa,gv as W,U0 as J,jE as Ie,jc as ve,U1 as Aa,U2 as _a,gO as Da,p$ as Ma,U3 as Fa,U4 as ye,gm as Ua,U5 as $,fE as Ga,gt as Ra,U6 as Za,U7 as Va,U8 as ja,U9 as Te,Ua as Ha,Ub as $e,Uc as Na,Eb as Pa,gn as La,h1 as Oa,cV as za,Ud as qa,Ue as Ya,qC as Qa,g8 as Wa,j6 as Ja,Uf as Ka,Ug as Xa,wu as et,go as at}from"./zeni-epic-state-BmF1nplD.js";import{w as tt,i as nt,a as ot,O as st,E as rt,o as it,S as m,c as lt,u as dt,d as ct,Q as ut,e as mt,f as Ct,g as pt,h as ht,j as ft,z as gt,k as Z,p,m as Be,l as bt,N as St,n as xe,q as kt,R as Ae,r as Et,s as wt,v as X,x as K,y as It,A as vt,B as yt,L as Tt,C as $t,D as Bt,F as ee,H as xt,I as At}from"./index-1ujiYIu0.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-Bf4yQzNc.js";import{u as Ut}from"./InboxNotificationsProvider-C8gkRzEM.js";import{u as Gt}from"./useTaskManagerAccess-DmtbEonm.js";import{u as Rt}from"./expenseAutomationHelper-DhbRqzrb.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.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]="18c24607-63a4-40b7-9b44-00daad24a8a2",a._sentryDebugIdIdentifier="sentry-dbid-18c24607-63a4-40b7-9b44-00daad24a8a2")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Zt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,A]=ya.useState(!1),[S,Ge]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Me(),[Re,Ze]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(W()),n(J()))}),[n,ne]),o.useEffect((()=>{n(W()),n(J())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Le=Ct(i,Pe,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>Aa(e)));o.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=R("/signout")!==null,M=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&D&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ye(l))}}}),[le,t.state]);const Ye=qe||g,L=r((e=>e.tenantState)),Qe=r((e=>L.fetchState==="Completed"?Ua(e):[])),{isFeatureEnabled:We}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>Za(e))),ce=r((e=>Va(e).routines)),la=o.useMemo((()=>ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[ce]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[v,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Ut(),U=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return me==="In-Progress"&&F==="Completed"?(n(Te({chatSessionId:v})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(Te({chatSessionId:v})),z(void 0)))}),[n,t.state,s,F,v,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;He(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||U.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,U.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=U;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ue({unreadCount:N},"comments")))}}),[N,U.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];We===!1&&y.push("accounts_payable_aging"),Je===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),se===!1&&y.push("expense_automation_card");const fe=r((e=>Na(e,y).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?La(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),T=e=>{A(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&Z.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const x=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:f.currentSelectedView}})}n(ye(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Qa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:L.currentTenantId??"",tenants:L.fetchState==="Completed"?Qe:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:P.rewardsPlan},selectedMenu:C===!0?Ae("ai_cfo"):xe(t)&&ue!=="completed"?Ae("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:xe(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Le,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(Tt.TENANT_SWITCHING),T(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&Z.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Ka()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(W()),n(J()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(Z.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),Q=e.type,we=At(Q)&&Q!=="command_center";if(Q!=="command_center"&&!we||h[i.tenantId]==null||Z.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:I,onPeriodChange:Sa,onCalendarOpen:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Ke,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>T(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ia=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Zt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>T(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((A=>Fe(A))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ue({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
2
+ height: 20px;
3
+ width: 20px;
4
+ color: ${a=>a.theme.colors.primary};
5
+ `,Ht=ee((a=>o.createElement("svg",{viewBox:"0 0 102 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{d:"M73.4046 13.2609H57.77C58.0392 15.0844 58.8324 16.5249 60.352 17.5133C61.5784 18.3113 62.9424 18.5733 64.3842 18.407C64.8867 18.3484 65.3952 18.2539 65.8738 18.0935C67.1433 17.6676 68.0945 16.8923 68.4559 15.5031H73.2777C73.1629 16.3885 72.8877 17.1866 72.4845 17.938C71.4734 19.8189 69.9228 21.1159 67.9414 21.8302C64.3076 23.138 60.7875 22.9178 57.5642 20.6588C55.1293 18.9526 53.7318 16.5465 53.3034 13.6055C52.9959 11.4973 53.2065 9.43809 54.1374 7.49857C55.6988 4.2453 58.2761 2.29381 61.8273 1.67642C64.048 1.28995 66.2124 1.54361 68.2202 2.60969C71.2784 4.23333 73.0085 6.79743 73.4405 10.2314C73.5649 11.2161 73.5374 12.202 73.407 13.2621L73.4046 13.2609ZM68.3554 9.72765C68.3278 9.51706 68.3159 9.334 68.2788 9.15692C68.0622 8.12913 67.4915 7.32388 66.6767 6.68735C65.7697 5.97902 64.7264 5.68349 63.5825 5.62486C61.0543 5.49444 58.8289 7.02356 58.0918 9.44408C58.0655 9.52903 58.0595 9.62116 58.0416 9.72765H68.3566H68.3554Z",fill:"currentColor"}),o.createElement("path",{d:"M52.7423 17.86V21.9162C52.7423 22.0478 52.6346 22.1555 52.503 22.1555H34.5854C34.5854 22.1555 34.595 19.9659 34.5783 19.1008C34.5723 18.7861 34.662 18.5528 34.8786 18.3183C38.3664 14.535 41.8458 10.7445 45.3276 6.95397C45.452 6.81877 45.744 6.49093 45.744 6.49093H35.6396C35.5079 6.49093 35.4003 6.38324 35.4003 6.25163V2.14645C35.4003 2.01483 35.5079 1.90715 35.6396 1.90715H52.6334C52.6334 1.90715 52.6274 4.18288 52.6418 5.17239C52.6454 5.41767 52.5341 5.57321 52.3833 5.73713C50.1543 8.15884 41.5048 17.6219 41.5048 17.6219H52.5042C52.6358 17.6219 52.7435 17.7296 52.7435 17.8612L52.7423 17.86Z",fill:"currentColor"}),o.createElement("path",{d:"M94.0631 22.0758H89.7353C89.6037 22.0758 89.496 21.9694 89.496 21.8377C89.4925 20.5539 89.4733 14.3919 89.4769 11.3696C89.4769 10.6397 89.4195 9.92064 89.2041 9.21829C88.6142 7.29553 87.0528 6.12056 85.0367 6.07151C83.7122 6.0392 82.5288 6.37542 81.58 7.34578C80.8406 8.10196 80.4386 9.02686 80.2998 10.0642C80.2388 10.5213 80.2148 10.9879 80.2136 11.4498C80.2076 14.429 80.2088 20.5539 80.21 21.8365C80.21 21.9682 80.1023 22.0758 79.9707 22.0758H75.6047C75.4731 22.0758 75.3654 21.9705 75.3654 21.8389C75.3606 20.512 75.3403 13.9576 75.387 10.6349C75.4205 8.27546 76.1838 6.1433 77.78 4.36411C79.2062 2.77516 80.9973 1.84189 83.1056 1.52243C84.8441 1.258 86.5658 1.3286 88.2254 1.93642C91.4727 3.12454 93.3954 5.47924 94.093 8.83302C94.2557 9.61314 94.3072 10.4268 94.3131 11.226C94.3335 14.3321 94.3083 20.5503 94.3036 21.8401C94.3036 21.9717 94.1959 22.077 94.0643 22.077L94.0631 22.0758Z",fill:"currentColor"}),o.createElement("path",{d:"M97.2196 1.90527H101.482C101.613 1.90527 101.721 2.01176 101.721 2.14338L101.772 21.9035C101.772 22.0363 101.666 22.144 101.533 22.144H97.2256C97.094 22.144 96.9863 22.0363 96.9863 21.9047L96.9803 2.14457C96.9803 2.01296 97.088 1.90527 97.2196 1.90527Z",fill:"currentColor"}),o.createElement("path",{d:"M17.1795 0.0270299C16.9776 -0.0551712 16.7491 0.057251 16.6911 0.267589C16.6706 0.342537 16.6476 0.417486 16.6234 0.491225C16.4022 1.1573 16.0299 1.76655 15.5197 2.27789C14.6566 3.14221 13.5082 3.61971 12.2861 3.62091H12.2825C11.0627 3.62091 9.91435 3.14584 9.05124 2.28394C8.54111 1.77381 8.16636 1.16455 7.94394 0.499687C7.91976 0.425947 7.89679 0.350999 7.87503 0.276051C7.81701 0.0657128 7.58854 -0.0455005 7.38666 0.0367007C6.20321 0.522655 5.108 1.17906 4.13125 1.97447C4.00795 2.07481 3.96806 2.24525 4.02729 2.39273C4.07686 2.51603 4.13004 2.63813 4.18565 2.7578C4.62204 3.70916 5.22888 4.58557 5.99166 5.34714C7.67316 7.02501 9.90589 7.94977 12.2813 7.94977H12.2897C14.6675 7.94736 16.9027 7.01897 18.5829 5.33626C19.3445 4.57348 19.9489 3.69586 20.3841 2.7445C20.4397 2.62362 20.4917 2.50153 20.5413 2.37823C20.6005 2.23075 20.5606 2.0603 20.4373 1.95997C19.4594 1.16576 18.3629 0.511775 17.1795 0.0270299Z",fill:"#97C3B9"}),o.createElement("path",{d:"M20.3984 21.2422C19.962 20.2933 19.3564 19.4193 18.596 18.6602C16.9133 16.9799 14.6733 16.0527 12.2979 16.0575C8.71131 16.0611 5.61789 18.196 4.2108 21.2604C4.1564 21.38 4.10321 21.5009 4.05244 21.623C3.992 21.7705 4.03189 21.9422 4.1564 22.0437C5.13435 22.8367 6.22956 23.4895 7.41181 23.973C7.61369 24.0552 7.84095 23.944 7.90018 23.7337C7.92073 23.6575 7.9437 23.5838 7.96908 23.5088C8.57713 21.698 10.2876 20.3888 12.3016 20.3864H12.3064C13.5261 20.3864 14.6745 20.8615 15.5376 21.7234C16.0466 22.2311 16.4189 22.8379 16.6413 23.5004C16.6667 23.5741 16.6897 23.649 16.7102 23.724C16.7694 23.9343 16.9967 24.0455 17.1986 23.9621C18.382 23.4762 19.476 22.821 20.4528 22.0256C20.5761 21.9252 20.616 21.7536 20.5567 21.6061C20.5072 21.4828 20.454 21.3619 20.3984 21.241V21.2422Z",fill:"#97C3B9"}),o.createElement("path",{d:"M0.494416 9.85376C0.31309 9.85376 0.161985 9.98795 0.13539 10.1669C0.045936 10.7676 0 11.3829 0 12.0091C0 12.6401 0.0483536 13.2603 0.141434 13.8659C0.169238 14.0448 0.320343 14.1778 0.501669 14.1778L24.0934 14.1427C24.2747 14.1427 24.4258 14.0086 24.4524 13.8296C24.5419 13.2288 24.589 12.6135 24.5878 11.9862C24.5878 11.3551 24.5395 10.735 24.4464 10.1294C24.4186 9.95047 24.2675 9.8175 24.0862 9.8175L0.494416 9.85256V9.85376Z",fill:"#97C3B9"}))))`
6
+ height: ${xt.sp4};
7
+ width: 102px;
8
+ color: ${a=>a.theme.colors.primary};
9
+ cursor: pointer;
10
+ `;export{r1 as default};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-CzCs-qU3.js";import{a as d}from"./sentry-CWp8Ph3h.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-BBG4mxvC.js";import{fI as P,Z6 as w,YP as R,HR as E,HL as q,HP as A,HE as K,YR as Y,HI as ae,HT as oe,HH as Z,HW as z,HS as C}from"./zeni-epic-state-FRanwwFO.js";import{z as T,w as J,bZ as pe,r as O,bT as G,b_ as le,E as M,a7 as Q,b$ as se,c0 as ne}from"./index-De2R2YuA.js";import"./mui-B2F_PvWe.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-ChXGgpkg.js";import ie from"./NotFoundScreen-BXryZNID.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]="800cdb95-a90c-4828-bf21-b0325f733131",e._sentryDebugIdIdentifier="sentry-dbid-800cdb95-a90c-4828-bf21-b0325f733131")}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(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),T.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},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(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),T.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,I,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(Z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(Z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(H,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
1
+ import{j as u}from"./liveblocks-DVkNRe2z.js";import{a as d}from"./sentry-BcU4ynZK.js";import{h as U,g as B,u as j,j as y,N as H,l as V,i as W,n as te,o as x}from"./core-vR5k5yHJ.js";import{fF as P,Z0 as w,YJ as R,HL as E,HF as q,HJ as A,Hy as J,YL as K,HC as ae,HN as oe,HB as Y,HQ as z,HM as C}from"./zeni-epic-state-BmF1nplD.js";import{z as O,w as M,b_ as pe,q as T,bU as Q,b$ as le,E as Z,a8 as G,c0 as se,c1 as ne}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-DZMnuINe.js";import ie from"./NotFoundScreen-D_hX2Dzv.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]="759eaa3a-209e-418c-8497-a31855b30031",e._sentryDebugIdIdentifier="sentry-dbid-759eaa3a-209e-418c-8497-a31855b30031")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={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(H,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(Y(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.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(z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(Y(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
@@ -0,0 +1,119 @@
1
+ import{j as a}from"./liveblocks-DVkNRe2z.js";import{h as K,u as le,g as X,i as te,j as k,N as ee,l as Q,q as ia,n as oa,o as f}from"./core-vR5k5yHJ.js";import{fF as H,Yj as Ue,bq as kt,Sj as la,bo as wt,bJ as de,Yk as Ct,G$ as Bt,Io as Ve,HC as sa,bn as Ae,Yl as ra,Ym as ca,c8 as da,Yn as ua,l$ as xt,Yo as At,Yp as Et,IS as _e,Hi as Be,Yq as pa,GP as at,Yr as ma,MH as ba,GT as ha,GZ as Dt,Ys as Se,Yt as Me,Ip as Oe,Hf as Tt,Yu as ga,Yv as Sa,Is as Ne,Yw as ya,Iy as fa,Yx as jt,I1 as nt,I6 as Ia,Yy as va,Yz as ce,YA as Pt,YB as Ft,YC as Rt,gV as ka,Hn as $e,cG as Vt,YD as wa,gh as Ca,YE as Ba,YF as xa,d_ as $t,dZ as Lt,YG as Ye,YH as Aa,YI as Ea,WT as ze,YJ as Da,WU as ie,WV as Ze,YK as Ta,YL as ja,YM as Pa,I8 as it,I5 as Fa,YN as Ra,YO as Va,YP as $a,HT as La,YQ as Ga,YR as Ua,cu as Gt,da as Ut,ma as _a,bO as Ma,br as _t,bP as Mt,G3 as Oa,YS as Na,Mu as Ya,MA as za,Cd as Za,Iq as Ha,IZ as Wa,mn as ge,YT as qa,YU as Ot,mR as Ja,mh as Nt,mC as Yt,mB as ot,bE as pe,bN as Ka,YV as Xa,YW as ye,kN as Qa,YX as lt,YY as en,kR as tn,la as an,Jb as nn,YZ as on,mK as ln,J1 as sn,Y_ as st,J5 as rn,Ja as cn,J8 as dn,I$ as un,Y$ as zt,H8 as pn,Z0 as mn,Z1 as bn,gG as hn,gF as gn,gE as Sn,mq as yn,mI as rt,mT as fn,uX as In,mz as vn,J3 as kn,kX as wn,mY as Cn,Z2 as Bn,kP as xn,uO as An,Z3 as En,HZ as Dn,bK as Tn,bt as jn,Ui as Pn,dd as Fn,dc as Rn,cF as Vn,cM as $n}from"./zeni-epic-state-BmF1nplD.js";import{E as ue,z as L,K as fe,at as He,o as oe,S as g,bj as We,a8 as se,H as A,a9 as Ee,k as j,bw as Ln,a5 as Z,aw as qe,p as T,a2 as Ie,bx as ct,by as dt,bz as Gn,aA as Un,ag as _n,aT as Mn,ac as Zt,G as De,ah as Je,bA as On,af as Ht,bB as Nn,ar as Yn,V as Wt,w as zn,bC as Zn,bD as Hn,bE as Wn,bF as qn,bG as Jn,bH as Kn,bI as Xn,bJ as Qn,bK as ei,O as ti,bL as ai,bt as ni,bM as ii,aj as oi,bN as li,f as si}from"./index-1ujiYIu0.js";import{n as U,S as ri}from"./mui-Bf4yQzNc.js";import{A as ut}from"./AddressScreen-C6LJsN0I.js";import{g as ne,a as Te,i as qt,V as Ke,b as Xe,c as ci,v as di,d as ui,A as me,D as be}from"./DomesticWireDetailScreen-BQJTKZiM.js";import{a as S}from"./sentry-BcU4ynZK.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-Daw0Xdbp.js";import{u as Jt}from"./useInitialThreadRequest-CujqTgMw.js";import{u as pi}from"./BusinessVerificationPageScreen-BgP8jWXu.js";import xe from"./NotFoundScreen-D_hX2Dzv.js";import{D as mi}from"./DrawerScreen-BUdO6BQE.js";import{M as Kt}from"./MobileAppDrawer-BdOhYCo5.js";import{F as Xt}from"./FeaturePreviewScreen-DLzs5A8g.js";import{S as je}from"./SetupPagesScreen-DLgnlxEs.js";import{B as bi}from"./BillPayApprovalRoutes-DzANWOc3.js";import{F as hi}from"./ScreenRoutes-6gUtsuNq.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./routePaths-Du4I9ue1.js";import"./InboxNotificationsProvider-C8gkRzEM.js";import"./useTaskManagerAccess-DmtbEonm.js";import"./analyticsHelper-1gGrcOYN.js";import"./ReimbursementApprovalRuleDetailScreen-DZMnuINe.js";import"./getLocaleForTenant-DlNsSiyY.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cd4773c1-b8f7-4bac-9f07-40fc88f4fe9f",e._sentryDebugIdIdentifier="sentry-dbid-cd4773c1-b8f7-4bac-9f07-40fc88f4fe9f")}catch{}})();const gi=Q((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:y,isMarkAsPaidBtnVisible:h}=ra(l.billActivities,ca(t.currentTenant),n);i=y,d=h}const p=da(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ua(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))(Ln);function Si(){const e=K(),t=le(),l=X(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>H(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const y=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y,[b,I]=S.useState(!1),[E,B]=S.useState(!1),[x,_]=S.useState(!1),{useFeatureGate:D,useDynamicConfig:C}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=C(We.zeniAssistConfig),v=la(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=D(g.billPaySetupShowInternationalPaymentByWise);if(S.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),S.useEffect((()=>{n!=null&&t(Ct(n))}),[n]),S.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Bt(n??"",O,$,!1)))}),[b,s,n,t]),S.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(B(!0),t(Ve(!1,O,$,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[E,s,n,t,O,$,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(gi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,yi={containerWidth:new Zt(100,58)},mt=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Mn);function w({appContent:e}){const t=le(),l=K(),{billId:n}=te(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),B=k((F=>H(F)));pi();const[x,_]=S.useState(!1),[D,C]=S.useState(!1),[O,V]=S.useState(!1),[W,N]=S.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const J=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;S.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),S.useEffect((()=>{Y==="Not-Started"&&(u&&D?C(!1):!u&&x&&_(!1))}),[n]),S.useEffect((()=>{x||n==null||u||(_(!0),t(Bt(n,y,E,!1)),t(Tt(n)),D||(C(!0),t(Ve(!1,y,E,b,n)))),u&&!D&&(C(!0),t(Ve(!1,y,E,b,n)))}),[x,D,u,n,t,y,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","no"),t(ga({file:W,billId:n}))}},G=S.useCallback((()=>{const F=Z(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(B.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,B.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:J}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Gn,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Un,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(fi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Ii(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:vi(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function fi(){const{triggerBack:e}=On();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Ii(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(wi,{children:`${Le.recurringBill.recurringCycle}
2
+ ${n}/${c}`}),a.jsx(Ci,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=U.div`
3
+ margin-bottom: 20px;
4
+ margin-top: 20px;
5
+ margin-left: ${A.sp5};
6
+ position: absolute;
7
+ display: flex;
8
+ align-items: center;
9
+ `,ki=U.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
+ `,wi=U(Je.StandardMedium)``,Ci=U((e=>S.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},S.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"}),S.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
+ `,Qt=U((e=>S.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},S.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
+ `,Pe=U.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
+ `,Fe=U.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
+ `,ht=U.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
+ `,Re=U.div`
63
+ display: flex;
64
+ flex-direction: column;
65
+ width: ${e=>`${yi.containerWidth.value(e.windowSize)}%`};
66
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
+ `,Bi=U(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=U(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
+ `,Ai=Q((function(e,t){return{billsReviewView:jt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/bills`),e(ce())},onCloseReviewItem:l=>{e(va(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(Ia());break;case"approve":case"review":e(nt("approved",n??""));break;case"reject":e(nt("rejected",n??""))}}}}))(Nn);function Ei({tenantEmailDomain:e}){const t=K(),l=k((c=>c.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:n}=k((c=>jt(c)));return S.useEffect((()=>{l!=="Completed"&&n.length!==0||t(`/${e}/bills`)}),[l,n.length,e]),a.jsx(Ai,{navigate:t,analytics:j,tenantEmailDomain:e})}const ae=Ea(),ea="bulk-operation-update",Ge="bill-approval-rule-update",{common:we}=De.getLocalizedStrings(),Di=U.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
+ `,Ti=Q((function(e,t){const l=L.getSignedInUser(),n=Ae(l),c=Rt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=ze(e,"common"),s=e.tenantState.currentTenantId,i=H(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,y=c.fetchState,h=Da(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:y,analytics:j,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Pt(o))},onSubtabChange:o=>{e(ce()),e(Ft(o))},onTransactionClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Pi(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;j?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=T(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(Ga(o))},onReloadTransactions:()=>{e($e(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(La(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e($a({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&j.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&j.trackSpendManagementDownloadClick("bill_pay"),e(Va({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Ra(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Fa(o,s??""));break;case"send_for_approval":e(it("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(it("approve")),t.navigate("./bulk-review");break;case"review":e(Pa()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ge)&&e(ja(!1))},onEventReceived:o=>{o===ea&&e(Ta())},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"))}}}}))(zn(Zn));function ji(){const e=K(),t=le(),l=X(),n=Ie(),c=l.state,r=fe(),[u,o]=S.useState(!1),[s,i]=S.useState(null),d=ia("/:tenantEmailDomain/bills/bulk-review")!=null;S.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Pt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ce())})),[]);const p=L.getSignedInUser(),m=k((P=>H(P))),{areTenantIdsInSync:y}=Yn(),[h,b]=S.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:E}=I(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:B}=I(g.isBillPayCommentingEnabled),{isFeatureEnabled:x}=I(g.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=I(g.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:D}=I(g.isBillPayBulkActionEnabled),{isFeatureEnabled:C}=I(g.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:O}=I(g.isBillPayDetectInsufficientFundsEnabled),V=k((P=>Rt(P,ae,D,p?.userId))),{isFeatureEnabled:W}=I(g.isDebitCardFeatureEnabled),N=V.fetchState,{isAiCfoAccessEnabled:v,onAskAiCfoClick:Y}=Qe({mobileExploreReferrer:"Bills List"});He({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,$=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=k((P=>ka(P.companyState,m.companyId))),J=q?.company.featuresActivationInfo.connectedAccountProvider;if(S.useEffect((()=>{!h&&$&&y&&(b(!0),t($e(ae,!0,E,C)))}),[h,ae,y,t]),p==null)throw Error("Can't access address page without signing in...");const z=(P,re)=>{t(Aa({uiState:{sortKey:P,sortOrder:re},period:ae}))},G=Vt(r?.loggedInUserRoleMap),F=de(r?.loggedInUserRoleMap),ve=P=>{o(P)},{billsProcessed:ke,billsProcessing:et}=k((P=>wa(P)));S.useEffect((()=>{ke===et&&s!=null&&(t(Ca({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:ke>1?we.headers.bills:we.texts.bill2},{variableName:"_has_",variableValue:ke>1?we.texts.have:we.texts.has},{variableName:"_action_",variableValue:Ba(s)}]})),t(xa()),setTimeout((()=>{t($e(ae,!0,E,!0,C))}),3e3),i(null))}),[ke,et]);const ta={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${ea}`,`private-encrypted-${m.companyId}.${Ge}`]:[],eventCallback:(P,re,tt)=>{P.endsWith(Ge)?tt.onBillPayApprovalRulesEventReceived?.(P):re?.entity_type==="bill"&&(i(re.operation_type),tt.onEventReceived(P))}},aa=$t(W,m),na=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Xt,{}):$?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(Ee,{analytics:j,onLoad:P=>(re=>re.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ve}),a.jsx(mi,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(Fi,{onClick:P=>P.stopPropagation(),children:a.jsx(Ei,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Ti,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:B,isReimbursementCommentingEnabled:x,period:ae,isAdmin:!1,uiState:V.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:G,isShowDeletedBillsEnabled:E,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:D,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ve(!0)},isDownloadEnabled:V.isDownloadEnabled,connectedAccountProvider:J,bulkSubmissionLimit:V.billBulkSubmissionLimit,bulkSubmissionFetchState:V.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:V.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:C,isDetectInsufficientFundsEnabled:O,isAiCfoAccessEnabled:v,onAskAiCfoClick:Y,...ta})]})]}):M===!0&&F===!0?a.jsx(ee,{to:"../setup"}):r!=null&&Ye(m,r.loggedInUserRoleMap)?a.jsx(ee,{to:"../promo"}):a.jsx(se,{fetchState:N}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=U(ri)`
89
+ display: flex;
90
+ min-height: 100%;
91
+ flex-direction: column;
92
+ `,{common:{currency:he},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=De.getLocalizedStrings(),$i=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=Z(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ae(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Vi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ma(t.billDetailsView.paymentDetailsSection?.paymentType?.method),y=t.currentTenant.createTime,h=_t(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=y.add(b,"month").isAfter(h),E=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Mt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),B=H(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,analytics:j,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:B.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:E,isZeniUser:d,isNewUser:I,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(ot(i));const d=St(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Nt(d,!1)),e(Yt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(ot());const p=St(s,void 0,l),m=T(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Oe(i))},onSaveChangesToLocalStore:(i,d,p,m,y)=>{const h=_i(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:y}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ja({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Ot("draft"))},reviewBillDetails:()=>{const i=Li(s,l),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(qa()),onClickDismiss:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=T(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=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=Gi(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Ui(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=qt(s,l,i),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(i,d)=>{const p=Te(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=Z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(Ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Wa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Jn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Ha(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Za("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Ya(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function gt(){const e=K(),t=X(),l=le(),{billId:n,tenantEmailDomain:c}=te(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(g.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(g.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(g.isRecurringBillsFeatureEnabled),{isFeatureEnabled:h}=r(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(g.isShaDisabled),{isFeatureEnabled:I}=r(g.isOurDisabled),{isFeatureEnabled:E}=r(g.isBillPayDetectInsufficientFundsEnabled),{configValue:B}=u(We.sameDayAchDisablementConfig),x=Ua(B),_=L.getSignedInUser(),D=k((G=>H(G))),C=k((G=>Me(G,m,h,n))),O=Jt(D?.companyId,{clearParams:C.fetchState==="Completed"}),{isAiCfoAccessEnabled:V,onAskAiCfoClick:W}=Qe({mobileExploreReferrer:"Bill Details"});He({isDataReady:C.fetchState==="Completed"});const N=D.companyId??L.getSignedInUserTenant(c)?.companyId,v=fe(),Y=Gt(v?.loggedInUserRoleMap),M=Ut(v?.loggedInUserRoleMap),$=de(v?.loggedInUserRoleMap),q=wt(D.userRole);if(S.useEffect((()=>{n!=null&&l(Ct(n))}),[n]),S.useEffect((()=>{n!=null&&l(Tt(n))}),[n,l]),_==null)throw Error("Can't access address page without signing in...");const J=k((G=>_a(G.accountState,G.accountListState,"billPayAccountList"))),z={pathname:"../",search:t.search};return C.isDeleted===!0||C.billStage=="paid"||C.fetchState=="Not-Started"?a.jsx(ee,{to:z}):C.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:C.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:G=>(F=>{n!=null&&C.deleteStatus.fetchState!=="Completed"&&F.trackBillPayEditBill(n,C.isRecurring)})(G)}),a.jsx($i,{initialOpenThreadRequest:O??void 0,location:t,navigate:e,currentTenant:D,billId:n,companyId:N,billDetailsView:C,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:J,isInternationalPaymentShaVsOurEnabled:i,vendor:C.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:I,isRecurringBillsFeatureEnabled:y,hasZeniAccountsAdminAccess:Y,isZeniAccountsUser:M,isBillPayAdmin:$,isSuperAdmin:q,isDetectInsufficientFundsEnabled:E,sameDayAchDisablementConfig:x,isAiCfoAccessEnabled:V,onAskAiCfoClick:W})]})}const St=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Li=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Gi=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",_i=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?pe(t.whatFor.invoiceDate.toString()):_t(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(Ka)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Ri.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},y=Mi(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(y).length>0?Wn(y):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:y,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Mi=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=qn(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},Oi=U.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
+ `,Ni=Q((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=Me(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(en({data:i}))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??yt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Xe(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Qa({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??yt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Kn);function Yi(){const e=K(),t=X(),l=Ie(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=ue(),o=L.getSignedInUser(),s=k((h=>H(h))),i=Z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((h=>ye(h,n))),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(g.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Oi,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Ni,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:y})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.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
+ `,Zi=Q((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(cn(s)),p&&e(dn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(rn(s,i,d,!1))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(st())},onAddressClick:s=>{const i=Xe(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(st())}}}))(Xn);function Hi(){const e=K(),t=X(),l=Ie(),{vendorId:n,billId:c}=te(),r=le(),u=ue(),o=L.getSignedInUser(),s=k((x=>H(x))),i=Z(t.state?.pathnameStackToGoBack),[d,p]=S.useState(!1),m=k((x=>x.vendorViewState.newVendorState.fetchStatus.fetchState)),y=k((x=>n!=null?x.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?y:m;S.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,I]=S.useState(!1);S.useEffect((()=>{b||h==="In-Progress"||(I(!0),r(nn(c,n)))}),[b,h,r]);const E=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",B=k((x=>ye(x,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return E==="billDetail"&&B.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:B.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(zi,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:E})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},It=U.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
+ `,Wi=Q((function(e,t){const l=L.getSignedInUser(),n=zt(e,t.billId),c=mn(e),r=Ae(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Mt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:j,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=T(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:n,data:s})),e(_e(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(At({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Ot("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}}))(ei);function vt(){const e=K(),t=le(),l=X(),{billId:n}=te(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(g.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=L.getSignedInUser(),{isFeatureEnabled:i}=c(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(g.isBillPayCommentingEnabled),m=Z(l.state?.pathnameStackToGoBack),{poppedPathname:y}=m,{isFeatureEnabled:h}=c(g.isRecurringBillsFeatureEnabled),b=k((B=>H(B))),I=k((B=>zt(B,n))),E=I.fetchState??"Not-Started";if(S.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),S.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),S.useEffect((()=>{const B=I.vendor?.name,x=I.vendor?.id,_=I.totalAmount.amount,D=I.recipientTotalAmount.amount,C=I.invoiceNumber;B&&x&&t(pn(B,x,_,D,C,n))}),[]),y==null)return a.jsx(ee,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return E==="In-Progress"?a.jsx(It,{windowSize:o,children:a.jsx(Qn,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:h,isDetectInsufficientFundsEnabled:u})})}const qi=Q((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=ze(e,"common"),r=l!=null?"edit":"create",u=H(e),o=L.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Ht.fileMicroServiceBaseUrl}`,authParams:i,analytics:j,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(An(i))},saveVendorDetailLocalData:i=>{e(Yt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(rt(u))},updateSelectedVendorForCreate:i=>{e(Cn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):ui(s,t.billId,u):p=di(s,t.billId,u);const m=T(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?kn(i,"vendor",u):wn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Xe(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(vn({files:i}))},onEditFileName:(i,d)=>{e(In(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(rt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(yn(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(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ci(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(Sn(i,"BillPayVendor"))},onResendOtp:i=>{e(gn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(hn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(bn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Nt(i,!1))}}}))(ii),Ce=()=>{const e=K(),t=le(),l=ti(),n=X(),{billId:c,vendorId:r}=te(),u=k((b=>H(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(g.isBillPayLocalCurrencyFeatureEnabled),[i,d]=S.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ye(b,r))),y=k((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?y:p;return S.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):h==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Ke,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=Q((function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:j,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(li),Ki=()=>{const e=oi(),t=K(),l=X(),{tenantEmailDomain:n}=te(),[c,r]=S.useState(!1),u=ue(),o=k((h=>H(h))),s=o.companyId??L.getSignedInUserTenant(n)?.companyId,i=L.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),y=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(ee,{to:"../../bills/setup"}):p===!1||d!=null&&Ye(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:h=>(b=>b.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:c,handleDrawerToggle:y}),a.jsx(Ji,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{y(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function Po(){const e=k(($=>H($))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Yi,{isFeatureEnabled:o}=c(g.isDebitCardFeatureEnabled),s=$t(o,e),i=Lt(e),d=X(),p=e?.userRole!=null&&kt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),y=Vt(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Tn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,I=b&&Gt(t?.loggedInUserRoleMap),{isFeatureEnabled:E}=c(g.isChargeCardFeatureEnabled),B=si(e,E,o)&&!p,x=B&&jn(t?.loggedInUserRoleMap),_=Pn(t?.loggedInUserRoleMap),D=Ut(t?.loggedInUserRoleMap),C=Fn(t?.loggedInUserRoleMap),O=b&&D,V=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&C,W=Rn(t?.loggedInUserRoleMap),N=Vn(t?.loggedInUserRoleMap),v=$n(t?.loggedInUserRoleMap),Y=B&&W,{tenantEmailDomain:M}=te();return a.jsxs(oa,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(f,{path:"setup",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(f,{path:"verification",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(f,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(f,{path:"approval-rules/*",element:m?a.jsx(bi,{}):a.jsx(hi,{showZeniAccountRoute:O,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:v,showTreasuryRoute:V,isTenantBankingOnly:s,showChargeCardRoute:Y,tenantEmailDomain:M??""})}),a.jsx(f,{path:"international-wire",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(f,{path:"*",element:a.jsx(ji,{})}),(s===!0||i===!0)&&a.jsx(f,{path:"/*",element:a.jsx(Xt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(f,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&Ye(e,t.loggedInUserRoleMap)&&a.jsx(f,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(f,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(f,{path:":billId",element:a.jsx(w,{appContent:a.jsx(Si,{})})}),a.jsx(f,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(f,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(f,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(f,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(f,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(f,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:"*",element:a.jsx(xe,{})})]}):a.jsx(f,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(f,{path:"*",element:a.jsx(xe,{})})]})}export{Po as default};
@@ -1,4 +1,4 @@
1
- import{a as V}from"./sentry-CWp8Ph3h.js";import{u as G,j as T,h as ne,g as se,i as oe,N as ie,l as re}from"./core-BBG4mxvC.js";import{fI as z,HL as ce,Zh as ue,BK as de,Ss as pe,HZ as le,L9 as me,NY as fe,OC as ye,Pr as Se,Zi as ge,Zj as Ie,Zk as he,Zl as Te,Zm as be,Vw as De,Yn as Oe,VL as Ce,Md as ke,VM as Ve,Mh as we,mK as Ae,gJ as Ne,gI as Fe,gH as _e,v1 as ve,uU as xe,uR as Be,mC as Ee,BT as ze,BR as R,bF as L,C3 as P,cF as Re}from"./zeni-epic-state-FRanwwFO.js";import{bT as Le,_ as Pe,c as Me,bi as Ue,z as E,a8 as je,j as M,r as x,T as B,bV as Ze,ae as Ge,p as U,aG as j}from"./index-De2R2YuA.js";import{n as He}from"./mui-B2F_PvWe.js";import{j as k}from"./liveblocks-CzCs-qU3.js";import{d as Z}from"./routePaths-BRju88LA.js";import{M as qe}from"./MobileAppDrawer-B_zpLZqx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="679a6f59-7ff7-4783-8dad-c1e70900daf1",t._sentryDebugIdIdentifier="sentry-dbid-679a6f59-7ff7-4783-8dad-c1e70900daf1")}catch{}})();function nt(){const t=G(),u=T((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Le(n),p=T((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const Ke=He.div`
1
+ import{a as V}from"./sentry-BcU4ynZK.js";import{u as G,j as b,h as ne,g as se,i as oe,N as ie,l as re}from"./core-vR5k5yHJ.js";import{fF as z,HF as ce,Zb as ue,BE as de,Sm as pe,HT as le,L3 as me,NS as fe,Ow as ye,Pl as Se,Zc as ge,Zd as Ie,Ze as he,Zf as be,Zg as Te,Vq as De,Yh as Oe,VF as Ce,M7 as ke,VG as Ve,Mb as we,mH as Ae,gG as Ne,gF as Fe,gE as ve,uX as _e,uO as Ee,uL as Be,mz as xe,BN as ze,BL as L,bE as P,BZ as R,cE as Le}from"./zeni-epic-state-BmF1nplD.js";import{bU as Pe,K as Re,o as Me,bj as Ue,z as x,a9 as je,k as M,q as E,V as B,bW as Ze,af as Ge,p as U,aH as j}from"./index-1ujiYIu0.js";import{n as qe}from"./mui-Bf4yQzNc.js";import{j as k}from"./liveblocks-DVkNRe2z.js";import{d as Z}from"./routePaths-Du4I9ue1.js";import{M as He}from"./MobileAppDrawer-BdOhYCo5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="789e8062-a397-4aac-a1f6-4d6a33c54f8b",t._sentryDebugIdIdentifier="sentry-dbid-789e8062-a397-4aac-a1f6-4d6a33c54f8b")}catch{}})();function nt(){const t=G(),u=b((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=b((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const We=qe.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{a as V}from"./sentry-CWp8Ph3h.js";import{u as G,j as T,h as ne,g as se,i
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${t=>t.theme.colors.grey4};
9
- `,Ye=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=E.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},b=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ge.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:b,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:b}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:H,companySourceOfFundsDescription:q,transactionVolume:K,transactionVolumeDescription:Y,purposeOfAccount:$,purposeOfAccountDescription:J,regulatedStatus:W,regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee}=e,_=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Re(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?L(f?.toString()):f,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:j(v)))??[],companySourceOfFunds:H?.selectedOption??"",companySourceOfFundsDescription:q,transactionVolume:K?.selectedOption??"",transactionVolumeDescription:Y,purposeOfAccount:$?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:W??"",regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(P({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=m;let h;return S.selectDocumentType==="driverLicense"?h="driving_license":S.selectDocumentType==="passport"?h="passport":S.selectDocumentType==="stateId"?h="id_document":S.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?j(I.selectedOption):void 0,phone:l,birthday:o!=null?L(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(P({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=Z(b,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=Z(b,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(Ee({files:e}))},onDeleteFile:e=>{t(Be(e))},onDeleteFileList:e=>{t(xe(e))},onEditFileName:(e,s)=>{t(ve(e,s.split(".")[0]))},onGetOtp:e=>{t(_e(e,"SpendManagementSetup"))},onResendOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ne(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ae({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Ve(e.documentType);s!=null&&t(we({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(ke({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ze),st=({productType:t})=>{const u=ne(),n=se(),i=G(),[d,p]=V.useState(!1),[r,b]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=Pe(),{useDynamicConfig:m}=Me(),{configValue:O}=m(Ue.zeniAccountsConfig),C=ue(O),g=T((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),y=T((a=>a.companyConfigState.fetchState)),I=T((a=>a.userRoleConfigState.fetchState)),c=T((a=>z(a))),o=c.companyId??E.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),V.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{b(a)},S=T((a=>{switch(t){case"zeni_accounts":return be(a,o);case"zeni_treasury":return Te(a,o);case"charge_cards":return he(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?k.jsx(ie,{to:"../promo"}):k.jsxs(Ke,{children:[k.jsx(je,{analytics:M,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(B.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(B.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(B.Event.billPayBusinessVerification,x(n)?"Settings":void 0)}})(a)}),x(n)?k.jsx(qe,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,k.jsx(Ye,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:M,currentTenant:c,productType:t,isSettings:x(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};
9
+ `,$e=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=x.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ge.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:q,companySourceOfFundsDescription:H,transactionVolume:W,transactionVolumeDescription:$,purposeOfAccount:K,purposeOfAccountDescription:X,regulatedStatus:Y,regulatedStatusDescription:J,usNexus:Q,usNexusTypes:ee}=e,v=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Le(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?P(f?.toString()):f,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((_=>_.length===2?_:j(_)))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:W?.selectedOption??"",transactionVolumeDescription:$,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:X,regulatedStatus:Y??"",regulatedStatusDescription:J,usNexus:Q,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(R({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=m;let h;return S.selectDocumentType==="driverLicense"?h="driving_license":S.selectDocumentType==="passport"?h="passport":S.selectDocumentType==="stateId"?h="id_document":S.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?j(I.selectedOption):void 0,phone:l,birthday:o!=null?P(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(R({officers:s}))},onSaveDetailsClick:e=>{t(L(n,e,i))},onSendForVerificationClick:e=>{t(L(n,e,i,!0))},onAddressClick:e=>{const s=Z(T,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=Z(T,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(xe({files:e}))},onDeleteFile:e=>{t(Be(e))},onDeleteFileList:e=>{t(Ee(e))},onEditFileName:(e,s)=>{t(_e(e,s.split(".")[0]))},onGetOtp:e=>{t(ve(e,"SpendManagementSetup"))},onResendOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ne(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ae({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Ve(e.documentType);s!=null&&t(we({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(ke({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ze),st=({productType:t})=>{const u=ne(),n=se(),i=G(),[d,p]=V.useState(!1),[r,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=Re(),{useDynamicConfig:m}=Me(),{configValue:O}=m(Ue.zeniAccountsConfig),C=ue(O),g=b((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),y=b((a=>a.companyConfigState.fetchState)),I=b((a=>a.userRoleConfigState.fetchState)),c=b((a=>z(a))),o=c.companyId??x.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),V.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),x.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{T(a)},S=b((a=>{switch(t){case"zeni_accounts":return Te(a,o);case"zeni_treasury":return be(a,o);case"charge_cards":return he(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?k.jsx(ie,{to:"../promo"}):k.jsxs(We,{children:[k.jsx(je,{analytics:M,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(B.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(B.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(B.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?k.jsx(He,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,k.jsx($e,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:M,currentTenant:c,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};