@zeniai/web-app-ui 5.3.61-qa → 5.3.62-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-OaD-Ww7N.js → AccountMappingScreen-Br9WdaHc.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-C71W3EXR.js → ActualMatchingMatchDetailScreen-DIn78iaK.js} +1 -1
- package/dist/assets/AddressRoutes-Bs2su6QC.js +1 -0
- package/dist/assets/AddressScreen-ChRwBMyD.js +9 -0
- package/dist/assets/{AiCfoScreen-DO4viMbN.js → AiCfoScreen-BoGQRrg3.js} +1 -1
- package/dist/assets/{AppDrawer-BoBT503t.js → AppDrawer-DbFNEZx2.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-UWoiHhFS.js → BillPayApprovalRoutes-Ct7bUe2K.js} +1 -1
- package/dist/assets/BillPayRoutes-B9u5uZwl.js +119 -0
- package/dist/assets/{BusinessVerificationPageScreen-DjqyigwM.js → BusinessVerificationPageScreen-e_hf599B.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-cEaT6Zqk.js → CardsAiCfoScreen-DX5yBLLe.js} +1 -1
- package/dist/assets/ChargeCardRoutes-C0BDIoz6.js +71 -0
- package/dist/assets/{CompanyPassportScreen-CHnMtfXr.js → CompanyPassportScreen-BlEcfU7b.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-DXkk-oNs.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-AEs3yg3Y.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CkVSR1Hr.js → CustomerOnboardingRoutes-CYJxOgEd.js} +3 -3
- package/dist/assets/DashboardRoutes-g9OAwtyP.js +20 -0
- package/dist/assets/{DefaultTenantHome-BWjmQO2E.js → DefaultTenantHome-8TPWmCiF.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-Cs9T_IgO.js → DomesticWireDetailScreen-DjZA-xGp.js} +4 -4
- package/dist/assets/{DrawerScreen-CO5oDn6f.js → DrawerScreen-D1drFQnx.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-QbthrUVk.js → EntityDetailRoutes-BecZC3rR.js} +1 -1
- package/dist/assets/ExpenseAutomationRoutes-CoBNGWYF.js +38 -0
- package/dist/assets/{FeaturePreviewScreen-DWBL39rh.js → FeaturePreviewScreen-BOIyRrPg.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-DAce4xun.js → HubSpotOAuthCallbackScreen-CjBFKEJv.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-B4UF_uUg.js → InboxNotificationsProvider-DcarX1j5.js} +1 -1
- package/dist/assets/InvoicingRoutes-BF9bJVNE.js +2 -0
- package/dist/assets/{MagicLinkRoutes-phTux1TG.js → MagicLinkRoutes-BJpvsEO6.js} +4 -4
- package/dist/assets/{MagicLinkSignInScreen-D-3VGahG.js → MagicLinkSignInScreen-CZf88rgm.js} +1 -1
- package/dist/assets/MobileAppDrawer-BzxL_djZ.js +1 -0
- package/dist/assets/NotFoundScreen-CQm7D9go.js +1 -0
- package/dist/assets/{NotificationRoutes-YZJK1G-i.js → NotificationRoutes-BFU33ioz.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BgBHYWlo.js → OAuthConsentScreen-DWoFdp0W.js} +1 -1
- package/dist/assets/PandLWithForecastRoutes-CMfowbmP.js +1 -0
- package/dist/assets/{PaymentLinkScreen-DCGfHELs.js → PaymentLinkScreen-DVDDW9Xr.js} +9 -9
- package/dist/assets/{PeopleRoutes-BWFloBGz.js → PeopleRoutes-Cd8MqER4.js} +3 -3
- package/dist/assets/PerformanceRoutes-E86W1j7a.js +1 -0
- package/dist/assets/{Preview-Co3i0Xrb.js → Preview-Dxr01VGI.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DYxxHcdI.js → QBOConnectionScreen-Os4Qkt_2.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CMbfshMX.js → ReimbursementApprovalRoutes-BUfIlnAM.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CrWl9trk.js → ReimbursementApprovalRuleDetailScreen-Si973dRZ.js} +1 -1
- package/dist/assets/ReimbursementRoutes-B2UGt9Xo.js +68 -0
- package/dist/assets/ReportsRoutes-URtyqRNi.js +1 -0
- package/dist/assets/RewardsRoutes-xF2koJkH.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-DTNyy-6E.js → ScheduleDetailsPrepaidExpensesScreen-dZQw9m0s.js} +4 -4
- package/dist/assets/{ScreenRoutes-DP4Wjips.js → ScreenRoutes-DivUQ8Cf.js} +2 -2
- package/dist/assets/{SettingsRoutes-CDD6OVir.js → SettingsRoutes-DySQSZO0.js} +5 -5
- package/dist/assets/{SetupPagesScreen-BlUoKvnc.js → SetupPagesScreen-Ctwh4sou.js} +5 -5
- package/dist/assets/SignInScreen-CMjQX-Bq.js +1 -0
- package/dist/assets/SignOutScreen-DiORNgD0.js +9 -0
- package/dist/assets/{TaskListScreen-UsJ67eRj.js → TaskListScreen-2YfVihcw.js} +2 -2
- package/dist/assets/{TaskRoutes-CH6htYb8.js → TaskRoutes-ClUIKKHH.js} +1 -1
- package/dist/assets/TransactionDetailRoutes-FefIagFG.js +1 -0
- package/dist/assets/TransactionDetailScreen-DG9WnSFK.js +5 -0
- package/dist/assets/TransactionListRoutes-DJGbjFDn.js +1 -0
- package/dist/assets/TreasuryRoutes-qpLhCja3.js +37 -0
- package/dist/assets/{VendorsRoutes-jSHZV8MZ.js → VendorsRoutes-ry-2tBPT.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-Bf_MMExc.js → WiseConfirmationScreen-FC1WiW4f.js} +1 -1
- package/dist/assets/ZeniAccountRoutes-CnC3I2P3.js +57 -0
- package/dist/assets/{ZeniAccountStatementScreen-CcOG7C5Z.js → ZeniAccountStatementScreen-BkDHVJBF.js} +1 -1
- package/dist/assets/{accountMappingHelper-Ci74NLEW.js → accountMappingHelper-DpfYWNe6.js} +1 -1
- package/dist/assets/{analytics-8lQ_GaR7.js → analytics-CiEh1qKr.js} +1 -1
- package/dist/assets/{analyticsHelper-Bi6R9Hrj.js → analyticsHelper-CyJSZC50.js} +1 -1
- package/dist/assets/{core-B-8b0iz9.js → core-Caq7Zbsp.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-hAviH84T.js → decodeURIComponentSafe-DmjyT4t5.js} +1 -1
- package/dist/assets/{dnd-CtOxA7uX.js → dnd-DwckO6rX.js} +1 -1
- package/dist/assets/{empty-CyiOIGJw.js → empty-CviwvzhB.js} +1 -1
- package/dist/assets/{empty-ZUR8mjP1.js → empty-Dl3LsHNf.js} +1 -1
- package/dist/assets/{emptyVideoElement-Dch9mr3K.js → emptyVideoElement-0ADxBh21.js} +1 -1
- package/dist/assets/{epic-C_YIXfJm.js → epic-DqqOk9a9.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-BzOPc0En.js → expenseAutomationHelper-B83Qa5Jl.js} +1 -1
- package/dist/assets/{getLocaleForTenant-BYXijL7f.js → getLocaleForTenant-CqonawWC.js} +1 -1
- package/dist/assets/{index-BUsi93tT.js → index-B3LhL1WI.js} +2 -2
- package/dist/assets/{index-Bg2deWZq.js → index-BFK4rLhv.js} +23226 -23221
- package/dist/assets/{index-DeS-5gfC.js → index-BLBexBOn.js} +1 -1
- package/dist/assets/{index-CzpjeHcU.js → index-BggnOuo1.js} +1 -1
- package/dist/assets/{index-CgYr_9vs.js → index-Bi5Vnzzf.js} +1 -1
- package/dist/assets/{index-Ce-G0Vp2.js → index-BsIiLcaT.js} +1 -1
- package/dist/assets/{index-haVo7C6B.js → index-DZj1fENq.js} +1 -1
- package/dist/assets/{index-b65XjN06.js → index-De1Gw5gW.js} +1 -1
- package/dist/assets/{lexical-BVt4M34U.js → lexical-mmp2B1vq.js} +1 -1
- package/dist/assets/{liveblocks-BjcYyeQ6.js → liveblocks-CIxx6Ub6.js} +1 -1
- package/dist/assets/{lottie-BdAYiWcR.js → lottie-CrKh4Q_r.js} +1 -1
- package/dist/assets/{mui-C33Oegsm.js → mui-DI0hUuFr.js} +1 -1
- package/dist/assets/{pathToGoBack-Bgu6njoM.js → pathToGoBack-Ch5lrOj1.js} +1 -1
- package/dist/assets/{pdf-BkfulyEw.js → pdf-BlhN83fm.js} +3 -3
- package/dist/assets/{pdf-lib-D8o-uP9K.js → pdf-lib-WBpN-CHj.js} +1 -1
- package/dist/assets/{plaid-Bt28AVCt.js → plaid-CXvI7t9H.js} +1 -1
- package/dist/assets/{pusher-BWEmmbE9.js → pusher-BZAjVztW.js} +1 -1
- package/dist/assets/{react-BAH__mX9.js → react-BHfk4QRe.js} +1 -1
- package/dist/assets/{react-CIEK2Ei-.js → react-BqA23JAy.js} +1 -1
- package/dist/assets/{react-Dqb011PB.js → react-BsygV86H.js} +1 -1
- package/dist/assets/{react-B7GqIpoL.js → react-XoZ7aD8C.js} +1 -1
- package/dist/assets/{react-DT9gMpbF.js → react-rmAoHvXj.js} +1 -1
- package/dist/assets/{react-Ls8UDl46.js → react-tooGqts4.js} +1 -1
- package/dist/assets/{recharts-DkYxIsLi.js → recharts-DKmpCGIA.js} +1 -1
- package/dist/assets/{routePaths-Cz0AF8Dx.js → routePaths-BpLibSFl.js} +1 -1
- package/dist/assets/{sentry-DZ9rNYfw.js → sentry-BCPOyc0G.js} +1 -1
- package/dist/assets/{stripSplatSuffix-Te2Zqy4u.js → stripSplatSuffix-Dmnnw5Oe.js} +1 -1
- package/dist/assets/{url-BjdrSaU1.js → url-CdxI2rEH.js} +1 -1
- package/dist/assets/{url-DY2r7CPa.js → url-JduagIhH.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-BzNeeZZT.js → useActualMatchingMatchDetail-DuLHKjLq.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CI6Qx_-n.js → useAiCfoDashboardSuggestedQuestionsChips-BZ908ypV.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-0MZcMlGZ.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-1CQ78Q4X.js → useChargeCardPusherEvents-BxJ5Xbwu.js} +1 -1
- package/dist/assets/{useDeviceId-gFU5q5zf.js → useDeviceId-2NJBbYPM.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BkOsYAaQ.js → useEmailConnectResultRefresh-BgnlRFeW.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-C3Htu0iZ.js → useInitialThreadRequest-DCnYqu0o.js} +1 -1
- package/dist/assets/useTaskManagerAccess-DR584Qqx.js +1 -0
- package/dist/assets/{useTaskManagerPusherEvents-Da1LpD5U.js → useTaskManagerPusherEvents-BwxBoB_w.js} +1 -1
- package/dist/assets/{utils-D3rZq_G4.js → utils-rX2IEvjD.js} +1 -1
- package/dist/assets/withTransactionSidePanel-BaNmmFC5.js +25 -0
- package/dist/assets/{zeni-epic-state-95zxmizy.js → zeni-epic-state-DROyxOLw.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-BVz7TQgL.js +0 -1
- package/dist/assets/AddressScreen-DyDl-tRh.js +0 -9
- package/dist/assets/BillPayRoutes-GFA8LUX-.js +0 -119
- package/dist/assets/ChargeCardRoutes-D4YlLVsI.js +0 -71
- package/dist/assets/ConnectionAuthScreen-DoG98aIj.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-sNk7vsur.js +0 -1
- package/dist/assets/DashboardRoutes-mW-tjMuc.js +0 -20
- package/dist/assets/ExpenseAutomationRoutes-DOepnh8G.js +0 -38
- package/dist/assets/InvoicingRoutes-BNkUMYuP.js +0 -2
- package/dist/assets/MobileAppDrawer-CHFdUHPo.js +0 -1
- package/dist/assets/NotFoundScreen-BPIsWBDH.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-gJp3CGBo.js +0 -1
- package/dist/assets/PerformanceRoutes-DE0kFKjY.js +0 -1
- package/dist/assets/ReimbursementRoutes-ChwPWyQv.js +0 -68
- package/dist/assets/ReportsRoutes-CYsPWlxq.js +0 -1
- package/dist/assets/RewardsRoutes-C-TWFvBa.js +0 -1
- package/dist/assets/SignInScreen-3WOvV3S5.js +0 -1
- package/dist/assets/SignOutScreen-CKL0FwKr.js +0 -9
- package/dist/assets/TransactionDetailRoutes-D6Gttu9Z.js +0 -1
- package/dist/assets/TransactionDetailScreen-CN2_Ei-4.js +0 -5
- package/dist/assets/TransactionListRoutes-BBUdWZ4f.js +0 -1
- package/dist/assets/TreasuryRoutes-BqcgWSjx.js +0 -37
- package/dist/assets/ZeniAccountRoutes-CBtuSj8X.js +0 -57
- package/dist/assets/useAskAiCfoHostNavButtonProps-BZHyrLWc.js +0 -1
- package/dist/assets/useTaskManagerAccess-C6qhVozS.js +0 -1
- package/dist/assets/withTransactionSidePanel-iXTpLDC6.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as D}from"./liveblocks-
|
|
1
|
+
import{j as D}from"./liveblocks-CIxx6Ub6.js";import{a as o}from"./sentry-BCPOyc0G.js";import{h as H,g as W,u as X,j as m,s as q,l as Y}from"./core-Caq7Zbsp.js";import{aj as Z,N as ee,f as $,z as te,r as G,ak as ne,k as ae,U as ce}from"./index-BFK4rLhv.js";import{bn as se,fF as oe,gV as ie,oB as Q,UK as re,i8 as J,gh as le,os as ue,UL as de,UM as pe,ua as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as Ie,UN as ye,UO as Se}from"./zeni-epic-state-DROyxOLw.js";import{n as he}from"./mui-DI0hUuFr.js";import{M as Ee}from"./MobileAppDrawer-BzxL_djZ.js";import{q as R}from"./QBOConnectionScreen-Os4Qkt_2.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DpfYWNe6.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]="652fd234-9413-4f09-b7cc-99328c031ffb",a._sentryDebugIdIdentifier="sentry-dbid-652fd234-9413-4f09-b7cc-99328c031ffb")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -6,4 +6,4 @@ import{j as D}from"./liveblocks-BjcYyeQ6.js";import{a as o}from"./sentry-DZ9rNYf
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${a=>a.theme.colors.grey4};
|
|
9
|
-
`,we=Y((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:v,vendorsAccountSection:w,filing1099Section:x}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=v,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=w,{bankAccount:M,expenseCategory1099:k}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),
|
|
9
|
+
`,we=Y((function(a,e){return{accountMappingView:e.accountMappingView,isFiling1099FeatureEnabled:e.isFiling1099FeatureEnabled,isAccruedExpensesFeatureEnabled:e.isAccruedExpensesFeatureEnabled,isAccountingClassesEnabled:me(a),isAccountingClassesUpdateInProgress:a.companyViewState.passportView?.accountingClassesUpdateStatus?.fetchState==="In-Progress",isAccountingProjectsEnabled:ge(a),isAccountingProjectsUpdateInProgress:(()=>{const i=sessionStorage.getItem(l),c=i===u.pending||i===u.ready;return a.companyViewState.passportView?.accountingProjectsUpdateStatus?.fetchState==="In-Progress"||c})(),isCapitalizationFeatureEnabled:e.isCapitalizationFeatureEnabled,capitalizableAccounts:e.capitalizableAccounts,accountNamesById:e.accountNamesById,capitalizableAccountOverrides:e.capitalizableAccountOverrides,isCapitalizationThresholdSaving:e.isCapitalizationThresholdSaving,onSaveCapitalizationAccountThreshold:e.onSaveCapitalizationAccountThreshold}}),(function(a,e){const{navigate:i,location:c,isFiling1099FeatureEnabled:A}=e;return{onAccountMappingChange:r=>{const{uncategorizedAccountSection:d,billsAccountSection:z,reimbursementsAccountSection:v,vendorsAccountSection:w,filing1099Section:x}=r,{incomeAccount:C,expenseAccount:F}=d,{billPayAccount:s}=z,{reimbursementsAccount:V}=v,{prepaidExpensesAccount:p,fixedAssetsAccount:T,accruedExpensesAccount:O}=w,{bankAccount:M,expenseCategory1099:k}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),U=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,M.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,k),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(Ie()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(fe(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=H(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),M=o.useCallback(((t,n)=>{c(Q(s.companyId,t,n))}),[c,s.companyId]),k=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[B,N]of g)N===null?delete n[B]:n[B]=N;const[S,K]=g[0]??[];S!=null&&c(Q(s.companyId,S,K,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[f,_]=o.useState(!1),[P,U]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const I=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),y=t=>{U(t)};return D.jsxs(ve,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),D.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:M,onSaveCapitalizationAccountThresholds:k,location:i,isSettings:G(i),onClickMenuIcon:()=>y(!0)})]})};export{l as P,_e as U,u as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-CIxx6Ub6.js";import{a as k}from"./sentry-BCPOyc0G.js";import{a5 as I,dQ as g}from"./index-BFK4rLhv.js";import"./mui-DI0hUuFr.js";import{u as y}from"./useActualMatchingMatchDetail-DuLHKjLq.js";import b from"./NotFoundScreen-CQm7D9go.js";import{i as v,h as U,g as w}from"./core-Caq7Zbsp.js";import"./zeni-epic-state-DROyxOLw.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./stripSplatSuffix-Dmnnw5Oe.js";import"./decodeURIComponentSafe-DmjyT4t5.js";import"./routePaths-BpLibSFl.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="0b9cbf63-f788-4a28-96e6-d5ee605ae585",t._sentryDebugIdIdentifier="sentry-dbid-0b9cbf63-f788-4a28-96e6-d5ee605ae585")}catch{}})();function J(){const{matchId:t,tenantEmailDomain:e}=v(),n=U(),r=w(),R=y(t??""),a=k.useCallback((()=>{const S=I(r.state?.pathnameStackToGoBack);n(S.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:S.newStack}})}),[r.state,n,e]);if(t==null)return s.jsx(b,{});const{match:i,detailFetchState:o,handleOpenBill:l,handleRefresh:c,handleUndoReversal:d,handleContinueMatch:h,lastMatchResults:f,lastUndoResults:m,refreshStatus:p,undoReversalStatus:u}=R;return i==null?o.fetchState==="Not-Started"||o.fetchState==="In-Progress"?s.jsx(g,{detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m}):s.jsx(b,{}):s.jsx(g,{match:i,detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m})}export{J as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-CIxx6Ub6.js";import{A as i}from"./AddressScreen-ChRwBMyD.js";import s from"./NotFoundScreen-CQm7D9go.js";import"./sentry-BCPOyc0G.js";import{n as d,o as r}from"./core-Caq7Zbsp.js";import"./zeni-epic-state-DROyxOLw.js";import"./recharts-DKmpCGIA.js";import"./index-BFK4rLhv.js";import"./mui-DI0hUuFr.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="81cbb5c1-1b56-4d87-a240-ae6c03b91825",t._sentryDebugIdIdentifier="sentry-dbid-81cbb5c1-1b56-4d87-a240-ae6c03b91825")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as n}from"./liveblocks-CIxx6Ub6.js";import{a as S}from"./sentry-BCPOyc0G.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-Caq7Zbsp.js";import{a2 as $,E as D,z as L,W as V,a8 as K,a9 as U,k as _,U as m,a4 as F,_ as h,a5 as z}from"./index-BFK4rLhv.js";import{Vp as C,ip as R,fF as q,Vq as G,c8 as H,Vr as N,mH as O}from"./zeni-epic-state-DROyxOLw.js";import{n as W}from"./mui-DI0hUuFr.js";import J from"./NotFoundScreen-CQm7D9go.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]="f8b9925f-bfe5-460a-bdab-d7116fb5ccef",e._sentryDebugIdIdentifier="sentry-dbid-f8b9925f-bfe5-460a-bdab-d7116fb5ccef")}catch{}})();const Q=W.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex: 1 1 auto;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
+
`,X=M((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=q(e),a=s.roleMap!=null&&G(s.roleMap),d=i||c==="user_address"||H(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=N(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=C(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=z(d?.pathnameStackToGoBack);let t=r.poppedPathname??v();const u=d?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(t=`${t}?${f}`)}o(t,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:a=>{const d=Y(a);e(O({addressType:c,addressToCreate:d})),_?.trackSaveAddressClicked(m.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(F);function ne({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=P(),r=j(),{addressId:t,addressType:u}=E(),f=$(),I=D(),k=L.getSignedInUser(),[g,w]=S.useState(t==null),p=B((b=>t!=null?C(b,t).fetchState:"Not-Started")),x=V();if(k==null)throw Error("Can't access address page without signing in...");const A=b=>b.trackPageLoaded(t!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return S.useEffect((()=>{g||t==null||(w(!0),d(R(t,!1)))}),[g,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)?!g&&p==="Not-Started"||g&&p==="In-Progress"?n.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(U,{analytics:_,onLoad:A}),n.jsx(Q,{windowSize:f,children:n.jsx(X,{location:r,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):n.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{ne as A,Y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as h}from"./liveblocks-BjcYyeQ6.js";import{a as n}from"./sentry-DZ9rNYfw.js";import{u as _t,h as Dt,i as Lt,g as Bt,j as b,l as Ft}from"./core-B-8b0iz9.js";import{a as Mt,h as Vt,e7 as $t,z as Nt,a2 as qt,e8 as Gt,e9 as Ht,ea as zt,bq as Be,eb as We,ec as Wt,bp as Je,a5 as ge,a9 as ce,k as M,ed as me,ee as Jt,ef as Kt,av as Yt,V as Xt,w as Zt,eg as es,eh as ts,aw as ss,ei as ns,ej as as,ek as os,el as is,p as rs,bl as Fe,em as ls}from"./index-Bg2deWZq.js";import{fE as F,gt as R,U7 as us,a2h as ds,a2i as cs,jM as ms,a2j as Ss,jJ as hs,a2k as Se,jp as W,jS as J,jv as Ie,jc as he,ja as ps,jU as fs,jE as Ke,Ug as Me,gv as V,gK as gs,Uf as Is,U0 as Ve,fF as Cs,j3 as ks,a2l as bs,g8 as vs,jl as Es,jh as Ps,fG as pe,gf as ys,a2m as ws,a2n as xs,a2o as Rs,gu as Ts,go as $e,k4 as Ne,gq as qe,gw as js,a2p as Ge,jV as Os,je as As,jy as Qs,jQ as He,jB as Us,gx as _s,gy as Ds,gz as Ls,gA as Bs}from"./zeni-epic-state-95zxmizy.js";import{D as Fs,n as $,S as Ms,P as Vs}from"./mui-C33Oegsm.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-CI6Qx_-n.js";import{p as Ns}from"./pathToGoBack-Bgu6njoM.js";import{j as qs}from"./routePaths-Cz0AF8Dx.js";import{u as Gs}from"./useTaskManagerPusherEvents-Da1LpD5U.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="a593901a-509c-411e-932b-b29979432478",s._sentryDebugIdIdentifier="sentry-dbid-a593901a-509c-411e-932b-b29979432478")}catch{}})();const Hs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Ye="chat-response-generated";function zs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Ft((function(s,r){const t=F(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:J(s).detail,skillDetailError:J(s).fetchState==="Error",skillDetailLoading:J(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:as(s),resolveSyntheticAnswerPolicyTile:ns(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:D}=r,T=l.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=_s(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:K,currentQuestionAnswer:j,currentQuestionAnswerSummary:Y}=Je(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(Y,K),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Ds(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(a,o,m,E,v)=>{a&&Fe(s,a,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:a=>{s(Ie({macroId:a})),s(Us({macroId:a}))},onSaveSkill:(a,o)=>{s(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",m=a.name?.trim()??"";s(He({draft:{name:o.length>0?o:m,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{s(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{s(As({macroId:a}))},onSetSkillVisibility:(a,o)=>{s(Os({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(a,o)=>{s(V()),s($e()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,a),s(Ge())},updateCurrentInput:a=>{s(qe(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{s(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),s(qe(""))},togglePageView:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),D(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const a=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{s(Ts({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{D(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{D(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Cn=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=_t(),l=Dt(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=n.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),D=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),a=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=n.useState(void 0),[K,j]=n.useState(!1),[Y,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=n.useCallback((e=>{v(e),j(!0)}),[]),et=n.useCallback((()=>{v(void 0),j(!1)}),[]),tt=n.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=a.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=n.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,nt=b((e=>J(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const at=b((e=>F(e).uiState.currentChatSessionId))??c,C=a.routines.find((e=>e.scheduleId===f))??a.routines.find((e=>e.scheduleId===Vt(at))),O=C?.scheduleId??null,[ve,ot]=n.useState(!0);n.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=n.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=n.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=n.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=n.useCallback((()=>{t(Ke()),t(Me())}),[t]),dt=n.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();n.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();n.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=qt(),Q=Yt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=n.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=n.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=n.useCallback(((e,d)=>{const U=e.sessionId??I.sessionId;U!=null&&L&&l(`/${y}/ai-cfo/${U}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=n.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:X.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,X]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=Ht({isFileUploadEnabled:s,tenantEmailDomain:y}),ne=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:D,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,q=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;S(!0);const d={...e};delete d[Be],l(i,{replace:!0,state:d})}),[i.pathname,i.search,i.state,l]);const[bt,ae]=n.useState(null),[vt,oe]=n.useState(!1),[Et,ie]=n.useState(void 0),[Pt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[q,ye,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const G=g.uiState.lastContextMessage;n.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ae(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),H=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Qe=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Je(Qe,u),Rt=xt.length===0;n.useEffect((()=>{x||Q||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,Q,l,i.state]);const Tt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),d=k.tenantEmailDomain;l(e.poppedPathname??(d!=null?`/${d}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Ue=n.useRef(void 0),_e=n.useRef(void 0);n.useEffect((()=>{const e=c!==Ue.current,d=u!==_e.current;Ue.current=c,_e.current=u,c!==u&&(!e||c==null||qs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,d,U)=>U.onEventReceived(e,d)})),[je]);n.useEffect((()=>{H!=="In-Progress"&&z&&t(Es())}),[H,z,t]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||H==="Completed"&&!z)&&t(Ps(u,w.userId))}),[Oe,H,Ae,z,u,w,c,t]);const ue=w?.userId,Ot=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>De(P??O),onEvent:(e,d)=>{const U=(de=>{if(de==null||typeof de!="object")return null;const _=de;return fe(_.schedule_id)&&fe(_.run_id)?{scheduleId:_.schedule_id,runId:_.run_id,status:Hs.find((Ut=>Ut===_.status))??null,finishedAt:fe(_.finished_at)?_.finished_at:null}:null})(d);U!=null&&De(U.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&Q)return h.jsxs(Ks,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ne.drawerElement,h.jsx(Ys,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const Qt=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Xt.Event.aiCFOPage)}),Q&&ne.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Qe,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:Q?ne.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:a.fetchState==="Error",routineListLoading:a.fetchState==="In-Progress",routineMaxRoutines:a.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:a.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:D,promoDismissalScope:y}),p&&Q?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Xs,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!Q?h.jsx(Jt,{open:p,onClose:()=>S(!1),children:h.jsx(Kt,{children:Qt})}):null]})},ze=$(Ms)`
|
|
1
|
+
import{j as h}from"./liveblocks-CIxx6Ub6.js";import{a as n}from"./sentry-BCPOyc0G.js";import{u as _t,h as Dt,i as Lt,g as Bt,j as b,l as Ft}from"./core-Caq7Zbsp.js";import{a as Mt,j as Vt,e7 as $t,z as Nt,a2 as qt,e8 as Gt,e9 as Ht,ea as zt,bq as Be,eb as We,ec as Wt,bp as Je,a5 as ge,a9 as ce,k as M,ed as me,ee as Jt,ef as Kt,av as Yt,U as Xt,w as Zt,eg as es,eh as ts,aw as ss,ei as ns,ej as as,ek as os,el as is,p as rs,bl as Fe,em as ls}from"./index-BFK4rLhv.js";import{fE as F,gt as R,U7 as us,a2h as ds,a2i as cs,jM as ms,a2j as Ss,jJ as hs,a2k as Se,jp as W,jS as J,jv as Ie,jc as he,ja as ps,jU as fs,jE as Ke,Ug as Me,gv as V,gK as gs,Uf as Is,U0 as Ve,fF as Cs,j3 as ks,a2l as bs,g8 as vs,jl as Es,jh as Ps,fG as pe,gf as ys,a2m as ws,a2n as xs,a2o as Rs,gu as Ts,go as $e,k4 as Ne,gq as qe,gw as js,a2p as Ge,jV as Os,je as As,jy as Us,jQ as He,jB as Qs,gx as _s,gy as Ds,gz as Ls,gA as Bs}from"./zeni-epic-state-DROyxOLw.js";import{D as Fs,n as $,S as Ms,P as Vs}from"./mui-DI0hUuFr.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-BZ908ypV.js";import{p as Ns}from"./pathToGoBack-Ch5lrOj1.js";import{j as qs}from"./routePaths-BpLibSFl.js";import{u as Gs}from"./useTaskManagerPusherEvents-BwxBoB_w.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="0b79597a-2151-42cc-9328-0c5118ebfe7e",s._sentryDebugIdIdentifier="sentry-dbid-0b79597a-2151-42cc-9328-0c5118ebfe7e")}catch{}})();const Hs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Ye="chat-response-generated";function zs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Ft((function(s,r){const t=F(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:J(s).detail,skillDetailError:J(s).fetchState==="Error",skillDetailLoading:J(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:as(s),resolveSyntheticAnswerPolicyTile:ns(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:D}=r,T=l.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=_s(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:K,currentQuestionAnswer:j,currentQuestionAnswerSummary:Y}=Je(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(Y,K),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Ds(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(a,o,m,E,v)=>{a&&Fe(s,a,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:a=>{s(Ie({macroId:a})),s(Qs({macroId:a}))},onSaveSkill:(a,o)=>{s(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",m=a.name?.trim()??"";s(He({draft:{name:o.length>0?o:m,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{s(Us({macroId:a,version:o}))},onDeleteSkill:a=>{s(As({macroId:a}))},onSetSkillVisibility:(a,o)=>{s(Os({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(a,o)=>{s(V()),s($e()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,a),s(Ge())},updateCurrentInput:a=>{s(qe(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{s(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),s(qe(""))},togglePageView:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),D(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const a=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{s(Ts({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{D(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{D(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Cn=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=_t(),l=Dt(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=n.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),D=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),a=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=n.useState(void 0),[K,j]=n.useState(!1),[Y,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=n.useCallback((e=>{v(e),j(!0)}),[]),et=n.useCallback((()=>{v(void 0),j(!1)}),[]),tt=n.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=a.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=n.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,nt=b((e=>J(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const at=b((e=>F(e).uiState.currentChatSessionId))??c,C=a.routines.find((e=>e.scheduleId===f))??a.routines.find((e=>e.scheduleId===Vt(at))),O=C?.scheduleId??null,[ve,ot]=n.useState(!0);n.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=n.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=n.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=n.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=n.useCallback((()=>{t(Ke()),t(Me())}),[t]),dt=n.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();n.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();n.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=qt(),U=Yt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=n.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=n.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=n.useCallback(((e,d)=>{const Q=e.sessionId??I.sessionId;Q!=null&&L&&l(`/${y}/ai-cfo/${Q}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=n.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:X.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,X]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=Ht({isFileUploadEnabled:s,tenantEmailDomain:y}),ne=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:D,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,q=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;S(!0);const d={...e};delete d[Be],l(i,{replace:!0,state:d})}),[i.pathname,i.search,i.state,l]);const[bt,ae]=n.useState(null),[vt,oe]=n.useState(!1),[Et,ie]=n.useState(void 0),[Pt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[q,ye,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const G=g.uiState.lastContextMessage;n.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ae(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),H=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Ue=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Je(Ue,u),Rt=xt.length===0;n.useEffect((()=>{x||U||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,l,i.state]);const Tt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),d=k.tenantEmailDomain;l(e.poppedPathname??(d!=null?`/${d}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Qe=n.useRef(void 0),_e=n.useRef(void 0);n.useEffect((()=>{const e=c!==Qe.current,d=u!==_e.current;Qe.current=c,_e.current=u,c!==u&&(!e||c==null||qs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,d,Q)=>Q.onEventReceived(e,d)})),[je]);n.useEffect((()=>{H!=="In-Progress"&&z&&t(Es())}),[H,z,t]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||H==="Completed"&&!z)&&t(Ps(u,w.userId))}),[Oe,H,Ae,z,u,w,c,t]);const ue=w?.userId,Ot=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>De(P??O),onEvent:(e,d)=>{const Q=(de=>{if(de==null||typeof de!="object")return null;const _=de;return fe(_.schedule_id)&&fe(_.run_id)?{scheduleId:_.schedule_id,runId:_.run_id,status:Hs.find((Qt=>Qt===_.status))??null,finishedAt:fe(_.finished_at)?_.finished_at:null}:null})(d);Q!=null&&De(Q.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&U)return h.jsxs(Ks,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ne.drawerElement,h.jsx(Ys,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const Ut=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Xt.Event.aiCFOPage)}),U&&ne.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:U?ne.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:a.fetchState==="Error",routineListLoading:a.fetchState==="In-Progress",routineMaxRoutines:a.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:a.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:D,promoDismissalScope:y}),p&&U?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Xs,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!U?h.jsx(Jt,{open:p,onClose:()=>S(!1),children:h.jsx(Kt,{children:Ut})}):null]})},ze=$(Ms)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-BjcYyeQ6.js";import{a as o,R as ya}from"./sentry-DZ9rNYfw.js";import{u as Me,j as r,g as Ta,h as $a,q as R}from"./core-B-8b0iz9.js";import{fF as Fe,T_ as Ba,T$ as Ue,g9 as xa,gv as W,U0 as J,jE as Ie,jc as ve,U1 as Aa,U2 as _a,gO as Da,p$ as Ma,U3 as Fa,U4 as ye,gm as Ua,U5 as $,fE as Ga,gt as Ra,U6 as Za,U7 as Va,U8 as ja,U9 as Te,Ua as Ha,Ub as $e,Uc as Na,Eb as Pa,gn as La,h1 as Oa,cV as za,Ud as qa,Ue as Ya,qC as Qa,g8 as Wa,j6 as Ja,Uf as Ka,Ug as Xa,wu as et,go as at}from"./zeni-epic-state-95zxmizy.js";import{w as tt,i as nt,a as ot,O as st,E as rt,o as it,S as m,c as lt,u as dt,d as ct,Q as ut,e as mt,f as Ct,g as pt,h as ht,j as ft,z as gt,k as Z,p,m as Be,l as bt,N as St,n as xe,q as kt,R as Ae,r as Et,s as wt,v as X,x as K,y as It,A as vt,B as yt,L as Tt,C as $t,D as Bt,F as ee,H as xt,I as At}from"./index-Bg2deWZq.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-C33Oegsm.js";import{u as Ut}from"./InboxNotificationsProvider-B4UF_uUg.js";import{u as Gt}from"./useTaskManagerAccess-C6qhVozS.js";import{u as Rt}from"./expenseAutomationHelper-BzOPc0En.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="18c24607-63a4-40b7-9b44-00daad24a8a2",a._sentryDebugIdIdentifier="sentry-dbid-18c24607-63a4-40b7-9b44-00daad24a8a2")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Zt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,A]=ya.useState(!1),[S,Ge]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Me(),[Re,Ze]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(W()),n(J()))}),[n,ne]),o.useEffect((()=>{n(W()),n(J())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Le=Ct(i,Pe,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>Aa(e)));o.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=R("/signout")!==null,M=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&D&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ye(l))}}}),[le,t.state]);const Ye=qe||g,L=r((e=>e.tenantState)),Qe=r((e=>L.fetchState==="Completed"?Ua(e):[])),{isFeatureEnabled:We}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>Za(e))),ce=r((e=>Va(e).routines)),la=o.useMemo((()=>ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[ce]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[v,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Ut(),U=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return me==="In-Progress"&&F==="Completed"?(n(Te({chatSessionId:v})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(Te({chatSessionId:v})),z(void 0)))}),[n,t.state,s,F,v,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;He(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||U.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,U.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=U;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ue({unreadCount:N},"comments")))}}),[N,U.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];We===!1&&y.push("accounts_payable_aging"),Je===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),se===!1&&y.push("expense_automation_card");const fe=r((e=>Na(e,y).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?La(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),T=e=>{A(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&Z.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const x=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:f.currentSelectedView}})}n(ye(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Qa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:L.currentTenantId??"",tenants:L.fetchState==="Completed"?Qe:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:P.rewardsPlan},selectedMenu:C===!0?Ae("ai_cfo"):xe(t)&&ue!=="completed"?Ae("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:xe(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Le,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(Tt.TENANT_SWITCHING),T(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&Z.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Ka()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(W()),n(J()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(Z.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void K({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),Q=e.type,we=At(Q)&&Q!=="command_center";if(Q!=="command_center"&&!we||h[i.tenantId]==null||Z.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:I,onPeriodChange:Sa,onCalendarOpen:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Ke,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>T(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ia=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Zt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>T(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((A=>Fe(A))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ue({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
1
|
+
import{j as d}from"./liveblocks-CIxx6Ub6.js";import{a as o,R as ya}from"./sentry-BCPOyc0G.js";import{u as Me,j as r,g as Ta,h as $a,q as R}from"./core-Caq7Zbsp.js";import{fF as Fe,T_ as Ba,T$ as Ue,g9 as xa,gv as K,U0 as Q,jE as Ie,jc as ve,U1 as Aa,U2 as _a,gO as Da,p$ as Ma,U3 as Fa,U4 as ye,gm as Ua,U5 as $,fE as Ga,gt as Ra,U6 as Za,U7 as Va,U8 as ja,U9 as Te,Ua as Ha,Ub as $e,Uc as Na,Eb as Pa,gn as La,h1 as Oa,cV as za,Ud as qa,Ue as Ya,qC as Ja,g8 as Ka,j6 as Qa,Uf as Wa,Ug as Xa,wu as et,go as at}from"./zeni-epic-state-DROyxOLw.js";import{w as tt,i as nt,a as ot,F as st,E as rt,N as it,f as m,c as lt,u as dt,d as ct,Q as ut,e as mt,g as Ct,h as pt,j as ht,l as ft,z as gt,k as Z,p,m as Be,n as bt,o as St,q as xe,r as kt,R as Ae,s as Et,v as wt,x as X,y as W,A as It,B as vt,C as yt,L as Tt,D as $t,H as Bt,I as ee,J as xt,K as At}from"./index-BFK4rLhv.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-DI0hUuFr.js";import{u as Ut}from"./InboxNotificationsProvider-DcarX1j5.js";import{u as Gt}from"./useTaskManagerAccess-DR584Qqx.js";import{u as Rt}from"./expenseAutomationHelper-B83Qa5Jl.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="7e331d0d-2f81-4513-b92b-045f1e943eed",a._sentryDebugIdIdentifier="sentry-dbid-7e331d0d-2f81-4513-b92b-045f1e943eed")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Zt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,A]=ya.useState(!1),[S,Ge]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Me(),[Re,Ze]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(Q()))}),[n,ne]),o.useEffect((()=>{n(K()),n(Q())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[N,He]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Le=Ct(i,Pe,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>Aa(e)));o.useEffect((()=>{const e=()=>{Ze(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=R("/signout")!==null,M=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&D&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ye(l))}}}),[le,t.state]);const Ye=qe||g,L=r((e=>e.tenantState)),Je=r((e=>L.fetchState==="Completed"?Ua(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>Za(e))),ce=r((e=>Va(e).routines)),la=o.useMemo((()=>ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[ce]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[v,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Ut(),U=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(v!=null)return me==="In-Progress"&&F==="Completed"?(n(Te({chatSessionId:v})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(Te({chatSessionId:v})),z(void 0)))}),[n,t.state,s,F,v,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;He(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||U.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,U.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=U;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ue({unreadCount:N},"comments")))}}),[N,U.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];Ke===!1&&y.push("accounts_payable_aging"),Qe===!1&&y.push("accounts_receivable_aging"),y.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&y.push("rewards_card"),se===!1&&y.push("expense_automation_card");const fe=r((e=>Na(e,y).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?La(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),T=e=>{A(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&Z.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const x=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:x,referrer:f.currentSelectedView}})}n(ye(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:L.currentTenantId??"",tenants:L.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:P.rewardsPlan},selectedMenu:C===!0?Ae("ai_cfo"):xe(t)&&ue!=="completed"?Ae("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:xe(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Le,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(Tt.TENANT_SWITCHING),T(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&Z.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Wa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void W({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void W({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(Q()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(Z.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void W({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=At(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||Z.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:I,onPeriodChange:Sa,onCalendarOpen:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:We,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>T(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ia=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Zt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>T(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((A=>Fe(A))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(A,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ue({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
2
2
|
height: 20px;
|
|
3
3
|
width: 20px;
|
|
4
4
|
color: ${a=>a.theme.colors.primary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-BjcYyeQ6.js";import{a as d}from"./sentry-DZ9rNYfw.js";import{h as U,g as B,u as j,j as y,N as H,l as V,i as W,n as te,o as x}from"./core-B-8b0iz9.js";import{fF as P,Z0 as w,YJ as R,HL as E,HF as q,HJ as A,Hy as J,YL as K,HC as ae,HN as oe,HB as Y,HQ as z,HM as C}from"./zeni-epic-state-95zxmizy.js";import{z as O,w as M,b_ as pe,q as T,bU as Q,b$ as le,E as Z,a8 as G,c0 as se,c1 as ne}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-CrWl9trk.js";import ie from"./NotFoundScreen-BPIsWBDH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="759eaa3a-209e-418c-8497-a31855b30031",e._sentryDebugIdIdentifier="sentry-dbid-759eaa3a-209e-418c-8497-a31855b30031")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(Y(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(Y(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
1
|
+
import{j as u}from"./liveblocks-CIxx6Ub6.js";import{a as d}from"./sentry-BCPOyc0G.js";import{h as U,g as B,u as j,j as y,N as H,l as V,i as W,n as te,o as x}from"./core-Caq7Zbsp.js";import{fF as P,Z0 as w,YJ as R,HL as E,HF as q,HJ as A,Hy as J,YL as K,HC as ae,HN as oe,HB as Y,HQ as z,HM as C}from"./zeni-epic-state-DROyxOLw.js";import{z as O,w as M,b_ as pe,r as T,bU as Q,b$ as le,E as Z,a8 as G,c0 as se,c1 as ne}from"./index-BFK4rLhv.js";import"./mui-DI0hUuFr.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-Si973dRZ.js";import ie from"./NotFoundScreen-CQm7D9go.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]="3a59128f-29a8-45e7-a280-235f5d944616",e._sentryDebugIdIdentifier="sentry-dbid-3a59128f-29a8-45e7-a280-235f5d944616")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(J(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,b,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(H,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const m=!!re(b.value);return{type:m?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(I);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(Y(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=g?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(Y(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import{j as a}from"./liveblocks-CIxx6Ub6.js";import{h as J,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-Caq7Zbsp.js";import{fF as W,Yj as Ge,bq as It,Sj as ia,bo as vt,bJ as de,Yk as kt,G$ as wt,Io as Re,HC as oa,bn as Ce,Yl as la,Ym as sa,c8 as ra,Yn as ca,l$ as xt,Yo as Bt,Yp as Ct,IS as Ue,Hi as xe,Yq as da,GP as et,Yr as ua,MH as pa,GT as ma,GZ as At,Ys as Se,Yt as _e,Ip as Me,Hf as Dt,Yu as ba,Yv as ha,Is as Ne,Yw as ga,Iy as Sa,Yx as Et,I1 as tt,I6 as ya,Yy as fa,Yz as ce,YA as Tt,YB as jt,YC as Pt,gV as Ia,Hn as Ve,cG as Ft,YD as va,gh as ka,YE as wa,YF as xa,d_ as Rt,dZ as Vt,YG as Oe,YH as Ba,YI as Ca,WT as Ye,YJ as Aa,WU as ie,WV as ze,YK as Da,YL as Ea,YM as Ta,I8 as at,I5 as ja,YN as Pa,YO as Fa,YP as Ra,HT as Va,YQ as $a,YR as La,cu as $t,da as Lt,ma as Ga,bO as Ua,br as Gt,bP as Ut,G3 as _a,YS as Ma,Mu as Na,MA as Oa,Cd as Ya,Iq as za,IZ as Za,mn as ge,YT as Ha,YU as _t,mR as Wa,mh as Mt,mC as Nt,mB as nt,bE as pe,bN as qa,YV as Ja,YW as ye,kN as Ka,YX as it,YY as Xa,kR as Qa,la as en,Jb as tn,YZ as an,mK as nn,J1 as on,Y_ as ot,J5 as ln,Ja as sn,J8 as rn,I$ as cn,Y$ as Ot,H8 as dn,Z0 as un,Z1 as pn,gG as mn,gF as bn,gE as hn,mq as gn,mI as lt,mT as Sn,uX as yn,mz as fn,J3 as In,kX as vn,mY as kn,Z2 as wn,kP as xn,uO as Bn,Z3 as Cn,HZ as An,bK as Dn,bt as En,Ui as Tn,dd as jn,dc as Pn,cF as Fn,cM as Rn}from"./zeni-epic-state-DROyxOLw.js";import{E as ue,z as V,W as fe,at as Ze,N as oe,f,bj as He,a8 as se,J as A,a9 as Ae,k as E,bw as Vn,a5 as H,aw as We,p as D,a2 as Ie,bx as st,by as rt,bz as $n,aA as Ln,ag as Gn,aT as Un,ac as Yt,G as De,ah as qe,bA as _n,af as zt,bB as Mn,ar as Nn,U as Zt,w as On,bC as Yn,bD as zn,bE as Zn,bF as Hn,bG as Wn,bH as qn,bI as Jn,bJ as Kn,bK as Xn,F as Qn,bL as ei,bt as ti,bM as ai,aj as ni,bN as ii,g as oi}from"./index-BFK4rLhv.js";import{n as G,S as li}from"./mui-DI0hUuFr.js";import{A as ct}from"./AddressScreen-ChRwBMyD.js";import{g as ne,a as Ee,i as Ht,V as Je,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-DjZA-xGp.js";import{a as g}from"./sentry-BCPOyc0G.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-0MZcMlGZ.js";import{u as Wt}from"./useInitialThreadRequest-DCnYqu0o.js";import{u as di}from"./BusinessVerificationPageScreen-e_hf599B.js";import Be from"./NotFoundScreen-CQm7D9go.js";import{D as ui}from"./DrawerScreen-D1drFQnx.js";import{M as qt}from"./MobileAppDrawer-BzxL_djZ.js";import{F as Jt}from"./FeaturePreviewScreen-BOIyRrPg.js";import{S as Te}from"./SetupPagesScreen-Ctwh4sou.js";import{B as pi}from"./BillPayApprovalRoutes-Ct7bUe2K.js";import{F as mi}from"./ScreenRoutes-DivUQ8Cf.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./routePaths-BpLibSFl.js";import"./InboxNotificationsProvider-DcarX1j5.js";import"./useTaskManagerAccess-DR584Qqx.js";import"./analyticsHelper-CyJSZC50.js";import"./ReimbursementApprovalRuleDetailScreen-Si973dRZ.js";import"./getLocaleForTenant-CqonawWC.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]="a80e23ac-5429-4ee0-a355-cfed7716dddb",e._sentryDebugIdIdentifier="sentry-dbid-a80e23ac-5429-4ee0-a355-cfed7716dddb")}catch{}})();const bi=X((function(e,t){const l=Ge(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${We}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(At(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ct({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:l}))}}}))(Vn);function hi(){const e=J(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>W(U))),s=v((U=>Ge(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Wt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:_}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:Y}=$(He.zeniAssistConfig),z=ia(o),w=vt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=Y.user_ids!=null&&r?.userId!=null&&Y.user_ids.includes(r?.userId),{isFeatureEnabled:Z}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,M,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),t(wt(n??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,O,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,q]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:U=>(N=>{n!=null&&N.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Z,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Yt(100,58)},ut=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=J(),{billId:n}=ee(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(He.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>W(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[O,_]=g.useState(!1),[Y,z]=g.useState(),w=v((P=>_e(P,m,h,n)));let M=w.fetchState,L=w.file,Z=w.showAutofill;const q=v((P=>Ge(P,n??"")));u===!1&&(M=q.fetchState,L=q.transactionDetails?.attachments?.[0],Z=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Me(!0))}),[n,t]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[B,k,u,n,t,S,I,b]);const N={onOkClick:()=>{if(_(!1),!Y)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Ne(Y,m,n))},onCancelClick:()=>{if(_(!1),!Y)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:Y,billId:n}))}},te=g.useCallback((()=>{const P=H(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||q.fetchState==="Error")return a.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:_,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||Z?null:a.jsx(pt,{children:a.jsx(Kt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[Z&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:N,isEditPopup:!0}):null,o==="small"||Z?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:Z,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,q,w),setShowConfirmationPopup:_,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=_n();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
|
|
2
|
+
${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=G.div`
|
|
3
|
+
margin-bottom: 20px;
|
|
4
|
+
margin-top: 20px;
|
|
5
|
+
margin-left: ${A.sp5};
|
|
6
|
+
position: absolute;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
`,Ii=G.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding-top: 9px;
|
|
14
|
+
gap: ${A.sp2};
|
|
15
|
+
margin-bottom: -${A.sp2};
|
|
16
|
+
`,vi=G(qe.StandardMedium)``,ki=G((e=>g.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},g.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
|
|
17
|
+
color: ${e=>e.theme.colors.hero};
|
|
18
|
+
height: ${A.sp3};
|
|
19
|
+
width: ${A.sp3};
|
|
20
|
+
`,Kt=G((e=>g.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},g.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))))`
|
|
21
|
+
width: ${A.sp3};
|
|
22
|
+
height: ${A.sp3};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
color: ${e=>e.theme.colors.champion};
|
|
25
|
+
&:hover {
|
|
26
|
+
color: ${e=>e.theme.colors.primary};
|
|
27
|
+
}
|
|
28
|
+
`,je=G.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
height: 100vh;
|
|
31
|
+
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
32
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
33
|
+
position: relative;
|
|
34
|
+
&::after {
|
|
35
|
+
content: "";
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 57px;
|
|
38
|
+
left: 42%;
|
|
39
|
+
width: 1px;
|
|
40
|
+
height: calc(100% - 57px);
|
|
41
|
+
background-color: ${e=>e.theme.colors.grey2};
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
z-index: 3;
|
|
44
|
+
display: ${e=>e.windowSize==="small"?"none":"block"};
|
|
45
|
+
}
|
|
46
|
+
`,Pe=G.div`
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 56px;
|
|
49
|
+
left: 0;
|
|
50
|
+
width: 42%;
|
|
51
|
+
height: 1px;
|
|
52
|
+
background-color: ${e=>e.theme.colors.grey2};
|
|
53
|
+
z-index: 3;
|
|
54
|
+
`,mt=G.div`
|
|
55
|
+
position: fixed;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
background-color: ${Gn.overlayBackgroundBlack};
|
|
61
|
+
z-index: 5;
|
|
62
|
+
`,Fe=G.div`
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
width: ${e=>`${gi.containerWidth.value(e.windowSize)}%`};
|
|
66
|
+
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
67
|
+
`,wi=G(qe.H6Regular)`
|
|
68
|
+
margin-top: ${A.sp7};
|
|
69
|
+
padding-left: ${A.sp8};
|
|
70
|
+
padding-right: ${A.sp8};
|
|
71
|
+
color: ${e=>e.theme.colors.primary};
|
|
72
|
+
word-break: break-word;
|
|
73
|
+
`,xi=G(qe.LargeRegularSp)`
|
|
74
|
+
color: ${e=>e.theme.colors.hero};
|
|
75
|
+
padding-left: ${A.sp8};
|
|
76
|
+
padding-right: ${A.sp8};
|
|
77
|
+
margin-bottom: 30px;
|
|
78
|
+
margin-top: ${A.sp4};
|
|
79
|
+
white-space: pre-line;
|
|
80
|
+
`,Bi=X((function(e,t){return{billsReviewView:Et(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/bills`),e(ce())},onCloseReviewItem:l=>{e(fa(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(ya());break;case"approve":case"review":e(tt("approved",n??""));break;case"reject":e(tt("rejected",n??""))}}}}))(Mn);function Ci({tenantEmailDomain:e}){const t=J(),l=v((c=>c.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:n}=v((c=>Et(c)));return g.useEffect((()=>{l!=="Completed"&&n.length!==0||t(`/${e}/bills`)}),[l,n.length,e]),a.jsx(Bi,{navigate:t,analytics:E,tenantEmailDomain:e})}const ae=Ca(),Xt="bulk-operation-update",Le="bill-approval-rule-update",{common:ke}=De.getLocalizedStrings(),Ai=G.div`
|
|
81
|
+
display: flex;
|
|
82
|
+
min-height: 100%;
|
|
83
|
+
width: 100%;
|
|
84
|
+
flex: 1 1 auto;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
align-items: center;
|
|
87
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
88
|
+
`,Di=X((function(e,t){const l=V.getSignedInUser(),n=Ce(l),c=Pt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ye(e,"common"),s=e.tenantState.currentTenantId,i=W(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,S=c.fetchState,h=Aa(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics:E,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${We}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Tt(o))},onSubtabChange:o=>{e(ce()),e(jt(o))},onTransactionClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;E?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=D(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e($a(o))},onReloadTransactions:()=>{e(Ve(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(Va(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Ra({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&E.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&E.trackSpendManagementDownloadClick("bill_pay"),e(Fa({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Pa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(ja(o,s??""));break;case"send_for_approval":e(at("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(at("approve")),t.navigate("./bulk-review");break;case"review":e(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Le)&&e(Ea(!1))},onEventReceived:o=>{o===Xt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(ze({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(On(Yn));function Ei(){const e=J(),t=le(),l=K(),n=Ie(),c=l.state,r=fe(),[u,o]=g.useState(!1),[s,i]=g.useState(null),d=aa("/:tenantEmailDomain/bills/bulk-review")!=null;g.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(jt(c?.subTab))),()=>{t(ce())})),[]);const p=V.getSignedInUser(),m=v((F=>W(F))),{areTenantIdsInSync:S}=Nn(),[h,b]=g.useState(!1),{useFeatureGate:C}=oe(),{isFeatureEnabled:I}=C(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:j}=C(f.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:B}=C(f.isBillPayBulkActionEnabled),{isFeatureEnabled:T}=C(f.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:k}=C(f.isBillPayDetectInsufficientFundsEnabled),$=v((F=>Pt(F,ae,B,p?.userId))),{isFeatureEnabled:O}=C(f.isDebitCardFeatureEnabled),_=$.fetchState,{isAiCfoAccessEnabled:Y,onAskAiCfoClick:z}=Xe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:_==="Completed"});const w=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,M=!!m.companyBillPayInfo?.info?.isBillPayEnabled,L=v((F=>Ia(F.companyState,m.companyId))),Z=L?.company.featuresActivationInfo.connectedAccountProvider;if(g.useEffect((()=>{!h&&M&&S&&(b(!0),t(Ve(ae,!0,I,T)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const q=(F,re)=>{t(Ba({uiState:{sortKey:F,sortOrder:re},period:ae}))},U=Ft(r?.loggedInUserRoleMap),N=de(r?.loggedInUserRoleMap),te=F=>{o(F)},{billsProcessed:P,billsProcessing:ve}=v((F=>va(F)));g.useEffect((()=>{P===ve&&s!=null&&(t(ka({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:P>1?ke.headers.bills:ke.texts.bill2},{variableName:"_has_",variableValue:P>1?ke.texts.have:ke.texts.has},{variableName:"_action_",variableValue:wa(s)}]})),t(xa()),setTimeout((()=>{t(Ve(ae,!0,I,!0,T))}),3e3),i(null))}),[P,ve]);const Qt={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Xt}`,`private-encrypted-${m.companyId}.${Le}`]:[],eventCallback:(F,re,Qe)=>{F.endsWith(Le)?Qe.onBillPayApprovalRulesEventReceived?.(F):re?.entity_type==="bill"&&(i(re.operation_type),Qe.onEventReceived(F))}},ea=Rt(O,m),ta=Vt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ea===!0||ta===!0?a.jsx(Jt,{}):M?a.jsxs(a.Fragment,{children:[_==="Completed"?a.jsx(Ae,{analytics:E,onLoad:F=>(re=>re.trackPageLoaded(Zt.Event.billPayHome))(F)}):null,a.jsxs(Ai,{windowSize:n,children:[a.jsx(qt,{isAppContentDrawerOpen:u,handleDrawerToggle:te}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Yt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(ji,{onClick:F=>F.stopPropagation(),children:a.jsx(Ci,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",period:ae,isAdmin:!1,uiState:$.uiState,onColumnSortConfigChanged:q,isUserHasOnlyBillpayAccess:U,isShowDeletedBillsEnabled:I,isShowDeletedReimbursementEnabled:j,isBulkActionEnabled:B,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{te(!0)},isDownloadEnabled:$.isDownloadEnabled,connectedAccountProvider:Z,bulkSubmissionLimit:$.billBulkSubmissionLimit,bulkSubmissionFetchState:$.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:$.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:T,isDetectInsufficientFundsEnabled:k,isAiCfoAccessEnabled:Y,onAskAiCfoClick:z,...Qt})]})]}):w===!0&&N===!0?a.jsx(Q,{to:"../setup"}):r!=null&&Oe(m,r.loggedInUserRoleMap)?a.jsx(Q,{to:"../promo"}):a.jsx(se,{fetchState:_}):a.jsx(Be,{})}const Ti=e=>`/${e}/bills/setup`,ji=G(li)`
|
|
89
|
+
display: flex;
|
|
90
|
+
min-height: 100%;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
`,{common:{currency:he},spendManagement:{billPay:{billDetails:Pi}},appName:Fi}=De.getLocalizedStrings(),Ri=X((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ye(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ce(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Fi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ua(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,C=S.add(b,"month").isAfter(h),I=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Ut(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),j=W(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${We}/transaction_attachment`,analytics:E,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:j.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:I,isZeniUser:d,isNewUser:C,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(nt(i));const d=ht(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Mt(d,!1)),e(Nt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(nt());const p=ht(s,void 0,l),m=D(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Me(i))},onSaveChangesToLocalStore:(i,d,p,m,S)=>{const h=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Wa({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(Ue("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(_t("draft"))},reviewBillDetails:()=>{const i=Vi(s,l),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(Ha()),onClickDismiss:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=$i(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Li(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Ht(s,l,i),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(At(l))},onAttachmentClick:(i,d)=>{const p=Ee(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Za(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Wn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(za(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ya("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Oa(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Na(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(_a("bill_pay","bill_pay_detail")),e(Ma({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(zn);function bt(){const e=J(),t=K(),l=le(),{billId:n,tenantEmailDomain:c}=ee(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(f.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:p}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:m}=r(f.isRecurringBillsFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=r(f.isShaDisabled),{isFeatureEnabled:b}=r(f.isOurDisabled),{isFeatureEnabled:C}=r(f.isBillPayDetectInsufficientFundsEnabled),{configValue:I}=u(He.sameDayAchDisablementConfig),j=La(I),B=V.getSignedInUser(),T=v((N=>W(N))),k=v((N=>_e(N,p,S,n))),$=Wt(T?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:O,onAskAiCfoClick:_}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:k.fetchState==="Completed"});const Y=T.companyId??V.getSignedInUserTenant(c)?.companyId,z=fe(),w=$t(z?.loggedInUserRoleMap),M=Lt(z?.loggedInUserRoleMap),L=de(z?.loggedInUserRoleMap),Z=vt(T.userRole);if(g.useEffect((()=>{n!=null&&l(kt(n))}),[n]),g.useEffect((()=>{n!=null&&l(Dt(n))}),[n,l]),B==null)throw Error("Can't access address page without signing in...");const q=v((N=>Ga(N.accountState,N.accountListState,"billPayAccountList"))),U={pathname:"../",search:t.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?a.jsx(Q,{to:U}):k.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:k.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:N=>(te=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&te.trackBillPayEditBill(n,k.isRecurring)})(N)}),a.jsx(Ri,{initialOpenThreadRequest:$??void 0,location:t,navigate:e,currentTenant:T,billId:n,companyId:Y,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:p,isLocalCurrencyEnabled:d,uncategorizedAccounts:q,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isShaDisabled:h,isOurDisabled:b,isRecurringBillsFeatureEnabled:m,hasZeniAccountsAdminAccess:w,isZeniAccountsUser:M,isBillPayAdmin:L,isSuperAdmin:Z,isDetectInsufficientFundsEnabled:C,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:O,onAskAiCfoClick:_})]})}const ht=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Vi=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},$i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",Gi=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?pe(t.whatFor.invoiceDate.toString()):Gt(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(qa)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Pi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ja(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=Ui(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Zn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Ui=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Hn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??he.currencyCode,currencySymbol:o.currency?.currencySymbol??he.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??he.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??he.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},_i=G.div`
|
|
93
|
+
display: flex;
|
|
94
|
+
height: 100vh;
|
|
95
|
+
width: 100%;
|
|
96
|
+
flex: 1 1 auto;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-items: center;
|
|
99
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
100
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
101
|
+
`,Mi=X((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=_e(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(en(s))},onSaveHandler:()=>{e(Qa(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Xa({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??gt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(it())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ka({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??gt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(it())}}}))(qn);function Ni(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),{useFeatureGate:r}=oe(),u=ue(),o=V.getSignedInUser(),s=v((h=>W(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v((h=>ye(h,n))),{isFeatureEnabled:m}=r(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=r(f.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(_i,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Mi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const gt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Oi=G.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
height: 100vh;
|
|
104
|
+
width: 100%;
|
|
105
|
+
flex: 1 1 auto;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
align-items: center;
|
|
108
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
109
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
110
|
+
`,Yi=X((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=an(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[nn(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(cn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(sn(s)),p&&e(rn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(ln(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??St();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Ke(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(on({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??St(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Jn);function zi(){const e=J(),t=K(),l=Ie(),{vendorId:n,billId:c}=ee(),r=le(),u=ue(),o=V.getSignedInUser(),s=v((B=>W(B))),i=H(t.state?.pathnameStackToGoBack),[d,p]=g.useState(!1),m=v((B=>B.vendorViewState.newVendorState.fetchStatus.fetchState)),S=v((B=>n!=null?B.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;g.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,C]=g.useState(!1);g.useEffect((()=>{b||h==="In-Progress"||(C(!0),r(tn(c,n)))}),[b,h,r]);const I=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",j=v((B=>ye(B,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return I==="billDetail"&&j.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:j.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Oi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Yi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:I})]})}const St=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},yt=G.div`
|
|
111
|
+
display: flex;
|
|
112
|
+
height: 100vh;
|
|
113
|
+
width: 100%;
|
|
114
|
+
flex: 1 1 auto;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
align-items: center;
|
|
117
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
118
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
119
|
+
`,Zi=X((function(e,t){const l=V.getSignedInUser(),n=Ot(e,t.billId),c=un(e),r=Ce(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Ut(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:E,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=D(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},saveBillDetails:(o,s)=>{o&&e(Ct({billId:n,data:s})),e(Ue(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(_t("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(xe(t.billId,"retry"))}}}))(Xn);function ft(){const e=J(),t=le(),l=K(),{billId:n}=ee(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(f.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=V.getSignedInUser(),{isFeatureEnabled:i}=c(f.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(f.isVendorRecommendationFeatureEnabled),p=H(l.state?.pathnameStackToGoBack),{poppedPathname:m}=p,{isFeatureEnabled:S}=c(f.isRecurringBillsFeatureEnabled),h=v((I=>W(I))),b=v((I=>Ot(I,n))),C=b.fetchState??"Not-Started";if(g.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),g.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),g.useEffect((()=>{const I=b.vendor?.name,j=b.vendor?.id,B=b.totalAmount.amount,T=b.recipientTotalAmount.amount,k=b.invoiceNumber;I&&j&&t(dn(I,j,B,T,k,n))}),[]),m==null)return a.jsx(Q,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return C==="In-Progress"?a.jsx(yt,{windowSize:o,children:a.jsx(Kn,{})}):a.jsx(yt,{windowSize:o,children:a.jsx(Zi,{location:l,navigate:e,currentTenant:h,billId:n,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:S,isDetectInsufficientFundsEnabled:u})})}const Hi=X((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ye(e,"common"),r=l!=null?"edit":"create",u=W(e),o=V.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${zt.fileMicroServiceBaseUrl}`,authParams:i,analytics:E,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(Bn(i))},saveVendorDetailLocalData:i=>{e(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(wn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(lt(u))},updateSelectedVendorForCreate:i=>{e(kn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Ht(s,t.billId,u):ci(s,t.billId,u):p=ri(s,t.billId,u);const m=D(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?In(i,"vendor",u):vn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ke(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(fn({files:i}))},onEditFileName:(i,d)=>{e(yn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(lt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(Sn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(gn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(ze({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??si(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(hn(i,"BillPayVendor"))},onResendOtp:i=>{e(bn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(mn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(pn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Mt(i,!1))}}}))(ai),we=()=>{const e=J(),t=le(),l=Qn(),n=K(),{billId:c,vendorId:r}=ee(),u=v((b=>W(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(f.isBillPayLocalCurrencyFeatureEnabled),[i,d]=g.useState(!1),p=v((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=v((b=>ye(b,r))),S=v((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return g.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ei,{}):h==="Error"?a.jsx(ti,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(Hi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Wi=X((function(e,t){const{companyId:l}=t;return{billPaySetupView:Cn(e,l),analytics:E,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(An(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(ii),qi=()=>{const e=ni(),t=J(),l=K(),{tenantEmailDomain:n}=ee(),[c,r]=g.useState(!1),u=ue(),o=v((h=>W(h))),s=o.companyId??V.getSignedInUserTenant(n)?.companyId,i=V.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(Q,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(Q,{to:"../../bills/setup"}):p===!1||d!=null&&Oe(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:h=>(b=>b.trackPageLoaded(Zt.Event.billPayPromoPage))(h)}),a.jsx(qt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(Wi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function To(){const e=v((Z=>W(Z))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(f.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?zi:Ni,{isFeatureEnabled:o}=c(f.isDebitCardFeatureEnabled),s=Rt(o,e),i=Vt(e),d=K(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Ft(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,C=b&&$t(t?.loggedInUserRoleMap),{isFeatureEnabled:I}=c(f.isChargeCardFeatureEnabled),j=oi(e,I,o)&&!p,B=j&&En(t?.loggedInUserRoleMap),T=Tn(t?.loggedInUserRoleMap),k=Lt(t?.loggedInUserRoleMap),$=jn(t?.loggedInUserRoleMap),O=b&&k,_=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&$,Y=Pn(t?.loggedInUserRoleMap),z=Fn(t?.loggedInUserRoleMap),w=Rn(t?.loggedInUserRoleMap),M=j&&Y,{tenantEmailDomain:L}=ee();return a.jsxs(na,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(qi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{showZeniAccountRoute:O,isUserHasBillPayAccess:z,isUserHasReimbursementAccess:w,showTreasuryRoute:_,isTenantBankingOnly:s,showChargeCardRoute:M,tenantEmailDomain:L??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:C,isChargeCardAdminLevelAccess:B,isUserHasOnlyCardAccess:T,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ei,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../setup"})}),t!=null&&Oe(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(Q,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(x,{appContent:a.jsx(hi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(x,{appContent:a.jsx(bt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(x,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(x,{appContent:a.jsx(ct,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(x,{appContent:a.jsx(we,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(x,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(x,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(x,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Be,{})})]})}export{To as default};
|