@zeniai/web-app-ui 5.3.30-qa → 5.3.31-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 (151) hide show
  1. package/dist/assets/{AccountMappingScreen-63FlaGuq.js → AccountMappingScreen-UdzIeE_v.js} +2 -2
  2. package/dist/assets/AddressRoutes-CaXv_Hc-.js +1 -0
  3. package/dist/assets/AddressScreen-Dmypz8Cm.js +9 -0
  4. package/dist/assets/AiCfoScreen-DNghBGiO.js +22 -0
  5. package/dist/assets/AppDrawer-kOTtyyGv.js +10 -0
  6. package/dist/assets/{BillPayApprovalRoutes-BNU4FGHS.js → BillPayApprovalRoutes--ALQ35-1.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-D9I2VGzJ.js → BillPayRoutes-BcTRlRv8.js} +9 -9
  8. package/dist/assets/{BusinessVerificationPageScreen-afqV4Atk.js → BusinessVerificationPageScreen-DzWgqXwG.js} +2 -2
  9. package/dist/assets/{CardsAiCfoScreen-C-AqWGUl.js → CardsAiCfoScreen-C_lk15md.js} +2 -2
  10. package/dist/assets/{ChargeCardRoutes-B5cZ1kQb.js → ChargeCardRoutes-BjIdSbvb.js} +1 -1
  11. package/dist/assets/{CompanyPassportScreen-BAW40Qn8.js → CompanyPassportScreen-BKrZbZ6U.js} +1 -1
  12. package/dist/assets/{ConnectionAuthScreen-CUZc6Ync.js → ConnectionAuthScreen-Dzixugfp.js} +2 -2
  13. package/dist/assets/CustomerOnboardingAuthScreen-D31TaCjo.js +1 -0
  14. package/dist/assets/CustomerOnboardingRoutes-3cZyVkRN.js +30 -0
  15. package/dist/assets/{DashboardRoutes-Booe42V4.js → DashboardRoutes-BruAIMYU.js} +4 -4
  16. package/dist/assets/{DefaultTenantHome-C5VDGeyO.js → DefaultTenantHome-BtIFl_77.js} +1 -1
  17. package/dist/assets/DomesticWireDetailScreen-DhMVIfNi.js +18 -0
  18. package/dist/assets/DrawerScreen-CbY0_Vl5.js +1 -0
  19. package/dist/assets/EntityDetailRoutes-DpM6LjT5.js +1 -0
  20. package/dist/assets/ExpenseAutomationRoutes-Dll0r-g6.js +25 -0
  21. package/dist/assets/FeaturePreviewScreen-DRMNz052.js +1 -0
  22. package/dist/assets/HubSpotOAuthCallbackScreen-CaSUfoGO.js +1 -0
  23. package/dist/assets/{InboxNotificationsProvider-BIRPulc1.js → InboxNotificationsProvider-55rQDTXA.js} +1 -1
  24. package/dist/assets/InvoicingRoutes-B8ytNofm.js +2 -0
  25. package/dist/assets/{MagicLinkRoutes-ghi5jd2V.js → MagicLinkRoutes-DbYU9yxF.js} +19 -19
  26. package/dist/assets/MagicLinkSignInScreen-DSGkqzLp.js +12 -0
  27. package/dist/assets/{MobileAppDrawer-BJV6BsMX.js → MobileAppDrawer-BAV0ejOs.js} +1 -1
  28. package/dist/assets/NotFoundScreen-ButYFiTG.js +1 -0
  29. package/dist/assets/NotificationRoutes-jy7KSYzl.js +1 -0
  30. package/dist/assets/OAuthConsentScreen-4W57tKq2.js +1 -0
  31. package/dist/assets/PandLWithForecastRoutes-Diz_Rn8O.js +1 -0
  32. package/dist/assets/PaymentLinkScreen-BcSDg2Q0.js +21 -0
  33. package/dist/assets/PeopleRoutes-BsxSMUvq.js +22 -0
  34. package/dist/assets/PerformanceRoutes-DFKVpzlk.js +1 -0
  35. package/dist/assets/{Preview-ByUhhrY0.js → Preview-DNAybQkC.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-BVlzA_ks.js → QBOConnectionScreen-BmXy-56M.js} +1 -1
  37. package/dist/assets/ReimbursementApprovalRoutes-DW0hPEhv.js +1 -0
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CGLqqLOn.js → ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-DyJDzvC0.js → ReimbursementRoutes-BQ18gzav.js} +9 -9
  40. package/dist/assets/ReportsRoutes-iapNY-Ca.js +1 -0
  41. package/dist/assets/RewardsRoutes-CO35jNo-.js +1 -0
  42. package/dist/assets/ScreenRoutes-B2fNAm1R.js +2 -0
  43. package/dist/assets/{SettingsRoutes-DxnIfIbH.js → SettingsRoutes-DU6XdEOY.js} +6 -6
  44. package/dist/assets/{SetupPagesScreen-C1Oev9K8.js → SetupPagesScreen-CPUD_j1y.js} +5 -5
  45. package/dist/assets/SignInScreen-DL2bXt_7.js +1 -0
  46. package/dist/assets/SignOutScreen-DSAHdKNP.js +9 -0
  47. package/dist/assets/{TaskListScreen-BFlHqYcu.js → TaskListScreen-BH2rdLa7.js} +2 -2
  48. package/dist/assets/{TaskRoutes-BmnOylhk.js → TaskRoutes-C-JJtR4s.js} +2 -2
  49. package/dist/assets/TransactionDetailRoutes-CaIXvpDL.js +1 -0
  50. package/dist/assets/TransactionDetailScreen-srWo_3sK.js +5 -0
  51. package/dist/assets/TransactionListRoutes-CpBDr1qT.js +1 -0
  52. package/dist/assets/TreasuryRoutes-Ja8FQwZH.js +37 -0
  53. package/dist/assets/VendorsRoutes-CoiOEvIl.js +112 -0
  54. package/dist/assets/WiseConfirmationScreen-Dj7QUTt6.js +12 -0
  55. package/dist/assets/{ZeniAccountRoutes-CRSCFOIu.js → ZeniAccountRoutes-BjLND6jg.js} +8 -8
  56. package/dist/assets/ZeniAccountStatementScreen-BgOPM6A3.js +9 -0
  57. package/dist/assets/{accountMappingHelper-CU6wucuM.js → accountMappingHelper-CAg2qsF3.js} +1 -1
  58. package/dist/assets/{analytics-BgUj-hR5.js → analytics-CqoRAkB1.js} +1 -1
  59. package/dist/assets/{analyticsHelper-CqV558Dq.js → analyticsHelper-Cjtujqyf.js} +1 -1
  60. package/dist/assets/{core-CMivCywN.js → core-CiFsHd3i.js} +1 -1
  61. package/dist/assets/{decodeURIComponentSafe-DRefzrWS.js → decodeURIComponentSafe-FYjI-TwW.js} +1 -1
  62. package/dist/assets/{dnd-B8NpvFCU.js → dnd-jcX4BW0a.js} +1 -1
  63. package/dist/assets/{empty-CllNfDt1.js → empty-4iGv0vIv.js} +1 -1
  64. package/dist/assets/{empty-CawgNJEF.js → empty-DSab5moc.js} +1 -1
  65. package/dist/assets/{emptyVideoElement-DBVZ22o5.js → emptyVideoElement-BSwv6rHf.js} +1 -1
  66. package/dist/assets/{epic-Cw47VvOB.js → epic-CjiXGW6W.js} +1 -1
  67. package/dist/assets/{expenseAutomationHelper-BuTA7ucx.js → expenseAutomationHelper-R2jHKv-Z.js} +1 -1
  68. package/dist/assets/getLocaleForTenant-CRduVQsY.js +1 -0
  69. package/dist/assets/{index-DCnLtCHg.js → index-0sENwUb_.js} +1 -1
  70. package/dist/assets/{index-BnHTUbKj.js → index-2FqIUc6q.js} +1 -1
  71. package/dist/assets/{index-CD-EymjZ.js → index-BJOxGHxN.js} +2 -2
  72. package/dist/assets/{index-baDCTZK3.js → index-CVbu1_bp.js} +1 -1
  73. package/dist/assets/{index-Cx55eHdr.js → index-Cz99TrBA.js} +1 -1
  74. package/dist/assets/{index-XoGDegrx.js → index-D6dzsKZ7.js} +1 -1
  75. package/dist/assets/{index-Djuwyi3d.js → index-DGRhh-da.js} +1 -1
  76. package/dist/assets/{index-D90YkzK-.js → index-juRht-9c.js} +11171 -11173
  77. package/dist/assets/{lexical-Di6ZXkXF.js → lexical-DBiumTDC.js} +1 -1
  78. package/dist/assets/{liveblocks-mJJR3MsR.js → liveblocks-CkQ2CY6T.js} +1 -1
  79. package/dist/assets/{lottie-BTBtSLCO.js → lottie-cUBeCDOE.js} +1 -1
  80. package/dist/assets/{mui-C6XtNCo7.js → mui-FQy08n5j.js} +1 -1
  81. package/dist/assets/{pathToGoBack-DkQc48Fj.js → pathToGoBack-DWIhT07R.js} +1 -1
  82. package/dist/assets/{pdf-DSDpdkmb.js → pdf-C6cPvWx8.js} +3 -3
  83. package/dist/assets/{pdf-lib-BbzL8H1t.js → pdf-lib-C9DR7g8H.js} +1 -1
  84. package/dist/assets/{plaid-l8YRzpBD.js → plaid-Dw5LGskq.js} +1 -1
  85. package/dist/assets/{pusher-B8Hm6DMT.js → pusher-Bs1ItrSl.js} +1 -1
  86. package/dist/assets/{react-BeA4fGXX.js → react-B-yGKA4G.js} +1 -1
  87. package/dist/assets/{react-TfJbQpIh.js → react-BD9-MMqW.js} +1 -1
  88. package/dist/assets/{react-FrhNEOT3.js → react-BK8OyR5e.js} +1 -1
  89. package/dist/assets/{react-CFob_XAv.js → react-BzoedhUW.js} +1 -1
  90. package/dist/assets/{react-hzw_vRmY.js → react-N2ByZQ0u.js} +1 -1
  91. package/dist/assets/{react-CexHjl19.js → react-Rj21KKGh.js} +1 -1
  92. package/dist/assets/{recharts-Co0_Dmc-.js → recharts-CYbL6OhC.js} +1 -1
  93. package/dist/assets/routePaths-DqksJ4i_.js +1 -0
  94. package/dist/assets/{sentry-CItQHKpv.js → sentry-Lj2WEO6K.js} +1 -1
  95. package/dist/assets/{url-MmuF1WQx.js → url-Bk85P8pL.js} +1 -1
  96. package/dist/assets/{url-xQ9KNY2e.js → url-DhKb0GNI.js} +1 -1
  97. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B3XyU0Fo.js +1 -0
  98. package/dist/assets/useAskAiCfoHostNavButtonProps-Dhoa0fnv.js +1 -0
  99. package/dist/assets/useChargeCardPusherEvents-YQlWLN09.js +1 -0
  100. package/dist/assets/{useDeviceId-DJLfe-br.js → useDeviceId-CWOFj37E.js} +1 -1
  101. package/dist/assets/useEmailConnectResultRefresh-DpIv7GW3.js +1 -0
  102. package/dist/assets/useInitialThreadRequest-D-SxLs4P.js +1 -0
  103. package/dist/assets/{useTaskManagerAccess-B60T1gBh.js → useTaskManagerAccess-BrCmQLIc.js} +1 -1
  104. package/dist/assets/{utils-macSqF2O.js → utils-DsJsAXTJ.js} +1 -1
  105. package/dist/assets/withTransactionSidePanel-BjLmCRfl.js +25 -0
  106. package/dist/assets/{zeni-epic-state-CqKBThJ0.js → zeni-epic-state-BdFiPfcm.js} +5 -5
  107. package/dist/index.html +1 -1
  108. package/package.json +4 -4
  109. package/dist/assets/AddressRoutes-BQZRAaHK.js +0 -1
  110. package/dist/assets/AddressScreen-_R6CTIVH.js +0 -9
  111. package/dist/assets/AiCfoScreen-C8gj-uzF.js +0 -22
  112. package/dist/assets/AppDrawer-BZUmu70o.js +0 -10
  113. package/dist/assets/CustomerOnboardingAuthScreen-9A7QgVmp.js +0 -1
  114. package/dist/assets/CustomerOnboardingRoutes-DXes1Er6.js +0 -30
  115. package/dist/assets/DomesticWireDetailScreen-7j7SGnOg.js +0 -18
  116. package/dist/assets/DrawerScreen-Csh3eD6J.js +0 -1
  117. package/dist/assets/EntityDetailRoutes-CCnyW919.js +0 -1
  118. package/dist/assets/ExpenseAutomationRoutes-DJxsaOLE.js +0 -38
  119. package/dist/assets/FeaturePreviewScreen-B6gcAXFm.js +0 -1
  120. package/dist/assets/HubSpotOAuthCallbackScreen-CXXQU19P.js +0 -1
  121. package/dist/assets/InvoicingRoutes-CBapzsSL.js +0 -2
  122. package/dist/assets/MagicLinkSignInScreen-BqpLWUSF.js +0 -12
  123. package/dist/assets/NotFoundScreen-BnVyPaPi.js +0 -1
  124. package/dist/assets/NotificationRoutes-DyI8Xbpv.js +0 -1
  125. package/dist/assets/OAuthConsentScreen-DBMBI1eP.js +0 -1
  126. package/dist/assets/PandLWithForecastRoutes-B5U8wcwH.js +0 -1
  127. package/dist/assets/PaymentLinkScreen-B8Npl8-P.js +0 -21
  128. package/dist/assets/PeopleRoutes-DtBr-ZhM.js +0 -22
  129. package/dist/assets/PerformanceRoutes-B2EvteS4.js +0 -1
  130. package/dist/assets/ReimbursementApprovalRoutes-6KXXnCKA.js +0 -1
  131. package/dist/assets/ReportsRoutes-Dgbt88Ii.js +0 -1
  132. package/dist/assets/RewardsRoutes-DXDaRicq.js +0 -1
  133. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BmkDgkpw.js +0 -25
  134. package/dist/assets/ScreenRoutes-y2py2Sx-.js +0 -2
  135. package/dist/assets/SignInScreen-ClZvL2fM.js +0 -1
  136. package/dist/assets/SignOutScreen-CZbE2s88.js +0 -9
  137. package/dist/assets/TransactionDetailRoutes-rQlONmP8.js +0 -1
  138. package/dist/assets/TransactionDetailScreen-DnBKsQvp.js +0 -5
  139. package/dist/assets/TransactionListRoutes-Sw1sTXcA.js +0 -1
  140. package/dist/assets/TreasuryRoutes-MfsBOpsN.js +0 -37
  141. package/dist/assets/VendorsRoutes-_P343ySG.js +0 -88
  142. package/dist/assets/WiseConfirmationScreen-DKZOBDOL.js +0 -12
  143. package/dist/assets/ZeniAccountStatementScreen-svNdptRn.js +0 -9
  144. package/dist/assets/getLocaleForTenant-eit0V2sf.js +0 -1
  145. package/dist/assets/routePaths-BRn4bxlT.js +0 -1
  146. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BKbzFDsb.js +0 -1
  147. package/dist/assets/useAskAiCfoHostNavButtonProps-CywXA9k2.js +0 -1
  148. package/dist/assets/useChargeCardPusherEvents-93KEXKtp.js +0 -1
  149. package/dist/assets/useEmailConnectResultRefresh-BmofwXI5.js +0 -1
  150. package/dist/assets/useInitialThreadRequest-ChCTxMqY.js +0 -1
  151. package/dist/assets/withTransactionSidePanel-CNiAqI18.js +0 -25
@@ -1,4 +1,4 @@
1
- import{j as B}from"./liveblocks-mJJR3MsR.js";import{a as o}from"./sentry-CItQHKpv.js";import{h as Y,g as Z,u as H,j as m,s as q,l as K}from"./core-CMivCywN.js";import{ai as W,O as ee,y as $,z as te,l as X,aj as ne,h as ae,Q as ce}from"./index-D90YkzK-.js";import{bn as se,fB as oe,gS as ie,ox as Q,TX as le,i5 as G,gd as re,oo as ue,TY as de,TZ as pe,tx as ge,lX as me,om as Ae,oi as be,ot as ye,i7 as Ie,T_ as fe,T$ as Se}from"./zeni-epic-state-CqKBThJ0.js";import{n as he}from"./mui-C6XtNCo7.js";import{M as Ee}from"./MobileAppDrawer-BJV6BsMX.js";import{q as R}from"./QBOConnectionScreen-BVlzA_ks.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-CU6wucuM.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]="1e6bede3-7c91-45bc-b051-43547199e72c",a._sentryDebugIdIdentifier="sentry-dbid-1e6bede3-7c91-45bc-b051-43547199e72c")}catch{}})();const r="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},xe=he.div`
1
+ import{j as U}from"./liveblocks-CkQ2CY6T.js";import{a as o}from"./sentry-Lj2WEO6K.js";import{h as W,g as H,u as K,j as m,s as R,l as Y}from"./core-CiFsHd3i.js";import{ag as Z,O as ee,y as q,z as te,l as G,ah as ne,h as ae,N as ce}from"./index-juRht-9c.js";import{bn as se,fB as oe,gS as ie,ox as X,TT as le,i5 as J,gd as re,oo as ue,TU as de,TV as pe,tx as ge,lX as me,om as be,oi as Ae,ot as fe,i7 as ye,TW as Ie,TX as Se}from"./zeni-epic-state-BdFiPfcm.js";import{n as he}from"./mui-FQy08n5j.js";import{M as Ee}from"./MobileAppDrawer-BAV0ejOs.js";import{q as $}from"./QBOConnectionScreen-BmXy-56M.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-CAg2qsF3.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]="7d8da5d4-feb0-47ba-a525-9b6c02ef6be0",a._sentryDebugIdIdentifier="sentry-dbid-7d8da5d4-feb0-47ba-a525-9b6c02ef6be0")}catch{}})();const r="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},xe=he.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as B}from"./liveblocks-mJJR3MsR.js";import{a as o}from"./sentry-CItQHKp
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${a=>a.theme.colors.grey4};
9
- `,ve=K((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(r),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:l=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:x,vendorsAccountSection:v,filing1099Section:w}=l,{incomeAccount:C,expenseAccount:T}=d,{billPayAccount:s}=z,{reimbursementsAccount:F}=x,{prepaidExpensesAccount:p,fixedAssetsAccount:V,accruedExpensesAccount:O}=v,{bankAccount:M,expenseCategory1099:j}=w,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),P=h(e.accountMappingView.expenseAccountList,T.selectedOption),y=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,F.selectedOption),k=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,V.selectedOptions),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),f=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,j),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:P?.accountId,selectedBillPayAccountId:y?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:k.map((n=>n.accountId)),selectedFixedAssetsAccountIds:D.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:f};a(Se({data:t}))},onBackClick:()=>{X(c)===!1?(i("../../dashboard"),a(fe())):a(G())},onSaveClick:()=>{a(Ie()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:l=>{a(ye(e.currentTenant.companyId,l))},onAccountingProjectsToggle:l=>{const d=sessionStorage.getItem(r);d===u.pending||d===u.ready||a(l?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=W(),e=Y(),i=Z(),c=H(),{useFeatureGate:A,useDynamicConfig:l}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:x,isDynamicConfigLoading:v}=l("transaction_categorization_config"),w=!v&&x?.capitalization_enabled===!0,C=te.getSignedInUser(),T=se(C),s=m((t=>oe(t))),{capitalizableAccounts:F,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:V,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),j=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[U,N]of g)N===null?delete n[U]:n[U]=N;const[S,J]=g[0]??[];S!=null&&c(Q(s.companyId,S,J,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>le(t.accountState)),q),P=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[y,_]=o.useState(!1),[k,D]=o.useState(!1);o.useEffect((()=>{y===!1&&(c(G()),_(!0))}),[y]);const I=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(r)===u.pending&&(sessionStorage.removeItem(r),c(re({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(r)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(r),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(r,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),f=t=>{D(t)};return B.jsxs(xe,{children:[B.jsx(Ee,{isAppContentDrawerOpen:k,handleDrawerToggle:f}),B.jsx(ve,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&T,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:w,capitalizableAccounts:F,accountNamesById:P,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:V,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:j,location:i,isSettings:X(i),onClickMenuIcon:()=>f(!0)})]})};export{r as P,_e as U,u as a};
9
+ `,ve=Y((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(r),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:b}=e;return{onAccountMappingChange:l=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:x,vendorsAccountSection:v,filing1099Section:w}=l,{incomeAccount:C,expenseAccount:T}=d,{billPayAccount:s}=z,{reimbursementsAccount:F}=x,{prepaidExpensesAccount:p,fixedAssetsAccount:V,accruedExpensesAccount:O}=v,{bankAccount:M,expenseCategory1099:P}=w,A=h(e.accountMappingView.incomeAccountList,C.selectedOption),_=h(e.accountMappingView.expenseAccountList,T.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),j=h(e.accountMappingView.reimbursementsAccountList,F.selectedOption),k=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),D=E(e.accountMappingView.fixedAssetsAccountList,V.selectedOptions),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),I=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,P),t={selectedIncomeAccountId:A?.accountId,selectedExpenseAccountId:_?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:j?.accountId,selectedPrepaidExpensesAccountIds:k.map((n=>n.accountId)),selectedFixedAssetsAccountIds:D.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:I};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(Ie())):a(J())},onSaveClick:()=>{a(ye()),b&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:l=>{a(fe(e.currentTenant.companyId,l))},onAccountingProjectsToggle:l=>{const d=sessionStorage.getItem(r);d===u.pending||d===u.ready||a(l?be(e.currentTenant.companyId):Ae(e.currentTenant.companyId))}}}))(ne),je=()=>{const a=Z(),e=W(),i=H(),c=K(),{useFeatureGate:b,useDynamicConfig:l}=ee(),{isFeatureEnabled:d}=b(q.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=b(q.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:x,isDynamicConfigLoading:v}=l("transaction_categorization_config"),w=!v&&x?.capitalization_enabled===!0,C=te.getSignedInUser(),T=se(C),s=m((t=>oe(t))),{capitalizableAccounts:F,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:V,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),R),M=o.useCallback(((t,n)=>{c(X(s.companyId,t,n))}),[c,s.companyId]),P=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,Q]=g[0]??[];S!=null&&c(X(s.companyId,S,Q,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),A=m((t=>le(t.accountState)),R),_=o.useMemo((()=>{const t={};for(const n of A)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[A]),[f,j]=o.useState(!1),[k,D]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),j(!0))}),[f]);const y=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(r)===u.pending&&(sessionStorage.removeItem(r),c(re({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(r)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(r),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(r,u.pending),c(de()),$.init("/connection/auth",s.tenantEmailDomain),$.handleClick())}),[y,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),I=t=>{D(t)};return U.jsxs(xe,{children:[U.jsx(Ee,{isAppContentDrawerOpen:k,handleDrawerToggle:I}),U.jsx(ve,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&T,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:w,capitalizableAccounts:F,accountNamesById:_,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:V,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:P,location:i,isSettings:G(i),onClickMenuIcon:()=>I(!0)})]})};export{r as P,je as U,u as a};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-CkQ2CY6T.js";import{A as o}from"./AddressScreen-Dmypz8Cm.js";import i from"./NotFoundScreen-ButYFiTG.js";import"./sentry-Lj2WEO6K.js";import{n as s,o as r}from"./core-CiFsHd3i.js";import"./zeni-epic-state-BdFiPfcm.js";import"./recharts-CYbL6OhC.js";import"./index-juRht-9c.js";import"./mui-FQy08n5j.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="31d0e0e8-dcf1-419d-b2be-6dc359df28c9",t._sentryDebugIdIdentifier="sentry-dbid-31d0e0e8-dcf1-419d-b2be-6dc359df28c9")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(o,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(o,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -0,0 +1,9 @@
1
+ import{j as n}from"./liveblocks-CkQ2CY6T.js";import{a as h}from"./sentry-Lj2WEO6K.js";import{h as T,u as P,g as j,i as E,j as B,l as D}from"./core-CiFsHd3i.js";import{$,E as M,z as U,V as L,a5 as K,a6 as z,h as C,N as S,a1 as N,T as b,a2 as R}from"./index-juRht-9c.js";import{Uy as _,il as V,fB as F,Uz as G,c7 as O,UA as q,mD as H}from"./zeni-epic-state-BdFiPfcm.js";import{n as J}from"./mui-FQy08n5j.js";import Q from"./NotFoundScreen-ButYFiTG.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]="3fa510e1-d7dc-49b2-9370-b1d1333fc69d",e._sentryDebugIdIdentifier="sentry-dbid-3fa510e1-d7dc-49b2-9370-b1d1333fc69d")}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=D((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=F(e),a=s.roleMap!=null&&G(s.roleMap),d=i||c==="user_address"||O(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=q(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=_(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=R(d?.pathnameStackToGoBack);let t=r.poppedPathname??v();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}o(t,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:a=>{const d=Y(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(N);function ne({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=P(),r=j(),{addressId:t,addressType:u}=E(),g=$(),I=M(),k=U.getSignedInUser(),[f,w]=h.useState(t==null),p=B((m=>t!=null?_(m,t).fetchState:"Not-Started")),A=L();if(k==null)throw Error("Can't access address page without signing in...");const x=m=>m.trackPageLoaded(t!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{f||t==null||(w(!0),d(V(t,!1)))}),[f,t,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address|invoicing_customer_billing_address|invoicing_subscription_shipping_address|invoicing_business_address)$/g)?!f&&p==="Not-Started"||f&&p==="In-Progress"?n.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(z,{analytics:C,onLoad:x}),n.jsx(W,{windowSize:g,children:n.jsx(X,{location:r,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):n.jsx(Q,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{ne as A,Y as t};
@@ -0,0 +1,22 @@
1
+ import{j as m}from"./liveblocks-CkQ2CY6T.js";import{a as l}from"./sentry-Lj2WEO6K.js";import{u as Ue,h as Le,g as Fe,j as _,i as Be,l as Re}from"./core-CiFsHd3i.js";import{a as Ve,e2 as Me,z as $e,$ as Ne,e3 as qe,e4 as Ge,bm as le,e5 as he,e6 as He,bl as ge,a2 as H,a6 as $,h as x,e7 as N,e8 as ze,e9 as We,as as Je,N as Ke,w as Xe,ea as Ye,eb as Ze,at as et,ec as tt,ed as st,ee as at,ef as ot,p as nt,bi as re,eg as it}from"./index-juRht-9c.js";import{fA as z,gp as E,gx as W,Tq as lt,gr as J,gH as rt,fB as dt,j0 as ct,a1k as ut,g4 as mt,je as pt,ja as St,fC as q,gb as ht,a1l as gt,a1m as ft,a1n as Ct,jP as G,gq as kt,gk as de,k0 as ce,gm as ue,gs as It,a1o as me,jR as bt,j7 as vt,jl as Et,jN as pe,ji as Pt,jo as wt,gt as xt,gu as yt,gv as Tt,gw as At}from"./zeni-epic-state-BdFiPfcm.js";import{D as Qt,n as y,S as jt,P as Ot}from"./mui-FQy08n5j.js";import{u as _t}from"./useAiCfoDashboardSuggestedQuestionsChips-B3XyU0Fo.js";import{p as Dt}from"./pathToGoBack-DWIhT07R.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="8eb2a734-cd67-46b6-b69a-5418237b214d",e._sentryDebugIdIdentifier="sentry-dbid-8eb2a734-cd67-46b6-b69a-5418237b214d")}catch{}})();const fe="chat-response-generated";function Ut(e,o){if(o.kind!=="save")return;if(o.fetchState==="In-Progress")return{status:"saving"};if(o.fetchState==="Error")return{status:"failed"};if(o.fetchState!=="Completed")return;const s=E(e).skills.find((p=>p.macroId===o.savedMacroId));return s==null?void 0:{status:"saved",command:s.name}}const Lt=Re((function(e,o){const s=z(e),p=o.isSubmitting,n=s.uiState?.currentChatSessionId,S=n!=null?ht(e.aiCfoState,n):[],c=Ze(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange}),C=gt(e),g=ft(e),P=Ct(e);return{showSampleQuestions:o.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:p,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${et}/tableDownload`,exportDownloadEndPoint:at(),emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,skills:E(e).skills,skillSaveState:Ut(e,P),skillsEnabled:E(e).skillsEnabled,skillsList:E(e).skills,skillsListError:E(e).fetchState==="Error",skillsListLoading:E(e).fetchState==="In-Progress",skillsCanPublish:E(e).canPublish,skillSaving:P.fetchState==="In-Progress",skillSaveError:P.fetchState==="Error",skillVersionHistory:C.macroId!=null?{macroId:C.macroId,versions:C.versions,error:C.fetchState==="Error",loading:C.fetchState==="In-Progress"}:void 0,skillRestoreBody:g.macroId!=null&&g.version!=null?{macroId:g.macroId,version:g.version,instructions:g.instructions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillDetail:G(e).detail,skillDetailError:G(e).fetchState==="Error",skillDetailLoading:G(e).fetchState==="In-Progress",syntheticAnswers:S,resolveSyntheticAnswerCardTile:st(e),resolveSyntheticAnswerPolicyTile:tt(e),...c}}),(function(e,o){const{location:s,currentTenant:p,userId:n,navigate:S,currentChatSessionId:c,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:g,isCardPolicyEnabled:P,setIsAiCfoOpen:w}=o,T=p.tenantEmailDomain;return{onEventReceived:(t,a)=>{if(t===fe&&typeof a.text=="string"&&typeof a.metadata=="object"){const d=a,u=xt(d.type),h=d.metadata.chat_session_id??null,{currentChatSession:k,currentQuestionAnswer:A,currentQuestionAnswerSummary:b}=ge(C,h);u!=="answer"?x.trackAICFOChatResponseGenerated(u,A?.question.questionText??"",d.text,h,it(b,k),d.metadata.message_id??null):x.trackAICFOChatAnswerGenerated(d.text,A?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,yt(d.visualization?.type??"")??null,h,d.summarized_title,d.metadata.message_id??null),e(Tt({chatSessionId:d.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),e(At({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:n}))}},onSubmit:(t,a,d,u,h)=>{t&&re(e,t,a,c,C,n,u,d,void 0,h)},onFetchSkills:()=>{e(W())},onOpenSkill:t=>{e(Pt({macroId:t})),e(wt({macroId:t}))},onSaveSkill:(t,a)=>{e(pe({draft:t,macroId:a}))},onSaveSkillDraft:t=>{const a=t.displayName?.trim()??"",d=t.name?.trim()??"";e(pe({draft:{name:a.length>0?a:d,description:t.description?.trim()??null,instructions:t.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(t,a)=>{e(Et({macroId:t,version:a}))},onDeleteSkill:t=>{e(vt({macroId:t}))},onSetSkillVisibility:(t,a)=>{e(bt({macroId:t,visibility:a}))},onCloseSkillDetail:()=>{e(me())},onRunSkill:(t,a)=>{e(J()),e(de()),re(e,a,"user_input",void 0,C,n,void 0,void 0,void 0,t),e(me())},updateCurrentInput:t=>{e(ue(t))},onStopSubmit:()=>{},onUpdateScrollYOffset:t=>{e(It(t))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??Dt(1);S(a,{state:{...s.state,pathnameStackToGoBack:t.newStack}}),e(ue(""))},togglePageView:()=>{const t=H(s.state?.pathnameStackToGoBack),a=t.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(a,{state:{...he(s.state),pathnameStackToGoBack:t.newStack,message:"open_ai_cfo_drawer"}}),w(!0)},onCopy:()=>{},onThumbsUp:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"positive",a.questionText,a.answerText))},onThumbsDown:(t,a)=>{c!=null&&a?.messageId!=null&&e(ce(c,a.messageId,"negative",a.questionText,a.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{e(J()),c!=null&&e(de());const t=nt(s.state?.pathnameStackToGoBack,s.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:t.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(t,a)=>{e(kt({questionAnswerId:t,isCollapsed:a}))},onMenuClick:o.onMenuClick,...ot(e,{isAiCardCreationEnabled:g,isCardPolicyEnabled:P,currentChatSessionId:c,onAfterCardsCreationSubmit:()=>{w(!0),S(`/${T}/cards`,{state:{...s.state}})},onAfterCardPolicySubmit:()=>{w(!0),S(`/${T}/cards/policy`,{state:{...s.state}})}})}}))(Xe(Ye)),os=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Ve(),s=Ue(),p=Le(),n=Fe(),[S,c]=l.useState(!1),C=_((i=>z(i).uiState.isSkillsBrowserOpen===!0)),g=_((i=>E(i).skillsEnabled)),P=l.useCallback((()=>{s(W()),s(lt())}),[s]),w=l.useCallback((()=>{s(J())}),[s]);l.useEffect((()=>{s(W())}),[s]);const{allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,onCardPolicyVendorSearchTextChange:d}=Me();l.useEffect((()=>{s(rt())}),[s]);const u=_((i=>z(i))),h=$e.getSignedInUser(),{session_id:k}=Be(),A=Ne(),b=Je(A),f=_((i=>dt(i))),r=u.uiState.currentChatSessionId,K=f.tenantEmailDomain,{handleUploadPromoClose:Ce,isUploadPromoVisible:ke}=qe({isFileUploadEnabled:e,tenantEmailDomain:K}),D=Ge({currentTenant:f,currentChatSessionId:r,aiCfoView:u,skillsEnabled:g,onCloseSkills:w,onOpenSkills:P}),{isSuggestedQuestionsLoading:Ie,suggestedPromptQuestions:be}=_t(),Q=n.state,j=Q?.aiCfoInitialQuestion,X=!!Q?.aiCfoShouldSubmit;l.useEffect((()=>{const i=n.state;if(i?.[le]!==!0)return;c(!0);const I={...i};delete I[le],p(n,{replace:!0,state:I})}),[n.pathname,n.search,n.state,p]);const[ve,U]=l.useState(null),[Ee,L]=l.useState(!1),[Pe,F]=l.useState(void 0),[we,B]=l.useState(void 0),Y=l.useRef(!1);l.useEffect((()=>{if(!Y.current&&j!=null&&j!==""){const i=n.state;U(j),L(X),F(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const I=i?.aiCfoSuggestionIndex;B(typeof I=="number"?I:void 0),Y.current=!0}}),[j,X,n.state]);const xe=l.useCallback((()=>{U(null),L(!1),F(void 0),B(void 0),p(n.pathname,{replace:!0,state:he(n.state)})}),[n.pathname,n.state,p]),Z=l.useMemo((()=>new URLSearchParams(n.search)),[n.search]),ee=Z.get("ref")??Q?.aiCfoRef,R=Z.get("emailRefId")??Q?.aiCfoEmailRefId,te=l.useRef(!1);l.useEffect((()=>{te.current||ee!=="month-end-email"||R==null||r!=null||h==null||(s(ct("controller",h.userId,R,"MONTH_END_EMAIL")),te.current=!0)}),[ee,R,r,s,h]);const O=u.uiState.lastContextMessage;l.useEffect((()=>{O!=null&&O!==""&&r!=null&&(U(O),L(!0),F(void 0),B(void 0),s(ut()))}),[O,r,s]);const ye=f.masterTOSInfo,v=ye?.isMasterTOSAccepted??!1,{visitedSessions:se}=He(r),V=u.fetchState,M=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,ae=r!=null?u.fetchChatSessionHistoryByChatSessionId?.[r]?.fetchState??"Not-Started":"Not-Started",oe=r==null||(u.uiState.chatHistoryNextPageToken[r]?.hasMore??!0),ne=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Te}=ge(ne,r),Ae=Te.length===0;l.useEffect((()=>{v||b||p("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})}),[v,b,p,n.state]);const Qe=l.useCallback((()=>{const i=H(n.state?.pathnameStackToGoBack),I=f.tenantEmailDomain;p(i.poppedPathname??(I!=null?`/${I}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})}),[f.tenantEmailDomain,n.state,p]);l.useEffect((()=>{r!=null&&k!==r&&p(`../ai-cfo/${r}`,{state:{...n.state}})}),[r,k]),l.useEffect((()=>{k!=null&&r==null&&k!=="new_chat"&&k!=="explore"&&s(mt({sessionId:k,agentId:"controller"}))}),[]);const je=l.useMemo((()=>({events:se.map((i=>`private-encrypted-chat-${i}.${fe}`)),eventCallback:(i,I,De)=>De.onEventReceived(i,I)})),[se]);l.useEffect((()=>{V!=="In-Progress"&&M&&s(pt())}),[V,M,s]),l.useEffect((()=>{r!=null&&ae!=="In-Progress"&&oe&&h!=null&&V==="Completed"&&!M&&s(St(r,h.userId))}),[ae,oe,r,h,s]);const ie=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(h==null||k==null)throw Error("Can't access AI Controller page without signing in...");const Oe=r!=null&&u.responseStateByChatSessionId?.[r]?.answer?.fetchState==="In-Progress";if(!v&&b)return m.jsxs(Bt,{children:[m.jsx($,{analytics:x,onLoad:ie}),D.drawerElement,m.jsx(Rt,{children:m.jsx(Se,{children:m.jsx(N,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:Qe,onCompleteClick:()=>{f.userRoleId!=null&&s(q(f.userRoleId))}})})})]});const _e=m.jsxs(m.Fragment,{children:[S&&!v?m.jsx($,{analytics:x,onLoad:ie}):null,m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:v?()=>c(!1):void 0,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})]});return m.jsxs(m.Fragment,{children:[m.jsxs(Ft,{children:[m.jsx($,{analytics:x,onLoad:i=>i.trackPageLoaded(Ke.Event.aiCFOPage)}),b&&D.drawerElement,m.jsx(Lt,{...je,currentChatSessionId:r,allSessionsWithOrderedQuestionAnswers:ne,allUsers:T,isAiCardCreationEnabled:t,isCardPolicyEnabled:a,openOnboardingPage:()=>c(!0),userId:h.userId,setIsAiCfoOpen:o,navigate:p,sessionFromUrl:k,location:n,isSubmitting:Oe,isEmptyChatWithSession:Ae,currentTenant:f,emailLinkQuestion:ve??void 0,autoSubmitEmailLinkQuestion:Ee,onEmailLinkQuestionProcessed:xe,routedInitialQuestionSource:Pe,routedInitialQuestionSuggestionIndex:we,onCardPolicyVendorSearchTextChange:d,onMenuClick:b?D.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ke,onUploadPromoClose:Ce,exploreSuggestedPromptQuestions:be,exploreSuggestedPromptQuestionsLoading:Ie,isSkillsOpen:C,isCreateSkillEnabled:g,promoDismissalScope:K}),S&&b?m.jsx(Qt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:Vt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>c(!1),children:m.jsx(Se,{onClick:i=>i.stopPropagation(),children:m.jsx(N,{isTOSAccepted:v,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>c(!1),onCompleteClick:()=>{v||f.userRoleId==null||s(q(f.userRoleId)),c(!1)}})})}):null]}),S&&!b?m.jsx(ze,{open:S,onClose:()=>c(!1),children:m.jsx(We,{children:_e})}):null]})},Se=y(jt)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,Ft=y.div`
6
+ height: 100vh;
7
+ width: 100%;
8
+ `,Bt=y.div`
9
+ height: 100vh;
10
+ width: 100%;
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 0;
14
+ `,Rt=y.div`
15
+ flex: 1;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ `,Vt=y(Ot)`
20
+ box-shadow: ${({theme:e})=>e.colors.elevation2};
21
+ color: ${({theme:e})=>e.colors.grey4};
22
+ `;export{os as default};
@@ -0,0 +1,10 @@
1
+ import{j as l}from"./liveblocks-CkQ2CY6T.js";import{a as n,R as ba}from"./sentry-Lj2WEO6K.js";import{u as Ae,j as r,g as Sa,h as ka,q as j}from"./core-CiFsHd3i.js";import{fB as _e,Tc as Ea,Td as De,g5 as wa,gr as K,gx as ke,Te as Ta,Tf as ya,gL as va,pX as Ia,Tg as Ba,Th as Ee,gi as $a,Ti as I,fA as xa,gp as Aa,Tj as _a,Tk as we,Tl as Da,Tm as Te,Tn as Fa,Dr as Ma,gj as Za,g_ as Ga,cS as ja,To as Ha,Tp as La,qy as Va,g4 as Na,j3 as Pa,Tq as Ra,vR as Oa,gk as Ua}from"./zeni-epic-state-BdFiPfcm.js";import{w as za,i as qa,a as Ya,U as Ka,E as Wa,O as Xa,y as C,c as Ja,u as Qa,d as et,n as at,e as tt,f as nt,g as ot,z as st,h as H,p as g,m as ye,j as rt,K as it,k as ve,l as lt,Y as Ie,o as dt,q as ct,r as W,s as Be,v as ut,x as Ct,A as mt,L as pt,B as ht,C as ft,D as X,F as gt,Z as bt}from"./index-juRht-9c.js";import{A as St,b as kt,I as Et,a as $e,d as wt,D as xe}from"./mui-FQy08n5j.js";import{u as Tt}from"./InboxNotificationsProvider-55rQDTXA.js";import{u as yt}from"./useTaskManagerAccess-BrCmQLIc.js";import{u as vt}from"./expenseAutomationHelper-R2jHKv-Z.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},m=new a.Error().stack;m&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[m]="3cb892f2-d034-4a79-aa0f-2e795650f2d7",a._sentryDebugIdIdentifier="sentry-dbid-3cb892f2-d034-4a79-aa0f-2e795650f2d7")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},It=X("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:W,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"}}))),Bt=za((function({tenantEmailDomain:a}){const{isAiCfoOpen:m,setIsAiCfoOpen:b}=Ya(),[L,A]=ba.useState(!1),[S,Fe]=n.useState(!1),t=Sa(),i=ka(),J=wa(),Q=Ka(),o=Ae(),[Me,Ze]=n.useState(!1),V=Wa(),ee=t.pathname.includes("/ai-cfo/");n.useEffect((()=>{ee||o(K())}),[o,ee]),n.useEffect((()=>{o(K())}),[o,a]);const{useFeatureGate:u}=Xa(),{isFeatureEnabled:ae}=u(C.isDebitCardFeatureEnabled),k=Ja(),s=r((e=>_e(e))),te=s.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ge}=Qa(),$=et(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=yt(k),ne=at(),E=tt();n.useEffect((()=>{E&&$&&o(ke())}),[o,E,s.tenantId,$]);const[N,He]=n.useState(void 0),Le=!!s.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ve}=u(C.isChargeCardFeatureEnabled),Ne=nt(s,Ve,ae),{isFeatureEnabled:Pe}=u(C.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(C.isReferralFeatureEnabled),Re=s.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",oe=r((e=>Ta(e)));n.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>ya(e))),p=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),h=r((e=>va(e))),{monthEndCloseChecksView:w}=h,Oe=j("/signout")!==null,F=j("/:tenantEmailDomain/dashboard")!==null,se=j("/:tenantEmailDomain/reports")!==null,f=j("/:tenantEmailDomain/onboarding/*")!==null,re=vt();n.useEffect((()=>{E&&D&&!f&&P.fetchState==="Not-Started"&&o(Ia(!0))}),[E,D,P.fetchState,f]),n.useEffect((()=>{if(re){const e=t.state?.origin;if(e!=null){const d=Ba(e);d!=null&&o(Ee(d))}}}),[re,t.state]);const Ue=Oe||f,R=r((e=>e.tenantState)),ze=r((e=>R.fetchState==="Completed"?$a(e):[])),{isFeatureEnabled:qe}=u(C.isApAgingFeatureEnabled),{isFeatureEnabled:Ye}=u(C.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(C.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:We}=u(C.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Xe}=u(C.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Je}=u(C.isDashboardSidebarNewYearAnimationEnabled),Qe=r((e=>I(e).totalUnreadCount)),ea=r((e=>I(e).notificationDetailsByTab.tasks.uiState.unreadCount)),aa=r((e=>I(e).notificationDetailsByTab.comments.uiState.unreadCount)),ta=r((e=>I(e).reducedFetchCountState)),ie=r((e=>I(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>xa(e))),na=r((e=>Aa(e).skillsEnabled)),{status:le}=r(_a),[T,U]=n.useState(void 0),z=O.uiState.currentChatSessionId,M=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,de=ot(M),{inboxNotifications:q,isLoading:ce,isFetchingMore:ue,hasFetchedAll:Ce,fetchMore:oa}=Tt(),Z=r((e=>I(e).notificationDetailsByTab.comments.fetchCountState));n.useEffect((()=>{const e=setTimeout((()=>oa?.()),0);return()=>clearTimeout(e)})),n.useEffect((()=>{if(T!=null)return de==="In-Progress"&&M==="Completed"?(o(we({chatSessionId:T})),U(void 0),void i(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(M==="Error"&&(o(we({chatSessionId:T})),U(void 0)))}),[o,t.state,i,M,T,de,a]),n.useEffect((()=>{if(ce===!1&&ue===!1&&Ce===!0&&s?.companyId!=null&&q!=null){const e=`dashboard_${s.companyId}`;He(q.filter((d=>d.roomId===e&&d.readAt==null)).length)}}),[ce,ue,Ce,s?.companyId,q]),n.useEffect((()=>{E&&_&&!f&&ie.fetchState==="Not-Started"&&J.tenantId!=null&&o(Da("task_manager","dashboard"))}),[E,_,f,ie.fetchState,J.tenantId,o]),n.useEffect((()=>{f||Z.fetchState!=="Not-Started"||o(Te({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,Z.fetchState,o]),n.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&o(Te({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(De({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const sa={fetchStatus:ta,count:Qe},y=[];qe===!1&&y.push("accounts_payable_aging"),Ye===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),ne===!1&&y.push("expense_automation_card");const me=r((e=>Fa(e,y).fetchState)),pe=r((e=>Ma(e).fetchState)),he=a!=null?st.getSignedInUserTenant(a):null,fe=r((e=>he?.tenantId!=null?Za(e,he.tenantId):void 0)),ra=F&&(me==="Completed"||me==="Error")||se&&(pe==="Completed"||pe==="Error")||!F&&!se?void 0:"disabled",ia=n.useMemo((()=>Ga(s.userRole)),[s.userRole]),la=ja(ia),v=e=>{A(e)},da=Re,ca=s?.rewardsLastViewedTime==null,ua=k?.userEmail!=null&&oe.fetchState==="Completed"&&Ha(oe.notificationSettings,k.userEmail,ae,s,_),Ca=n.useCallback((e=>{const d=t.state?.referrer;if(w.monthEndCloseChecks?.auditSummary!=null&&H.trackMonthCloseAuditPage(e.month,e.year,w.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",w.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null),o(La(s.tenantId,e)),p[s.tenantId]!=null){const x=g(t.state?.pathnameStackToGoBack,t.pathname);i(`/${a}/month_end_close_checks/review/${h.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:h.currentSelectedView}})}o(Ee(h.currentSelectedView)),h.reconciliation.selectedAccountId!=null&&o(Va({selectedAccountId:void 0}))}),[h.reconciliation.selectedAccountId,h.currentSelectedView,s.tenantId,w.monthEndCloseChecks?.auditSummary,w.monthEndCloseChecks?.reportEmailSentDate,p,a,t.state,t.pathname]),ma=n.useMemo((()=>({zIndex:S?12:ye[2]})),[S]),pa=$&&rt(t),ge=l.jsx(it,{signedInUser:k,currentTenantId:R.currentTenantId??"",tenants:R.fetchState==="Completed"?ze:fe!=null?[fe]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ca,rewardsPlan:P.rewardsPlan},selectedMenu:m===!0?Ie("ai_cfo"):ve(t)&&le!=="completed"?Ie("invoicing"):dt(t),isTenantDropdownDisabled:ra,isSettings:lt(t),isInvoicing:ve(t)&&le==="completed",isSettingsFeatureEnabled:Pe,currentTenant:s,isVendorsTabVisible:la,isZeniAccountEnabled:Le,isChargeCardEnabled:Ne,isTreasuryEnabled:da,isNotificationsTabVisible:ua,notificationCountDetails:sa,isExpenseAutomationEnabledForUser:ne,isAiCfoAccessEnabled:$,skillsEnabled:na&&$,onNotificationIconClick:()=>{v(!1);const e=je?ea===0&&aa>0?"notifications/comments":"notifications/tasks":"notifications/comments",d=g(t.state?.pathnameStackToGoBack,t.pathname);i(`${a}/${e}`,{state:{pathnameStackToGoBack:d}})},onZeniLogoClick:()=>{Q.toggle()},handleTenantSelect:e=>{Ge(pt.TENANT_SWITCHING),v(!1),ht({dispatch:o,navigate:i,pathToNavigate:ft(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,d)=>{if(k!=null&&H.trackSidePanelClicked(e.type,e.group),v(!1),a==null)return;if(e.type==="skills")return te?(o(ke()),o(Ra()),void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});if(o(K()),e.type==="invoicing")return m&&b(!1),o(Oa({cacheOverride:!1})),void i(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:g(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(m&&ut(e.type)&&b(!1),e.type==="ai_cfo"){if(H.trackAICFOChatScreenStateChanged("viewed","left_menu",z??null,null),!te)return void Be({location:t,navigate:i,mergeState:{referrer:"Sidebar"}});const G=g(t.state?.pathnameStackToGoBack,t.pathname);return void i(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=g(t.state?.pathnameStackToGoBack,t.pathname),Y=e.type,Se=bt(Y)&&Y!=="command_center";if(Y!=="command_center"&&!Se||p[s.tenantId]==null||H.trackMonthEndCloseClicked(p[s.tenantId].month,p[s.tenantId].year,"Sidebar"),Se&&p[s.tenantId]!=null){const G=p[s.tenantId];return void i(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})}const ga=Ct(e.type);mt(e.type)?(z!=null&&o(Ua()),i(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:d,referrer:"Sidebar"}})):i(`../${a}/${ga}`,{state:{pathnameStackToGoBack:x,message:d,referrer:"Sidebar"}})},onDeleteChatSession:e=>{o(Pa(e)),z===e&&U(e)},handleLogOutClick:()=>{v(!1);const e=g(t.state?.pathnameStackToGoBack,t.pathname);i("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{i(`${a}/settings/my_profile`)},handleReferralsClick:()=>{i(`${a}/rewards/refer`)},handleBackClick:()=>{i(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:w,onPeriodChange:Ca,onCalendarOpen:Fe,aiCfoView:O,isAiCfo:pa,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{o(Na({sessionId:e,agentId:"controller"})),i(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Ke,thanksGivingAnimationEnabled:We,christmasAnimationEnabled:Xe,newYearAnimationEnabled:Je}),ha=l.jsx(St,{position:"fixed",className:c.appBar,style:{borderBottom:Me?`1px solid ${V.colors.grey2}`:""},children:l.jsxs(kt,{style:{minHeight:ct},children:[l.jsx(Et,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>v(!0),className:c.menuButton,size:"large",children:l.jsx($t,{})}),l.jsx(xt,{className:c.appBarZenilogo,onClick:()=>{Q.toggle()}})]})}),be=$e((e=>e.breakpoints.up("md"))),fa=$e((e=>e.breakpoints.down("md")));return a==null?null:l.jsxs(It,{className:c.root,children:[l.jsx(wt,{}),Ue===!1?l.jsxs(l.Fragment,{children:[be||!F?null:ha,l.jsxs("nav",{className:c.drawer,children:[be?null:l.jsx(xe,{container:window.document.body,variant:"temporary",open:L,onClose:()=>v(!1),PaperProps:{sx:{width:W,zIndex:ye[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ge}),fa?null:l.jsx(xe,{PaperProps:{sx:{width:W,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ma}},variant:"permanent",open:!0,children:ge})]})]}):null]})})),Yt=({tenantEmailDomain:a})=>{const m=Ae(),b=r((A=>_e(A))),L={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{qa(S)&&Ea(S.mode)==="dashboard"&&m(De({unreadCount:S.data.unread},"tasks"))}};return l.jsx(Bt,{tenantEmailDomain:a,...L})},$t=X((a=>n.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},n.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
+ `,xt=X((a=>n.createElement("svg",{viewBox:"0 0 102 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},n.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"}),n.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"}),n.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"}),n.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"}),n.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"}),n.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"}),n.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: ${gt.sp4};
7
+ width: 102px;
8
+ color: ${a=>a.theme.colors.primary};
9
+ cursor: pointer;
10
+ `;export{Yt as default};
@@ -1 +1 @@
1
- import{j as u}from"./liveblocks-mJJR3MsR.js";import{a as d}from"./sentry-CItQHKpv.js";import{h as U,g as B,u as j,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-CMivCywN.js";import{fB as P,Yc as w,XV as R,G_ as E,GS as q,GW as A,GL as X,XX as H,GP as ae,H0 as oe,GO as K,H3 as Y,G$ as C}from"./zeni-epic-state-CqKBThJ0.js";import{z as O,w as z,bY as pe,l as _,bS as Z,bZ as le,E as J,a7 as M,b_ as se,b$ as ne}from"./index-D90YkzK-.js";import"./mui-C6XtNCo7.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-CGLqqLOn.js";import ie from"./NotFoundScreen-BnVyPaPi.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]="02b3715c-74c2-4f0f-a88a-d3c085c4fedb",e._sentryDebugIdIdentifier="sentry-dbid-02b3715c-74c2-4f0f-a88a-d3c085c4fedb")}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(H(!1))},onBackClick:()=>{_(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(z(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,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{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(H(!1))},onBackClick:()=>{_(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(z(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Z(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)));Q();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events: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(G,{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=_(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(Y(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=J(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{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=_(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((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.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(Y(!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}=Z(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=J(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Q(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{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};
1
+ import{j as u}from"./liveblocks-CkQ2CY6T.js";import{a as d}from"./sentry-Lj2WEO6K.js";import{h as U,g as B,u as j,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-CiFsHd3i.js";import{fB as P,Y8 as w,XR as R,G_ as E,GS as q,GW as A,GL as X,XT as H,GP as ae,H0 as oe,GO as K,H3 as Y,G$ as C}from"./zeni-epic-state-BdFiPfcm.js";import{z as O,w as z,bW as pe,l as T,bQ as Q,bX as le,E as Z,a5 as J,bY as se,bZ as ne}from"./index-juRht-9c.js";import"./mui-FQy08n5j.js";import{u as M,i as re}from"./ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js";import ie from"./NotFoundScreen-ButYFiTG.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]="697c1fdc-974f-4812-8911-843842443d1d",e._sentryDebugIdIdentifier="sentry-dbid-697c1fdc-974f-4812-8911-843842443d1d")}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(H(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(z(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(G,{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(H(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(z(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)));M();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(G,{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(Y(!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(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{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(Y(!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(M(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{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};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-CMivCywN.js";import{fB as Z,Xv as Ue,bq as kt,Rx as oa,bo as wt,bJ as de,Xw as Bt,Gg as xt,Hv as Ve,GP as la,bn as Ae,Xx as sa,Xy as ra,c7 as ca,Xz as da,lX as Ct,XA as At,XB as Et,I4 as _e,Gv as xe,XC as ua,G4 as at,XD as pa,LV as ma,G8 as ba,Ge as Dt,XE as Se,XF as Me,Hw as Oe,XG as ha,XH as ga,Hz as Ne,XI as Sa,HM as ya,XJ as Tt,Hg as nt,Hl as fa,XK as Ia,XL as ce,XM as jt,XN as Pt,XO as Ft,gS as va,GA as Le,cF as Rt,XP as ka,gd as wa,XQ as Ba,XR as xa,dV as Vt,dU as Lt,XS as ze,XT as Ca,XU as Aa,W4 as Xe,XV as Ea,W5 as ie,W6 as He,XW as Da,XX as Ta,XY as ja,Hn as it,Hk as Pa,XZ as Fa,X_ as Ra,X$ as Va,H6 as La,Y0 as $a,Y1 as Ga,ct as $t,d6 as Gt,m6 as Ua,bO as _a,br as Ut,bP as _t,Fj as Ma,Y2 as Oa,LI as Na,LO as za,Bv as Xa,Hx as Ha,Ib as Za,mj as ge,Y3 as Wa,Y4 as Mt,mN as Ya,md as Ot,my as Nt,mx as ot,bE as pe,bN as qa,Y5 as Ja,Y6 as ye,kJ as Ka,Y7 as lt,Y8 as Qa,kN as en,l6 as tn,Ip as an,Y9 as nn,mG as on,If as ln,Ya as st,Ij as sn,Io as rn,Im as cn,Id as dn,Yb as zt,Gp as un,Yc as pn,Yd as mn,gD as bn,gC as hn,gB as gn,mm as Sn,mE as rt,mP as yn,ui as fn,mv as In,Ih as vn,kT as kn,mU as wn,Ye as Bn,kL as xn,u9 as Cn,Yf as An,Hc as En,bK as Dn,bt as Tn,Tw as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-CqKBThJ0.js";import{E as ue,z as $,J as fe,as as Ze,O as oe,y as g,bi as We,a7 as se,F as A,a8 as Ee,h as j,bu as Ln,a4 as H,av as Ye,p as T,a1 as Ie,bv as ct,bw as dt,bx as $n,az as Gn,af as Un,aS as _n,ab as Xt,G as De,ag as qe,by as Mn,ae as Ht,bz as On,aq as Nn,Q as Zt,w as zn,bA as Xn,bB as Hn,bC as Zn,bD as Wn,bE as Yn,bF as qn,bG as Jn,bH as Kn,bI as Qn,U as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,f as li}from"./index-D90YkzK-.js";import{n as U,S as si}from"./mui-C6XtNCo7.js";import{A as ut}from"./AddressScreen-_R6CTIVH.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-7j7SGnOg.js";import{a as f}from"./sentry-CItQHKpv.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-CywXA9k2.js";import{u as Yt}from"./useInitialThreadRequest-ChCTxMqY.js";import{u as ui}from"./BusinessVerificationPageScreen-afqV4Atk.js";import Ce from"./NotFoundScreen-BnVyPaPi.js";import{D as pi}from"./DrawerScreen-Csh3eD6J.js";import{M as qt}from"./MobileAppDrawer-BJV6BsMX.js";import{F as Jt}from"./FeaturePreviewScreen-B6gcAXFm.js";import{S as je}from"./SetupPagesScreen-C1Oev9K8.js";import{B as mi}from"./BillPayApprovalRoutes-BNU4FGHS.js";import{F as bi}from"./ScreenRoutes-y2py2Sx-.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./routePaths-BRn4bxlT.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B60T1gBh.js";import"./analyticsHelper-CqV558Dq.js";import"./ReimbursementApprovalRuleDetailScreen-CGLqqLOn.js";import"./getLocaleForTenant-eit0V2sf.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]="38f4f62c-8ef7-4357-a3ea-cf597cdc000d",e._sentryDebugIdIdentifier="sentry-dbid-38f4f62c-8ef7-4357-a3ea-cf597cdc000d")}catch{}})();const hi=Q((function(e,t){const l=Ue(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Ye}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(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 gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=$.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>Ue(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Yt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:Y}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,L,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,L,q]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(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:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Y,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(100,58)},mt=Q((function(e,t){const 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=$.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(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,L=v.showAutofill;const Y=k((F=>Ue(F,n??"")));u===!1&&(z=Y.fetchState,M=Y.transactionDetails?.attachments?.[0],L=!1);const q=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||Y.fetchState==="Error")return a.jsx(Ce,{});if(z!="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:q}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||L?null:a.jsx(bt,{children:a.jsx(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx($n,{}),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:[L&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:L,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,Y,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${$e.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-CkQ2CY6T.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-CiFsHd3i.js";import{fB as Z,Xr as Ue,bq as kt,Rx as oa,bo as wt,bJ as de,Xs as Bt,Gg as xt,Hv as Ve,GP as la,bn as Ae,Xt as sa,Xu as ra,c7 as ca,Xv as da,lX as Ct,Xw as At,Xx as Et,I4 as _e,Gv as xe,Xy as ua,G4 as at,Xz as pa,LV as ma,G8 as ba,Ge as Dt,XA as Se,XB as Me,Hw as Oe,XC as ha,XD as ga,Hz as Ne,XE as Sa,HM as ya,XF as Tt,Hg as nt,Hl as fa,XG as Ia,XH as ce,XI as jt,XJ as Pt,XK as Ft,gS as va,GA as $e,cF as Rt,XL as ka,gd as wa,XM as Ba,XN as xa,dV as Vt,dU as $t,XO as ze,XP as Ca,XQ as Aa,V0 as Xe,XR as Ea,V1 as ie,V2 as He,XS as Da,XT as Ta,XU as ja,Hn as it,Hk as Pa,XV as Fa,XW as Ra,XX as Va,H6 as $a,XY as La,XZ as Ga,ct as Lt,d6 as Gt,m6 as Ua,bO as _a,br as Ut,bP as _t,Fj as Ma,X_ as Oa,LI as Na,LO as za,Bv as Xa,Hx as Ha,Ib as Za,mj as ge,X$ as Wa,Y0 as Mt,mN as qa,md as Ot,my as Nt,mx as ot,bE as pe,bN as Ya,Y1 as Ja,Y2 as ye,kJ as Ka,Y3 as lt,Y4 as Qa,kN as en,l6 as tn,Ip as an,Y5 as nn,mG as on,If as ln,Y6 as st,Ij as sn,Io as rn,Im as cn,Id as dn,Y7 as zt,Gp as un,Y8 as pn,Y9 as mn,gD as bn,gC as hn,gB as gn,mm as Sn,mE as rt,mP as yn,ui as fn,mv as In,Ih as vn,kT as kn,mU as wn,Ya as Bn,kL as xn,u9 as Cn,Yb as An,Hc as En,bK as Dn,bt as Tn,Ts as jn,d9 as Pn,d8 as Fn,cE as Rn,cL as Vn}from"./zeni-epic-state-BdFiPfcm.js";import{E as ue,z as L,V as fe,aq as Ze,O as oe,y as g,bg as We,a5 as se,F as A,a6 as Ee,h as j,bs as $n,a2 as H,at as qe,p as T,$ as Ie,bt as ct,bu as dt,bv as Ln,ax as Gn,ad as Un,aW as _n,a9 as Xt,G as De,ae as Ye,bw as Mn,ac as Ht,bx as On,ao as Nn,N as Zt,w as zn,by as Xn,bz as Hn,bA as Zn,bB as Wn,bC as qn,bD as Yn,bE as Jn,bF as Kn,bG as Qn,U as ei,bH as ti,bp as ai,bI as ni,ag as ii,bJ as oi,f as li}from"./index-juRht-9c.js";import{n as U,S as si}from"./mui-FQy08n5j.js";import{A as ut}from"./AddressScreen-Dmypz8Cm.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-DhMVIfNi.js";import{a as f}from"./sentry-Lj2WEO6K.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-Dhoa0fnv.js";import{u as qt}from"./useInitialThreadRequest-D-SxLs4P.js";import{u as ui}from"./BusinessVerificationPageScreen-DzWgqXwG.js";import Ce from"./NotFoundScreen-ButYFiTG.js";import{D as pi}from"./DrawerScreen-CbY0_Vl5.js";import{M as Yt}from"./MobileAppDrawer-BAV0ejOs.js";import{F as Jt}from"./FeaturePreviewScreen-DRMNz052.js";import{S as je}from"./SetupPagesScreen-CPUD_j1y.js";import{B as mi}from"./BillPayApprovalRoutes--ALQ35-1.js";import{F as bi}from"./ScreenRoutes-B2fNAm1R.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";import"./routePaths-DqksJ4i_.js";import"./InboxNotificationsProvider-55rQDTXA.js";import"./useTaskManagerAccess-BrCmQLIc.js";import"./analyticsHelper-Cjtujqyf.js";import"./ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js";import"./getLocaleForTenant-CRduVQsY.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]="0e39003a-5e0a-48fa-8b34-a4abbde9472f",e._sentryDebugIdIdentifier="sentry-dbid-0e39003a-5e0a-48fa-8b34-a4abbde9472f")}catch{}})();const hi=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=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>Ue(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=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:Y}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,$,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,Y]),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:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(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(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(z=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const Y=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||q.fetchState==="Error")return a.jsx(Ce,{});if(z!="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:Y}),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(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -13,7 +13,7 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
13
13
  padding-top: 9px;
14
14
  gap: ${A.sp2};
15
15
  margin-bottom: -${A.sp2};
16
- `,ki=U(qe.StandardMedium)``,wi=U((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.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"}),f.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"}))))`
16
+ `,ki=U(Ye.StandardMedium)``,wi=U((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.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"}),f.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
17
  color: ${e=>e.theme.colors.hero};
18
18
  height: ${A.sp3};
19
19
  width: ${A.sp3};
@@ -64,13 +64,13 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
64
64
  flex-direction: column;
65
65
  width: ${e=>`${Si.containerWidth.value(e.windowSize)}%`};
66
66
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
- `,Bi=U(qe.H6Regular)`
67
+ `,Bi=U(Ye.H6Regular)`
68
68
  margin-top: ${A.sp7};
69
69
  padding-left: ${A.sp8};
70
70
  padding-right: ${A.sp8};
71
71
  color: ${e=>e.theme.colors.primary};
72
72
  word-break: break-word;
73
- `,xi=U(qe.LargeRegularSp)`
73
+ `,xi=U(Ye.LargeRegularSp)`
74
74
  color: ${e=>e.theme.colors.hero};
75
75
  padding-left: ${A.sp8};
76
76
  padding-right: ${A.sp8};
@@ -85,11 +85,11 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
85
85
  flex-direction: column;
86
86
  align-items: center;
87
87
  background-color: ${e=>e.theme.colors.grey4};
88
- `,Di=Q((function(e,t){const l=$.getSignedInUser(),n=Ae(l),c=Ft(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=Xe(e,"common"),s=e.tenantState.currentTenantId,i=Z(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=Ea(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics:j,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${Ye}/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(jt(o))},onSubtabChange:o=>{e(ce()),e(Pt(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=ji(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($a(o))},onReloadTransactions:()=>{e(Le(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(La(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Va({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(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Pa(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(ja()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ge)&&e(Ta(!1))},onEventReceived:o=>{o===Qt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(zn(Xn));function Ti(){const e=J(),t=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=na("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(jt(c?.tab)),t(Pt(c?.subTab))),()=>{t(ce())})),[]);const p=$.getSignedInUser(),m=k((P=>Z(P))),{areTenantIdsInSync:S}=Nn(),[h,b]=f.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:E}=I(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:x}=I(g.isBillPayCommentingEnabled),{isFeatureEnabled:C}=I(g.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=I(g.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:D}=I(g.isBillPayBulkActionEnabled),{isFeatureEnabled:B}=I(g.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:O}=I(g.isBillPayDetectInsufficientFundsEnabled),V=k((P=>Ft(P,ae,D,p?.userId))),{isFeatureEnabled:W}=I(g.isDebitCardFeatureEnabled),N=V.fetchState,{isAiCfoAccessEnabled:v,onAskAiCfoClick:z}=Qe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,L=!!m.companyBillPayInfo?.info?.isBillPayEnabled,Y=k((P=>va(P.companyState,m.companyId))),q=Y?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!h&&L&&S&&(b(!0),t(Le(ae,!0,E,B)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const X=(P,re)=>{t(Ca({uiState:{sortKey:P,sortOrder:re},period:ae}))},G=Rt(r?.loggedInUserRoleMap),F=de(r?.loggedInUserRoleMap),ve=P=>{o(P)},{billsProcessed:ke,billsProcessing:et}=k((P=>ka(P)));f.useEffect((()=>{ke===et&&s!=null&&(t(wa({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(Le(ae,!0,E,!0,B))}),3e3),i(null))}),[ke,et]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Qt}`,`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))}},ta=Vt(W,m),aa=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ta===!0||aa===!0?a.jsx(Jt,{}):L?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(Ee,{analytics:j,onLoad:P=>(re=>re.trackPageLoaded(Zt.Event.billPayHome))(P)}):null,a.jsxs(Ei,{windowSize:n,children:[a.jsx(qt,{isAppContentDrawerOpen:u,handleDrawerToggle:ve}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new Xt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(Pi,{onClick:P=>P.stopPropagation(),children:a.jsx(Ai,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:x,isReimbursementCommentingEnabled:C,period:ae,isAdmin:!1,uiState:V.uiState,onColumnSortConfigChanged:X,isUserHasOnlyBillpayAccess:G,isShowDeletedBillsEnabled:E,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:D,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ve(!0)},isDownloadEnabled:V.isDownloadEnabled,connectedAccountProvider:q,bulkSubmissionLimit:V.billBulkSubmissionLimit,bulkSubmissionFetchState:V.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:V.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:B,isDetectInsufficientFundsEnabled:O,isAiCfoAccessEnabled:v,onAskAiCfoClick:z,...ea})]})]}):M===!0&&F===!0?a.jsx(ee,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(ee,{to:"../promo"}):a.jsx(se,{fetchState:N}):a.jsx(Ce,{})}const ji=e=>`/${e}/bills/setup`,Pi=U(si)`
88
+ `,Di=Q((function(e,t){const l=L.getSignedInUser(),n=Ae(l),c=Ft(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=Xe(e,"common"),s=e.tenantState.currentTenantId,i=Z(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=Ea(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics: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(jt(o))},onSubtabChange:o=>{e(ce()),e(Pt(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=ji(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(La(o))},onReloadTransactions:()=>{e($e(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e($a(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Va({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(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Pa(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(ja()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ge)&&e(Ta(!1))},onEventReceived:o=>{o===Qt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(zn(Xn));function Ti(){const e=J(),t=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=na("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(jt(c?.tab)),t(Pt(c?.subTab))),()=>{t(ce())})),[]);const p=L.getSignedInUser(),m=k((P=>Z(P))),{areTenantIdsInSync:S}=Nn(),[h,b]=f.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:E}=I(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:x}=I(g.isBillPayCommentingEnabled),{isFeatureEnabled:C}=I(g.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=I(g.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:D}=I(g.isBillPayBulkActionEnabled),{isFeatureEnabled:B}=I(g.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:O}=I(g.isBillPayDetectInsufficientFundsEnabled),V=k((P=>Ft(P,ae,D,p?.userId))),{isFeatureEnabled:W}=I(g.isDebitCardFeatureEnabled),N=V.fetchState,{isAiCfoAccessEnabled:v,onAskAiCfoClick:z}=Qe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,$=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=k((P=>va(P.companyState,m.companyId))),Y=q?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!h&&$&&S&&(b(!0),t($e(ae,!0,E,B)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const X=(P,re)=>{t(Ca({uiState:{sortKey:P,sortOrder:re},period:ae}))},G=Rt(r?.loggedInUserRoleMap),F=de(r?.loggedInUserRoleMap),ve=P=>{o(P)},{billsProcessed:ke,billsProcessing:et}=k((P=>ka(P)));f.useEffect((()=>{ke===et&&s!=null&&(t(wa({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,B))}),3e3),i(null))}),[ke,et]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Qt}`,`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))}},ta=Vt(W,m),aa=$t(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ta===!0||aa===!0?a.jsx(Jt,{}):$?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(Ee,{analytics:j,onLoad:P=>(re=>re.trackPageLoaded(Zt.Event.billPayHome))(P)}):null,a.jsxs(Ei,{windowSize:n,children:[a.jsx(Yt,{isAppContentDrawerOpen:u,handleDrawerToggle:ve}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new Xt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(Pi,{onClick:P=>P.stopPropagation(),children:a.jsx(Ai,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:x,isReimbursementCommentingEnabled:C,period:ae,isAdmin:!1,uiState:V.uiState,onColumnSortConfigChanged:X,isUserHasOnlyBillpayAccess:G,isShowDeletedBillsEnabled:E,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:D,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ve(!0)},isDownloadEnabled:V.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:V.billBulkSubmissionLimit,bulkSubmissionFetchState:V.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:V.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:B,isDetectInsufficientFundsEnabled:O,isAiCfoAccessEnabled:v,onAskAiCfoClick:z,...ea})]})]}):M===!0&&F===!0?a.jsx(ee,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(ee,{to:"../promo"}):a.jsx(se,{fetchState:N}):a.jsx(Ce,{})}const ji=e=>`/${e}/bills/setup`,Pi=U(si)`
89
89
  display: flex;
90
90
  min-height: 100%;
91
91
  flex-direction: column;
92
- `,{common:{currency:he},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=De.getLocalizedStrings(),Vi=Q((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Xe(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ae(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Ri} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=_a(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=Ut(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=S.add(b,"month").isAfter(h),E=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!_t(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),x=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Ct(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${Ye}/transaction_attachment`,analytics:j,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:x.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(Ot(d,!1)),e(Nt({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,S)=>{const h=Ui(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ya({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Mt("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(Wa()),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=$i(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Gi(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Wt(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=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Za(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Yn()?"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(Xa("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Na(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Ma("bill_pay","bill_pay_detail")),e(Oa({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function gt(){const e=J(),t=K(),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:S}=r(g.isRecurringBillsFeatureEnabled),{isFeatureEnabled:h}=r(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(g.isShaDisabled),{isFeatureEnabled:I}=r(g.isOurDisabled),{isFeatureEnabled:E}=r(g.isBillPayDetectInsufficientFundsEnabled),{configValue:x}=u(We.sameDayAchDisablementConfig),C=Ga(x),_=$.getSignedInUser(),D=k((G=>Z(G))),B=k((G=>Me(G,m,h,n))),O=Yt(D?.companyId,{clearParams:B.fetchState==="Completed"}),{isAiCfoAccessEnabled:V,onAskAiCfoClick:W}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:B.fetchState==="Completed"});const N=D.companyId??$.getSignedInUserTenant(c)?.companyId,v=fe(),z=$t(v?.loggedInUserRoleMap),M=Gt(v?.loggedInUserRoleMap),L=de(v?.loggedInUserRoleMap),Y=wt(D.userRole);if(f.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),_==null)throw Error("Can't access address page without signing in...");const q=k((G=>Ua(G.accountState,G.accountListState,"billPayAccountList"))),X={pathname:"../",search:t.search};return B.isDeleted===!0||B.billStage=="paid"||B.fetchState=="Not-Started"?a.jsx(ee,{to:X}):B.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:B.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:G=>(F=>{n!=null&&B.deleteStatus.fetchState!=="Completed"&&F.trackBillPayEditBill(n,B.isRecurring)})(G)}),a.jsx(Vi,{initialOpenThreadRequest:O??void 0,location:t,navigate:e,currentTenant:D,billId:n,companyId:N,billDetailsView:B,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:q,isInternationalPaymentShaVsOurEnabled:i,vendor:B.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:I,isRecurringBillsFeatureEnabled:S,hasZeniAccountsAdminAccess:z,isZeniAccountsUser:M,isBillPayAdmin:L,isSuperAdmin:Y,isDetectInsufficientFundsEnabled:E,sameDayAchDisablementConfig:C,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},$i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},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/domestic`),n},R="paymentDetails",Ui=(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()):Ut(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(qa)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Fi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ja(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=_i(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Zn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},_i=(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=Wn(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},Mi=U.div`
92
+ `,{common:{currency:he},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=De.getLocalizedStrings(),Vi=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Xe(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ae(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Ri} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=_a(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=Ut(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=S.add(b,"month").isAfter(h),E=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!_t(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),x=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Ct(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:x.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(Ot(d,!1)),e(Nt({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,S)=>{const h=Ui(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(qa({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Mt("draft"))},reviewBillDetails:()=>{const i=$i(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(Wa()),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=Li(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Gi(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Wt(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=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Za(i,d,l))},onWiseVerifyClick:()=>{let i="";i=qn()?"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(Xa("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Na(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Ma("bill_pay","bill_pay_detail")),e(Oa({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function gt(){const e=J(),t=K(),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:S}=r(g.isRecurringBillsFeatureEnabled),{isFeatureEnabled:h}=r(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(g.isShaDisabled),{isFeatureEnabled:I}=r(g.isOurDisabled),{isFeatureEnabled:E}=r(g.isBillPayDetectInsufficientFundsEnabled),{configValue:x}=u(We.sameDayAchDisablementConfig),C=Ga(x),_=L.getSignedInUser(),D=k((G=>Z(G))),B=k((G=>Me(G,m,h,n))),O=qt(D?.companyId,{clearParams:B.fetchState==="Completed"}),{isAiCfoAccessEnabled:V,onAskAiCfoClick:W}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:B.fetchState==="Completed"});const N=D.companyId??L.getSignedInUserTenant(c)?.companyId,v=fe(),z=Lt(v?.loggedInUserRoleMap),M=Gt(v?.loggedInUserRoleMap),$=de(v?.loggedInUserRoleMap),q=wt(D.userRole);if(f.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),_==null)throw Error("Can't access address page without signing in...");const Y=k((G=>Ua(G.accountState,G.accountListState,"billPayAccountList"))),X={pathname:"../",search:t.search};return B.isDeleted===!0||B.billStage=="paid"||B.fetchState=="Not-Started"?a.jsx(ee,{to:X}):B.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:B.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:G=>(F=>{n!=null&&B.deleteStatus.fetchState!=="Completed"&&F.trackBillPayEditBill(n,B.isRecurring)})(G)}),a.jsx(Vi,{initialOpenThreadRequest:O??void 0,location:t,navigate:e,currentTenant:D,billId:n,companyId:N,billDetailsView:B,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:Y,isInternationalPaymentShaVsOurEnabled:i,vendor:B.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:I,isRecurringBillsFeatureEnabled:S,hasZeniAccountsAdminAccess:z,isZeniAccountsUser:M,isBillPayAdmin:$,isSuperAdmin:q,isDetectInsufficientFundsEnabled:E,sameDayAchDisablementConfig:C,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},$i=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},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/domestic`),n},R="paymentDetails",Ui=(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()):Ut(),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(Ya)&&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===Fi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ja(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=_i(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Zn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},_i=(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=Wn(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},Mi=U.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
98
98
  align-items: center;
99
99
  background-color: ${e=>e.theme.colors.grey4};
100
100
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
101
- `,Oi=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(tn(s))},onSaveHandler:()=>{e(en(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Qa({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??yt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Ke(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ka({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??yt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(qn);function Ni(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=ue(),o=$.getSignedInUser(),s=k((h=>Z(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((h=>ye(h,n))),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=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(Mi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.div`
101
+ `,Oi=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(tn(s))},onSaveHandler:()=>{e(en(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Qa({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??yt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Ke(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ka({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??yt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Yn);function Ni(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=ue(),o=L.getSignedInUser(),s=k((h=>Z(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((h=>ye(h,n))),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=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(Mi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
107
107
  align-items: center;
108
108
  background-color: ${e=>e.theme.colors.grey4};
109
109
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
110
- `,Xi=Q((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=nn(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[on(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(dn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(rn(s)),p&&e(cn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(sn(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(st())},onAddressClick:s=>{const i=Ke(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(ln({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(st())}}}))(Jn);function Hi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=te(),r=le(),u=ue(),o=$.getSignedInUser(),s=k((C=>Z(C))),i=H(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=k((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),S=k((C=>n!=null?C.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;f.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,I]=f.useState(!1);f.useEffect((()=>{b||h==="In-Progress"||(I(!0),r(an(c,n)))}),[b,h,r]);const E=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",x=k((C=>ye(C,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return E==="billDetail"&&x.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:x.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(Je,{vendorId:n,billId:c}),a.jsx(Xi,{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`
110
+ `,Xi=Q((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=nn(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[on(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(dn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(rn(s)),p&&e(cn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(sn(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(st())},onAddressClick:s=>{const i=Ke(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(ln({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(st())}}}))(Jn);function Hi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=te(),r=le(),u=ue(),o=L.getSignedInUser(),s=k((C=>Z(C))),i=H(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=k((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),S=k((C=>n!=null?C.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;f.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,I]=f.useState(!1);f.useEffect((()=>{b||h==="In-Progress"||(I(!0),r(an(c,n)))}),[b,h,r]);const E=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",x=k((C=>ye(C,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return E==="billDetail"&&x.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:x.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(Je,{vendorId:n,billId:c}),a.jsx(Xi,{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
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-mJJR3MsR.js";import{h as J,u as le,g as K,i as t
116
116
  align-items: center;
117
117
  background-color: ${e=>e.theme.colors.grey4};
118
118
  box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
119
- `,Zi=Q((function(e,t){const l=$.getSignedInUser(),n=zt(e,t.billId),c=pn(e),r=Ae(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!_t(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(Mt("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(xe(t.billId,"retry"))}}}))(Qn);function vt(){const e=J(),t=le(),l=K(),{billId:n}=te(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(g.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=$.getSignedInUser(),{isFeatureEnabled:i}=c(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(g.isBillPayCommentingEnabled),m=H(l.state?.pathnameStackToGoBack),{poppedPathname:S}=m,{isFeatureEnabled:h}=c(g.isRecurringBillsFeatureEnabled),b=k((x=>Z(x))),I=k((x=>zt(x,n))),E=I.fetchState??"Not-Started";if(f.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),f.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),f.useEffect((()=>{const x=I.vendor?.name,C=I.vendor?.id,_=I.totalAmount.amount,D=I.recipientTotalAmount.amount,B=I.invoiceNumber;x&&C&&t(un(x,C,_,D,B,n))}),[]),S==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(Kn,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Zi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:h,isDetectInsufficientFundsEnabled:u})})}const Wi=Q((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Xe(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=$.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(Cn(i))},saveVendorDetailLocalData:i=>{e(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(rt(u))},updateSelectedVendorForCreate:i=>{e(wn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Wt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=T(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?vn(i,"vendor",u):kn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ke(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(In({files:i}))},onEditFileName:(i,d)=>{e(fn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(rt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(yn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(Sn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ri(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(gn(i,"BillPayVendor"))},onResendOtp:i=>{e(hn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(bn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(mn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}}))(ni),Be=()=>{const e=J(),t=le(),l=ei(),n=K(),{billId:c,vendorId:r}=te(),u=k((b=>Z(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(g.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ye(b,r))),S=k((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return f.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(ti,{}):h==="Error"?a.jsx(ai,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(Wi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Yi=Q((function(e,t){const{companyId:l}=t;return{billPaySetupView:An(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(En(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(oi),qi=()=>{const e=ii(),t=J(),l=K(),{tenantEmailDomain:n}=te(),[c,r]=f.useState(!1),u=ue(),o=k((h=>Z(h))),s=o.companyId??$.getSignedInUserTenant(n)?.companyId,i=$.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(ee,{to:"../../bills/setup"}):p===!1||d!=null&&ze(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:h=>(b=>b.trackPageLoaded(Zt.Event.billPayPromoPage))(h)}),a.jsx(qt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(Yi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function jo(){const e=k((L=>Z(L))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(g.isDebitCardFeatureEnabled),s=Vt(o,e),i=Lt(e),d=K(),p=e?.userRole!=null&&kt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Rt(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,I=b&&$t(t?.loggedInUserRoleMap),{isFeatureEnabled:E}=c(g.isChargeCardFeatureEnabled),x=li(e,E,o)&&!p,C=x&&Tn(t?.loggedInUserRoleMap),_=jn(t?.loggedInUserRoleMap),D=Gt(t?.loggedInUserRoleMap),B=Pn(t?.loggedInUserRoleMap),O=b&&D,V=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&B,W=Fn(t?.loggedInUserRoleMap),N=Rn(t?.loggedInUserRoleMap),v=Vn(t?.loggedInUserRoleMap),z=x&&W,{tenantEmailDomain:M}=te();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(qi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:O,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:v,showTreasuryRoute:V,isTenantBankingOnly:s,showChargeCardRoute:z,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(w,{appContent:a.jsx(gi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Ce,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Ce,{})})]})}export{jo as default};
119
+ `,Zi=Q((function(e,t){const l=L.getSignedInUser(),n=zt(e,t.billId),c=pn(e),r=Ae(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!_t(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(Mt("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(xe(t.billId,"retry"))}}}))(Qn);function vt(){const e=J(),t=le(),l=K(),{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=H(l.state?.pathnameStackToGoBack),{poppedPathname:S}=m,{isFeatureEnabled:h}=c(g.isRecurringBillsFeatureEnabled),b=k((x=>Z(x))),I=k((x=>zt(x,n))),E=I.fetchState??"Not-Started";if(f.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),f.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),f.useEffect((()=>{const x=I.vendor?.name,C=I.vendor?.id,_=I.totalAmount.amount,D=I.recipientTotalAmount.amount,B=I.invoiceNumber;x&&C&&t(un(x,C,_,D,B,n))}),[]),S==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(Kn,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Zi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:h,isDetectInsufficientFundsEnabled:u})})}const Wi=Q((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Xe(e,"common"),r=l!=null?"edit":"create",u=Z(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(Cn(i))},saveVendorDetailLocalData:i=>{e(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(rt(u))},updateSelectedVendorForCreate:i=>{e(wn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Wt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=T(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?vn(i,"vendor",u):kn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ke(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(In({files:i}))},onEditFileName:(i,d)=>{e(fn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(rt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(yn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(Sn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ri(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(gn(i,"BillPayVendor"))},onResendOtp:i=>{e(hn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(bn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(mn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}}))(ni),Be=()=>{const e=J(),t=le(),l=ei(),n=K(),{billId:c,vendorId:r}=te(),u=k((b=>Z(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(g.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ye(b,r))),S=k((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return f.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(ti,{}):h==="Error"?a.jsx(ai,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(Wi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},qi=Q((function(e,t){const{companyId:l}=t;return{billPaySetupView:An(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(En(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(oi),Yi=()=>{const e=ii(),t=J(),l=K(),{tenantEmailDomain:n}=te(),[c,r]=f.useState(!1),u=ue(),o=k((h=>Z(h))),s=o.companyId??L.getSignedInUserTenant(n)?.companyId,i=L.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(ee,{to:"../../bills/setup"}):p===!1||d!=null&&ze(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:h=>(b=>b.trackPageLoaded(Zt.Event.billPayPromoPage))(h)}),a.jsx(Yt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(qi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function jo(){const e=k(($=>Z($))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(g.isDebitCardFeatureEnabled),s=Vt(o,e),i=$t(e),d=K(),p=e?.userRole!=null&&kt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Rt(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,I=b&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:E}=c(g.isChargeCardFeatureEnabled),x=li(e,E,o)&&!p,C=x&&Tn(t?.loggedInUserRoleMap),_=jn(t?.loggedInUserRoleMap),D=Gt(t?.loggedInUserRoleMap),B=Pn(t?.loggedInUserRoleMap),O=b&&D,V=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&B,W=Fn(t?.loggedInUserRoleMap),N=Rn(t?.loggedInUserRoleMap),v=Vn(t?.loggedInUserRoleMap),z=x&&W,{tenantEmailDomain:M}=te();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Yi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:O,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:v,showTreasuryRoute:V,isTenantBankingOnly:s,showChargeCardRoute:z,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(w,{appContent:a.jsx(gi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Ce,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Ce,{})})]})}export{jo as default};