@zeniai/web-app-ui 5.3.53-qa → 5.3.54-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-B05quPfB.js → AccountMappingScreen-BlrRRyYK.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-D94Dqvel.js → ActualMatchingMatchDetailScreen-KBRWoEoc.js} +1 -1
- package/dist/assets/AddressRoutes-Coz5Rzvv.js +1 -0
- package/dist/assets/AddressScreen-DWOW-12j.js +9 -0
- package/dist/assets/{AiCfoScreen-Dj6jKppq.js → AiCfoScreen-DcDfH2LH.js} +1 -1
- package/dist/assets/{AppDrawer-DB1lzCTO.js → AppDrawer-ODeNF0Av.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-vJIdZGym.js → BillPayApprovalRoutes-CwQ70Jsb.js} +1 -1
- package/dist/assets/BillPayRoutes-DkWEe87D.js +119 -0
- package/dist/assets/{BusinessVerificationPageScreen-Bh9Wow-A.js → BusinessVerificationPageScreen-fkSKuDKx.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-Hsh2FpvU.js → CardsAiCfoScreen-D2h73Hql.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-0m2CNq4x.js → ChargeCardRoutes-BPu1nuyG.js} +8 -8
- package/dist/assets/{CompanyPassportScreen-Cvbu6LUT.js → CompanyPassportScreen-DFwJSL9V.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-CRvnQSlr.js → ConnectionAuthScreen-rwpCK8vj.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-CsmvVXX5.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-kZOJ1QhA.js → CustomerOnboardingRoutes-2FuFx1YW.js} +1 -1
- package/dist/assets/DashboardRoutes-CsVUKDom.js +20 -0
- package/dist/assets/{DefaultTenantHome-CTOQPic5.js → DefaultTenantHome-EK1ZTLpJ.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-DgaHcUL_.js → DomesticWireDetailScreen-B2sK3gnq.js} +3 -3
- package/dist/assets/{DrawerScreen-BeSv1Aix.js → DrawerScreen-Cxs0fLXJ.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-D5eIJPR7.js → EntityDetailRoutes-J1t-f_rN.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-DHppK74x.js → ExpenseAutomationRoutes-CdYiuFY6.js} +1 -1
- package/dist/assets/FeaturePreviewScreen-DWnnuRXB.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-CThBYwg5.js → HubSpotOAuthCallbackScreen-BKy1DBij.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-D6QvVVj8.js → InboxNotificationsProvider-B8qyHdbE.js} +1 -1
- package/dist/assets/{InvoicingRoutes-DvFmEcE9.js → InvoicingRoutes-_2bztMtp.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-B1yYt0y7.js → MagicLinkRoutes-BMUhHQh1.js} +8 -8
- package/dist/assets/MagicLinkSignInScreen-BWBaBqgd.js +12 -0
- package/dist/assets/{MobileAppDrawer-D3MVdjfj.js → MobileAppDrawer-DEHTsboI.js} +1 -1
- package/dist/assets/NotFoundScreen-tLaFUNLQ.js +1 -0
- package/dist/assets/{NotificationRoutes-3MhigWw8.js → NotificationRoutes-CbQ2m8ON.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-Br6J-Kjw.js → OAuthConsentScreen-CDpRBEpx.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-BT242PEu.js → PandLWithForecastRoutes-DA-gkwnG.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-D304LK9q.js → PaymentLinkScreen-BRzaAbpf.js} +1 -1
- package/dist/assets/{PeopleRoutes-Cs1oFIJn.js → PeopleRoutes-DFwhgdPC.js} +3 -3
- package/dist/assets/PerformanceRoutes-D0mskpFQ.js +1 -0
- package/dist/assets/{Preview-CDuSXomS.js → Preview-BBxDhQ0O.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-CXR9MUeu.js → QBOConnectionScreen-BajGDFuL.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CADwX7m0.js → ReimbursementApprovalRoutes-BTAP_qed.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-C__AcyMO.js → ReimbursementApprovalRuleDetailScreen-DJEm2XXH.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-DE9--ARn.js → ReimbursementRoutes-BgavHl4p.js} +4 -4
- package/dist/assets/{ReportsRoutes-B_EvlWob.js → ReportsRoutes-C93h6574.js} +1 -1
- package/dist/assets/RewardsRoutes-CjIMfvYV.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-270QQSkr.js → ScheduleDetailsPrepaidExpensesScreen-bMBkbiJF.js} +4 -4
- package/dist/assets/ScreenRoutes-HNN5txks.js +2 -0
- package/dist/assets/{SettingsRoutes-DjTGDDEp.js → SettingsRoutes-CslaKFsZ.js} +6 -6
- package/dist/assets/{SetupPagesScreen-mQ33CI-8.js → SetupPagesScreen-BknhxMJr.js} +1 -1
- package/dist/assets/SignInScreen-DDXFdnmo.js +1 -0
- package/dist/assets/SignOutScreen-CdohYlzt.js +9 -0
- package/dist/assets/{TaskListScreen-_mHmu42Q.js → TaskListScreen-BamiN5-8.js} +2 -2
- package/dist/assets/{TaskRoutes-DRFV_DYt.js → TaskRoutes-B2KOXvdP.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-VLp4TIB7.js +1 -0
- package/dist/assets/{TransactionDetailScreen-Dmc1SB66.js → TransactionDetailScreen-DUQhWS53.js} +1 -1
- package/dist/assets/{TransactionListRoutes-2uPIfsci.js → TransactionListRoutes-BiDSTFZP.js} +1 -1
- package/dist/assets/{TreasuryRoutes-C62UHGaV.js → TreasuryRoutes-B0bQBu4a.js} +1 -1
- package/dist/assets/{VendorsRoutes-Dp-COjet.js → VendorsRoutes-CyexNe36.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-DEQwqZwF.js → WiseConfirmationScreen-BsFUJuRp.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-DjudE9ka.js → ZeniAccountRoutes-Bn27iI8z.js} +1 -1
- package/dist/assets/ZeniAccountStatementScreen-DnKhFx6b.js +9 -0
- package/dist/assets/{accountMappingHelper-DNRaFM1C.js → accountMappingHelper-y0E9h6aC.js} +1 -1
- package/dist/assets/{analytics-Y9Rn1Gu7.js → analytics-BDCkEq_I.js} +1 -1
- package/dist/assets/{analyticsHelper-Czpx502m.js → analyticsHelper-HN-E8Xpa.js} +1 -1
- package/dist/assets/{core-Dh_SHcAD.js → core-B2JcUSRu.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-B9wRnGXi.js → decodeURIComponentSafe-CIM8Yd6k.js} +1 -1
- package/dist/assets/{dnd-CwwWYFuT.js → dnd-BAPMa4RJ.js} +1 -1
- package/dist/assets/{empty-BT_7GI6y.js → empty-D7vR8z68.js} +1 -1
- package/dist/assets/{empty-XI8MiQF0.js → empty-M8CZcWYb.js} +1 -1
- package/dist/assets/{emptyVideoElement-JNmKZqZz.js → emptyVideoElement-nUJqd2nB.js} +1 -1
- package/dist/assets/{epic-COW9EFJg.js → epic-IH41xxG2.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-jy143DnO.js → expenseAutomationHelper-Dd7fQN5z.js} +1 -1
- package/dist/assets/{getLocaleForTenant-BTnTjmTv.js → getLocaleForTenant-CHied7Hb.js} +1 -1
- package/dist/assets/{index-8Q8Cb_pA.js → index-BTTj-4b5.js} +1 -1
- package/dist/assets/{index-D_bKIveY.js → index-DKVU_IvY.js} +2 -2
- package/dist/assets/{index-C4rZANm7.js → index-DKZ4YAZy.js} +1 -1
- package/dist/assets/{index-CHaKE3QQ.js → index-DoNDPHnj.js} +14545 -14423
- package/dist/assets/{index-DTprL6g9.js → index-P1XHqiT-.js} +1 -1
- package/dist/assets/{index-D3h8toFn.js → index-PCu_2P3b.js} +1 -1
- package/dist/assets/{index-DOYaY83A.js → index-dmkrZYpO.js} +1 -1
- package/dist/assets/{index-B23hmQHl.js → index-gjFAkOOB.js} +1 -1
- package/dist/assets/{lexical-CaftfZ9D.js → lexical-DGZ06Yv6.js} +1 -1
- package/dist/assets/{liveblocks-DR8KfETq.js → liveblocks-DXYs6rwe.js} +1 -1
- package/dist/assets/{lottie-ODKvpFjz.js → lottie-C9Rxpkwh.js} +1 -1
- package/dist/assets/{mui-BYn_Ugho.js → mui-BLmtkCLd.js} +1 -1
- package/dist/assets/{pathToGoBack-BiqpVJeS.js → pathToGoBack-DqGGHSwL.js} +1 -1
- package/dist/assets/{pdf-DnQo5-Qw.js → pdf-DMCYUxGc.js} +3 -3
- package/dist/assets/{pdf-lib-DdZd3IiB.js → pdf-lib-D7-8SdHl.js} +1 -1
- package/dist/assets/{plaid-Dw8l1kdg.js → plaid-DHQC2tsw.js} +1 -1
- package/dist/assets/{pusher-CewboUYG.js → pusher-C76wt9sK.js} +1 -1
- package/dist/assets/{react-gSPYEWZo.js → react-B2hEGyNu.js} +1 -1
- package/dist/assets/{react-CWd2ZkNi.js → react-BX0k_7jA.js} +1 -1
- package/dist/assets/{react-8By583h-.js → react-D7gGxl9M.js} +1 -1
- package/dist/assets/{react-B8IvMjeE.js → react-Dvat3Ckm.js} +1 -1
- package/dist/assets/{react-BgmP_PBP.js → react-DzK6xFD8.js} +1 -1
- package/dist/assets/{react-ygIo2ccY.js → react-Y6cTJufT.js} +1 -1
- package/dist/assets/{recharts-BTL88W4R.js → recharts-UN7cJOXN.js} +1 -1
- package/dist/assets/{routePaths-DXpM4tZj.js → routePaths-V2hUGG4a.js} +1 -1
- package/dist/assets/{sentry-FwaDhTzy.js → sentry-BmkYxd02.js} +1 -1
- package/dist/assets/{stripSplatSuffix-CvpfThkG.js → stripSplatSuffix-DXBpTroJ.js} +1 -1
- package/dist/assets/{url-DHu7Ejzz.js → url-Cjk2PJJX.js} +1 -1
- package/dist/assets/{url-DybJ-sxa.js → url-DgDGkycQ.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-uLKulkDS.js → useActualMatchingMatchDetail-RtuBBjbC.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-Bn69qFOr.js +1 -0
- package/dist/assets/{useAskAiCfoHostNavButtonProps-PLm72Ozi.js → useAskAiCfoHostNavButtonProps-qSqQpxG4.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-LUqnb4UF.js → useChargeCardPusherEvents-BPnD4KLb.js} +1 -1
- package/dist/assets/{useDeviceId-CUJxM_KE.js → useDeviceId-IlYBwHEv.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-CKnBwo84.js → useEmailConnectResultRefresh-dPGnutjz.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-DLA6PIFe.js → useInitialThreadRequest-DK2o3yi9.js} +1 -1
- package/dist/assets/useTaskManagerAccess-BNcDbxmw.js +1 -0
- package/dist/assets/{useTaskManagerPusherEvents-DchZU-tO.js → useTaskManagerPusherEvents-DoGLBnPU.js} +1 -1
- package/dist/assets/{utils-DEAaFgLU.js → utils-BGWE7tXK.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DLRTZIl6.js → withTransactionSidePanel-BJHiJX6z.js} +2 -2
- package/dist/assets/{zeni-epic-state-DJh0-ZeR.js → zeni-epic-state-DpjvBN7b.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/AddressRoutes-BBXKWkgP.js +0 -1
- package/dist/assets/AddressScreen-DkOVp1Il.js +0 -9
- package/dist/assets/BillPayRoutes-Ie8KE_Pm.js +0 -119
- package/dist/assets/CustomerOnboardingAuthScreen-SW-uc7QE.js +0 -1
- package/dist/assets/DashboardRoutes-DTB-wwS1.js +0 -20
- package/dist/assets/FeaturePreviewScreen-vWprV4-Z.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-CZM8ZeV4.js +0 -12
- package/dist/assets/NotFoundScreen-BG5HsGgf.js +0 -1
- package/dist/assets/PerformanceRoutes-DevypuzE.js +0 -1
- package/dist/assets/RewardsRoutes-fsFKnuDQ.js +0 -1
- package/dist/assets/ScreenRoutes-B0DNEVGO.js +0 -2
- package/dist/assets/SignInScreen-BVOxylXT.js +0 -1
- package/dist/assets/SignOutScreen-BXBPUD_K.js +0 -9
- package/dist/assets/TransactionDetailRoutes-BqJM9clh.js +0 -1
- package/dist/assets/ZeniAccountStatementScreen-fuK8OSl5.js +0 -9
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CJfIwtxx.js +0 -1
- package/dist/assets/useTaskManagerAccess-D4PJ1zkK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as D}from"./liveblocks-
|
|
1
|
+
import{j as D}from"./liveblocks-DXYs6rwe.js";import{a as o}from"./sentry-BmkYxd02.js";import{h as W,g as K,u as X,j as m,s as q,l as Y}from"./core-B2JcUSRu.js";import{aj as Z,c as ee,v as G,z as te,n as H,ak as ne,j as ae,W as ce}from"./index-DoNDPHnj.js";import{bn as se,fF as oe,gV as ie,oB as $,UE as re,i8 as J,gh as le,os as ue,UF as de,UG as pe,u6 as ge,l$ as me,oq as Ae,om as be,ox as Ie,ia as fe,UH as ye,UI as Se}from"./zeni-epic-state-DpjvBN7b.js";import{n as he}from"./mui-BLmtkCLd.js";import{M as Ee}from"./MobileAppDrawer-DEHTsboI.js";import{q as R}from"./QBOConnectionScreen-BajGDFuL.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-y0E9h6aC.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]="04949b5c-5180-4f3a-806d-60e2c92590f2",a._sentryDebugIdIdentifier="sentry-dbid-04949b5c-5180-4f3a-806d-60e2c92590f2")}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-DR8KfETq.js";import{a as o}from"./sentry-FwaDhTz
|
|
|
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:j,expenseCategory1099:M}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),k=h(e.accountMappingView.expenseAccountList,F.selectedOption),
|
|
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:j,expenseCategory1099:M}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),k=h(e.accountMappingView.expenseAccountList,F.selectedOption),I=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),f=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),L=E(e.accountMappingView.bankAccounts1099FilingAccountList,j.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,M),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:k?.accountId,selectedBillPayAccountId:I?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:f.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:L.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{H(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(fe()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(Ie(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=W(),i=K(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A(G.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A(G.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),j=o.useCallback(((t,n)=>{c($(s.companyId,t,n))}),[c,s.companyId]),M=o.useCallback((t=>{const n={...p??{}},g=Object.entries(t);for(const[B,N]of g)N===null?delete n[B]:n[B]=N;const[S,Q]=g[0]??[];S!=null&&c($(s.companyId,S,Q,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),k=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[I,_]=o.useState(!1),[P,U]=o.useState(!1);o.useEffect((()=>{I===!1&&(c(J()),_(!0))}),[I]);const f=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((()=>{f&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[f,s?.tenantEmailDomain,c]);const L=m((t=>pe(t))),y=t=>{U(t)};return D.jsxs(ve,{children:[D.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),D.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:L,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:k,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:j,onSaveCapitalizationAccountThresholds:M,location:i,isSettings:H(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-DXYs6rwe.js";import{a as k}from"./sentry-BmkYxd02.js";import{a5 as I,dQ as g}from"./index-DoNDPHnj.js";import"./mui-BLmtkCLd.js";import{u as y}from"./useActualMatchingMatchDetail-RtuBBjbC.js";import b from"./NotFoundScreen-tLaFUNLQ.js";import{i as v,h as U,g as w}from"./core-B2JcUSRu.js";import"./zeni-epic-state-DpjvBN7b.js";import"./recharts-UN7cJOXN.js";import"./analytics-BDCkEq_I.js";import"./plaid-DHQC2tsw.js";import"./dnd-BAPMa4RJ.js";import"./stripe-cKAAJElX.js";import"./lottie-C9Rxpkwh.js";import"./lexical-DGZ06Yv6.js";import"./pdf-DMCYUxGc.js";import"./utils-BGWE7tXK.js";import"./stripSplatSuffix-DXBpTroJ.js";import"./decodeURIComponentSafe-CIM8Yd6k.js";import"./routePaths-V2hUGG4a.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-DXYs6rwe.js";import{A as i}from"./AddressScreen-DWOW-12j.js";import s from"./NotFoundScreen-tLaFUNLQ.js";import"./sentry-BmkYxd02.js";import{n as d,o as r}from"./core-B2JcUSRu.js";import"./zeni-epic-state-DpjvBN7b.js";import"./recharts-UN7cJOXN.js";import"./index-DoNDPHnj.js";import"./mui-BLmtkCLd.js";import"./analytics-BDCkEq_I.js";import"./plaid-DHQC2tsw.js";import"./dnd-BAPMa4RJ.js";import"./stripe-cKAAJElX.js";import"./lottie-C9Rxpkwh.js";import"./lexical-DGZ06Yv6.js";import"./pdf-DMCYUxGc.js";import"./utils-BGWE7tXK.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 r}from"./liveblocks-DXYs6rwe.js";import{a as h}from"./sentry-BmkYxd02.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-B2JcUSRu.js";import{a2 as $,E as D,z as L,Q as V,a8 as K,a9 as F,j as _,W as S,a4 as z,_ as b,a5 as N}from"./index-DoNDPHnj.js";import{Vj as C,ip as R,fF as U,Vk as G,c8 as H,Vl as O,mH as q}from"./zeni-epic-state-DpjvBN7b.js";import{n as Q}from"./mui-BLmtkCLd.js";import W from"./NotFoundScreen-tLaFUNLQ.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]="b0a7f8f9-78fe-43b1-877a-11cf94116759",e._sentryDebugIdIdentifier="sentry-dbid-b0a7f8f9-78fe-43b1-877a-11cf94116759")}catch{}})();const J=Q.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex: 1 1 auto;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
+
`,X=M((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=U(e),a=s.roleMap!=null&&G(s.roleMap),n=i||c==="user_address"||H(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=O(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:n,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const d=C(e,o);return{addressToEdit:d.address,loadingState:d.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:n}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const n=i.state,d=N(n?.pathnameStackToGoBack);let t=d.poppedPathname??k();const u=n?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(t=`${t}?${f}`)}o(t,{state:{pathnameStackToGoBack:d.newStack}})}};return{onSubmitHandler:a=>{const n=Y(a);e(q({addressType:c,addressToCreate:n})),_?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(z);function re({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),n=P(),d=j(),{addressId:t,addressType:u}=E(),f=$(),v=D(),I=L.getSignedInUser(),[g,w]=h.useState(t==null),p=B((m=>t!=null?C(m,t).fetchState:"Not-Started")),x=V();if(I==null)throw Error("Can't access address page without signing in...");const A=m=>m.trackPageLoaded(t!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{g||t==null||(w(!0),n(R(t,!1)))}),[g,t,n]),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"?r.jsx(K,{fetchState:p,style:{backgroundColor:v.colors.grey5}}):t!=null&&p==="Error"?(a(`${k(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(F,{analytics:_,onLoad:A}),r.jsx(J,{windowSize:f,children:r.jsx(X,{location:d,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):r.jsx(W,{})}const k=(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{re as A,Y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as h}from"./liveblocks-DR8KfETq.js";import{a}from"./sentry-FwaDhTzy.js";import{u as Dt,h as Ut,i as Lt,g as Bt,j as b,l as Ft}from"./core-Dh_SHcAD.js";import{a as Mt,V as Vt,e7 as $t,z as Nt,a2 as Gt,e8 as qt,e9 as zt,ea as Ht,bp as Be,eb as We,ec as Wt,bo as Je,a5 as ge,a9 as ce,j as M,ed as me,ee as Jt,ef as Kt,av as Yt,S as Xt,w as Zt,eg as es,eh as ts,aw as ss,ei as as,ej as ns,ek as os,el as is,p as rs,bl as Fe,em as ls}from"./index-CHaKE3QQ.js";import{fE as F,gt as R,U1 as us,a29 as ds,a2a as cs,jM as ms,a2b as Ss,jJ as hs,a2c as Se,jD as W,jT as J,jl as Ie,jB as he,jz as ps,jQ as fs,ju as Ke,Ua as Me,gv as V,gK as gs,U9 as Is,TW as Ve,fF as Cs,j3 as ks,a2d as bs,g8 as vs,jh as Es,jd as Ps,fG as pe,gf as ys,a2e as ws,a2f as xs,a2g as Rs,gu as Ts,go as $e,k4 as Ne,gq as Ge,gw as js,a2h as qe,jV as Os,ja as As,jo as Qs,jR as ze,jr as _s,gx as Ds,gy as Us,gz as Ls,gA as Bs}from"./zeni-epic-state-DJh0-ZeR.js";import{D as Fs,n as $,S as Ms,P as Vs}from"./mui-BYn_Ugho.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-CJfIwtxx.js";import{p as Ns}from"./pathToGoBack-BiqpVJeS.js";import{j as Gs}from"./routePaths-DXpM4tZj.js";import{u as qs}from"./useTaskManagerPusherEvents-DchZU-tO.js";import"./recharts-BTL88W4R.js";import"./analytics-Y9Rn1Gu7.js";import"./plaid-Dw8l1kdg.js";import"./dnd-CwwWYFuT.js";import"./stripe-cKAAJElX.js";import"./lottie-ODKvpFjz.js";import"./lexical-CaftfZ9D.js";import"./pdf-DnQo5-Qw.js";import"./utils-DEAaFgLU.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]="8316dc0b-9985-4753-bc14-23d413abcabc",s._sentryDebugIdIdentifier="sentry-dbid-8316dc0b-9985-4753-bc14-23d413abcabc")}catch{}})();const zs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Ye="chat-response-generated";function Hs(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:Hs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:J(s).detail,skillDetailError:J(s).fetchState==="Error",skillDetailLoading:J(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:ns(s),resolveSyntheticAnswerPolicyTile:as(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:U}=r,T=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=Ds(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,Us(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(n,o,m,E,v)=>{n&&Fe(s,n,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:n=>{s(Ie({macroId:n})),s(_s({macroId:n}))},onSaveSkill:(n,o)=>{s(ze({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",m=n.name?.trim()??"";s(ze({draft:{name:o.length>0?o:m,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(Qs({macroId:n,version:o}))},onDeleteSkill:n=>{s(As({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Os({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(qe())},onRunSkill:(n,o)=>{s(V()),s($e()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,n),s(qe())},updateCurrentInput:n=>{s(Ge(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(js(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Ge(""))},togglePageView:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),U(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const n=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(Ts({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{U(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{U(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Ia=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=Dt(),l=Ut(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=a.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),U=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=a.useState(void 0),[K,j]=a.useState(!1),[Y,Ce]=a.useState(void 0),Xe=a.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=a.useCallback((e=>{v(e),j(!0)}),[]),et=a.useCallback((()=>{v(void 0),j(!1)}),[]),tt=a.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=n.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=a.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,at=b((e=>J(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";a.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const nt=b((e=>F(e).uiState.currentChatSessionId))??c,C=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Vt(nt))),O=C?.scheduleId??null,[ve,ot]=a.useState(!0);a.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=a.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=a.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=a.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=a.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=a.useCallback((()=>{t(Ke()),t(Me())}),[t]),dt=a.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();a.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();a.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=Gt(),Q=Yt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=a.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=a.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=a.useCallback(((e,d)=>{const _=e.sessionId??I.sessionId;_!=null&&L&&l(`/${y}/ai-cfo/${_}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=a.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:qt(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}=zt({isFileUploadEnabled:s,tenantEmailDomain:y}),ae=Ht({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:U,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,G=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;a.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,ne]=a.useState(null),[vt,oe]=a.useState(!1),[Et,ie]=a.useState(void 0),[Pt,re]=a.useState(void 0),we=a.useRef(!1);a.useEffect((()=>{if(!we.current&&G!=null&&G!==""){const e=i.state;ne(G),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[G,ye,i.state]);const yt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const q=g.uiState.lastContextMessage;a.useEffect((()=>{q!=null&&q!==""&&u!=null&&(ne(q),oe(!0),ie(void 0),re(void 0),t(bs()))}),[q,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),z=g.fetchState,H=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;a.useEffect((()=>{x||Q||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,Q,l,i.state]);const Tt=a.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]),_e=a.useRef(void 0),De=a.useRef(void 0);a.useEffect((()=>{const e=c!==_e.current,d=u!==De.current;_e.current=c,De.current=u,c!==u&&(!e||c==null||Gs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=a.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,d,_)=>_.onEventReceived(e,d)})),[je]);a.useEffect((()=>{z!=="In-Progress"&&H&&t(Es())}),[z,H,t]),a.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||z==="Completed"&&!H)&&t(Ps(u,w.userId))}),[Oe,z,Ae,H,u,w,c,t]);const ue=w?.userId,Ot=a.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Ue=a.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);qs({events:Ot,onSubscribed:()=>Ue(P??O),onEvent:(e,d)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const D=de;return fe(D.schedule_id)&&fe(D.run_id)?{scheduleId:D.schedule_id,runId:D.run_id,status:zs.find((_t=>_t===D.status))??null,finishedAt:fe(D.finished_at)?D.finished_at:null}:null})(d);_!=null&&Ue(_.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}),ae.drawerElement,h.jsx(Ys,{children:h.jsx(He,{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&&ae.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?ae.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:n.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:U,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(He,{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]})},He=$(Ms)`
|
|
1
|
+
import{j as h}from"./liveblocks-DXYs6rwe.js";import{a}from"./sentry-BmkYxd02.js";import{u as Dt,h as Ut,i as Lt,g as Bt,j as b,l as Ft}from"./core-B2JcUSRu.js";import{a as Mt,T 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,j as M,ed as me,ee as Jt,ef as Kt,av as Yt,W as Xt,w as Zt,eg as es,eh as ts,aw as ss,ei as as,ej as ns,ek as os,el as is,p as rs,bl as Fe,em as ls}from"./index-DoNDPHnj.js";import{fE as F,gt as R,U1 as us,a29 as ds,a2a as cs,jM as ms,a2b as Ss,jJ as hs,a2c as Se,jD as W,jT as J,jl as Ie,jB as he,jz as ps,jQ as fs,ju as Ke,Ua as Me,gv as V,gK as gs,U9 as Is,TW as Ve,fF as Cs,j3 as ks,a2d as bs,g8 as vs,jh as Es,jd as Ps,fG as pe,gf as ys,a2e as ws,a2f as xs,a2g as Rs,gu as Ts,go as $e,k4 as Ne,gq as qe,gw as js,a2h as Ge,jV as Os,ja as As,jo as Qs,jR as He,jr as _s,gx as Ds,gy as Us,gz as Ls,gA as Bs}from"./zeni-epic-state-DpjvBN7b.js";import{D as Fs,n as $,S as Ms,P as Vs}from"./mui-BLmtkCLd.js";import{u as $s}from"./useAiCfoDashboardSuggestedQuestionsChips-Bn69qFOr.js";import{p as Ns}from"./pathToGoBack-DqGGHSwL.js";import{j as qs}from"./routePaths-V2hUGG4a.js";import{u as Gs}from"./useTaskManagerPusherEvents-DoGLBnPU.js";import"./recharts-UN7cJOXN.js";import"./analytics-BDCkEq_I.js";import"./plaid-DHQC2tsw.js";import"./dnd-BAPMa4RJ.js";import"./stripe-cKAAJElX.js";import"./lottie-C9Rxpkwh.js";import"./lexical-DGZ06Yv6.js";import"./pdf-DMCYUxGc.js";import"./utils-BGWE7tXK.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]="cc5c7cb7-4dfb-4f0a-8840-414eb8f49259",s._sentryDebugIdIdentifier="sentry-dbid-cc5c7cb7-4dfb-4f0a-8840-414eb8f49259")}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:ns(s),resolveSyntheticAnswerPolicyTile:as(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:U}=r,T=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===Ye&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=Ds(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,Us(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(n,o,m,E,v)=>{n&&Fe(s,n,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Ke())},onOpenSkill:n=>{s(Ie({macroId:n})),s(_s({macroId:n}))},onSaveSkill:(n,o)=>{s(He({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",m=n.name?.trim()??"";s(He({draft:{name:o.length>0?o:m,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(Qs({macroId:n,version:o}))},onDeleteSkill:n=>{s(As({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Os({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(n,o)=>{s(V()),s($e()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,n),s(Ge())},updateCurrentInput:n=>{s(qe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(js(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(qe(""))},togglePageView:()=>{const n=ge(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),U(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(V()),f!=null&&s($e());const n=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(Ts({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{U(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{U(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Ia=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=Dt(),l=Ut(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=a.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),U=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=a.useState(void 0),[K,j]=a.useState(!1),[Y,Ce]=a.useState(void 0),Xe=a.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=a.useCallback((e=>{v(e),j(!0)}),[]),et=a.useCallback((()=>{v(void 0),j(!1)}),[]),tt=a.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=n.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=a.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,at=b((e=>J(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";a.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const nt=b((e=>F(e).uiState.currentChatSessionId))??c,C=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Vt(nt))),O=C?.scheduleId??null,[ve,ot]=a.useState(!0);a.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=a.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=a.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=a.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),X=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=a.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=a.useCallback((()=>{t(Ke()),t(Me())}),[t]),dt=a.useCallback((()=>{t(V())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=$t();a.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();a.useEffect((()=>c==="routines"?(t(V()),void t(Is())):c==="skills"?(t(Se()),t(Ve()),void t(Me())):(O==null&&t(Se()),t(Ve()),void t(V()))),[t,O,f,c]);const pt=qt(),Q=Yt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=a.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=a.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=a.useCallback(((e,d)=>{const _=e.sessionId??I.sessionId;_!=null&&L&&l(`/${y}/ai-cfo/${_}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=a.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:X.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,X]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=Ht({isFileUploadEnabled:s,tenantEmailDomain:y}),ae=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:U,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=$s(),N=i.state,q=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;a.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,ne]=a.useState(null),[vt,oe]=a.useState(!1),[Et,ie]=a.useState(void 0),[Pt,re]=a.useState(void 0),we=a.useRef(!1);a.useEffect((()=>{if(!we.current&&q!=null&&q!==""){const e=i.state;ne(q),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[q,ye,i.state]);const yt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||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;a.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ne(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;a.useEffect((()=>{x||Q||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,Q,l,i.state]);const Tt=a.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]),_e=a.useRef(void 0),De=a.useRef(void 0);a.useEffect((()=>{const e=c!==_e.current,d=u!==De.current;_e.current=c,De.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=a.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ye}`)),eventCallback:(e,d,_)=>_.onEventReceived(e,d)})),[je]);a.useEffect((()=>{H!=="In-Progress"&&z&&t(Es())}),[H,z,t]),a.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=a.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Ue=a.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>Ue(P??O),onEvent:(e,d)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const D=de;return fe(D.schedule_id)&&fe(D.run_id)?{scheduleId:D.schedule_id,runId:D.run_id,status:Hs.find((_t=>_t===D.status))??null,finishedAt:fe(D.finished_at)?D.finished_at:null}:null})(d);_!=null&&Ue(_.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}),ae.drawerElement,h.jsx(Ys,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const 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&&ae.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?ae.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:K,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:X,routines:n.routines,onRoutineCreate:Xe,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:Y,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:U,promoDismissalScope:y}),p&&Q?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Xs,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!Q?h.jsx(Jt,{open:p,onClose:()=>S(!1),children:h.jsx(Kt,{children:Qt})}):null]})},ze=$(Ms)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-DR8KfETq.js";import{a as o,R as ya}from"./sentry-FwaDhTzy.js";import{u as Me,j as r,g as Ta,h as $a,q as R}from"./core-Dh_SHcAD.js";import{fF as Fe,TU as Ba,TV as Ze,g9 as xa,gv as K,TW as X,ju as Ie,jB as ve,TX as Aa,TY as _a,gO as Da,p$ as Ma,TZ as Fa,T_ as ye,gm as Za,T$ as $,fE as Ga,gt as Ra,U0 as Ua,U1 as Va,U2 as ja,U3 as Te,U4 as Ha,U5 as $e,U6 as Na,E5 as Pa,gn as La,h1 as Oa,cV as za,U7 as Ya,U8 as qa,qC as Wa,g8 as Ka,j6 as Xa,U9 as Ja,Ua as Qa,wq as et,go as at}from"./zeni-epic-state-DJh0-ZeR.js";import{w as tt,i as nt,a as ot,O as st,E as rt,c as it,A as m,d as lt,u as dt,e as ct,o as ut,f as mt,g as Ct,W as pt,V as ht,h as ft,z as gt,j as U,p,m as Be,k as bt,K as St,l as xe,n as kt,Y as Ae,q as Et,N as wt,r as Q,s as J,v as It,x as vt,y as yt,L as Tt,B as $t,C as Bt,D as ee,F as xt,Z as At}from"./index-CHaKE3QQ.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-BYn_Ugho.js";import{u as Zt}from"./InboxNotificationsProvider-D6QvVVj8.js";import{u as Gt}from"./useTaskManagerAccess-D4PJ1zkK.js";import{u as Rt}from"./expenseAutomationHelper-jy143DnO.js";import"./recharts-BTL88W4R.js";import"./analytics-Y9Rn1Gu7.js";import"./plaid-Dw8l1kdg.js";import"./dnd-CwwWYFuT.js";import"./stripe-cKAAJElX.js";import"./lottie-ODKvpFjz.js";import"./lexical-CaftfZ9D.js";import"./pdf-DnQo5-Qw.js";import"./utils-DEAaFgLU.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]="225a2e5d-e609-449c-8a8a-0ac025d100a8",a._sentryDebugIdIdentifier="sentry-dbid-225a2e5d-e609-449c-8a8a-0ac025d100a8")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Ut=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:Q,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,Ue]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(X()))}),[n,ne]),o.useEffect((()=>{n(K()),n(X())}),[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=()=>{Ue(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,Ye=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 qe=Ye||g,L=r((e=>e.tenantState)),We=r((e=>L.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Qe}=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=>Ua(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),Y=O.uiState.currentChatSessionId,F=v!=null?O.deleteChatSessionStateByChatSessionId[v]?.fetchState:void 0,me=ft(F),{inboxNotifications:q,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Zt(),Z=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&&q!=null){const e=`dashboard_${i.companyId}`;He(q.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,q]),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||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];Ke===!1&&y.push("accounts_payable_aging"),Xe===!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"&&Ya(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(I.monthEndCloseChecks?.auditSummary!=null&&U.trackMonthCloseAuditPage(e.month,e.year,I.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",I.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(qa(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(Wa({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"?We: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&&U.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Ja()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(X()),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(U.trackAICFOChatScreenStateChanged("viewed","left_menu",Y??null,null),!H)return void J({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),W=e.type,we=At(W)&&W!=="command_center";if(W!=="command_center"&&!we||h[i.tenantId]==null||U.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)?(Y!=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(Xa(e)),Y===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:Je,thanksGivingAnimationEnabled:Qe,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(Ut,{className:c.root,children:[d.jsx(Ft,{}),qe===!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:Q,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:Q,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(Ze({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-DXYs6rwe.js";import{a as o,R as ya}from"./sentry-BmkYxd02.js";import{u as Me,j as r,g as Ta,h as $a,q as G}from"./core-B2JcUSRu.js";import{fF as Fe,TU as Ba,TV as Ze,g9 as xa,gv as K,TW as X,ju as Ie,jB as ve,TX as Aa,TY as _a,gO as Da,p$ as Ma,TZ as Fa,T_ as ye,gm as Za,T$ as $,fE as Ra,gt as Ga,U0 as Ua,U1 as Va,U2 as ja,U3 as Te,U4 as Ha,U5 as $e,U6 as Pa,E5 as La,gn as Na,h1 as Oa,cV as za,U7 as qa,U8 as Ya,qC as Wa,g8 as Ka,j6 as Xa,U9 as Ja,Ua as Qa,wq as et,go as at}from"./zeni-epic-state-DpjvBN7b.js";import{w as tt,i as nt,a as ot,V as st,E as rt,c as it,v as m,d as lt,u as dt,e as ct,H as ut,f as mt,g as Ct,I as pt,T as ht,h as ft,z as gt,j as U,p,m as Be,k as bt,M as St,l as xe,n as kt,o as Ae,q as Et,K as wt,r as Q,s as J,x as It,y as vt,A as yt,L as Tt,B as $t,C as Bt,D as ee,F as xt,R as At}from"./index-DoNDPHnj.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-BLmtkCLd.js";import{u as Zt}from"./InboxNotificationsProvider-B8qyHdbE.js";import{u as Rt}from"./useTaskManagerAccess-BNcDbxmw.js";import{u as Gt}from"./expenseAutomationHelper-Dd7fQN5z.js";import"./recharts-UN7cJOXN.js";import"./analytics-BDCkEq_I.js";import"./plaid-DHQC2tsw.js";import"./dnd-BAPMa4RJ.js";import"./stripe-cKAAJElX.js";import"./lottie-C9Rxpkwh.js";import"./lexical-DGZ06Yv6.js";import"./pdf-DMCYUxGc.js";import"./utils-BGWE7tXK.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]="e6894533-267d-4047-bbaf-eb5afed43861",a._sentryDebugIdIdentifier="sentry-dbid-e6894533-267d-4047-bbaf-eb5afed43861")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Ut=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:Q,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,A]=ya.useState(!1),[S,Re]=o.useState(!1),t=Ta(),s=$a(),ae=xa(),te=st(),n=Me(),[Ge,Ue]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(X()))}),[n,ne]),o.useEffect((()=>{n(K()),n(X())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Rt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(ve()))}),[n,w,i.tenantId,E]);const[P,He]=o.useState(void 0),Pe=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Le}=u(m.isChargeCardFeatureEnabled),Ne=Ct(i,Le,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=()=>{Ue(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const L=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,qe=G("/signout")!==null,M=G("/:tenantEmailDomain/dashboard")!==null,ie=G("/:tenantEmailDomain/reports")!==null,g=G("/:tenantEmailDomain/onboarding/*")!==null,le=Gt();o.useEffect((()=>{w&&D&&!g&&L.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,L.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,N=r((e=>e.tenantState)),We=r((e=>N.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ra(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Ua(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}=Zt(),Z=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||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(P!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:P},"comments")))}}),[P,Z.fetchState]);const ma={fetchStatus:sa,count:ta},y=[];Ke===!1&&y.push("accounts_payable_aging"),Xe===!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=>Pa(e,y).fetchState)),ge=r((e=>La(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Na(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&&U.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(Wa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:N.currentTenantId??"",tenants:N.fetchState==="Completed"?We:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:L.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:Pe,isChargeCardEnabled:Ne,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{T(!1);const e=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&&U.trackSidePanelClicked(e.type,e.group),T(!1),a==null)return;if(e.type==="routines")return H?(n(ve()),n(Ja()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(X()),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(U.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const R=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:R,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),W=e.type,we=At(W)&&W!=="command_center";if(W!=="command_center"&&!we||h[i.tenantId]==null||U.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const R=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${R.month}-${R.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const va=vt(e.type);yt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${va}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Xa(e)),q===e&&z(e)},handleLogOutClick:()=>{T(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:I,onPeriodChange:Sa,onCalendarOpen:Re,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Je,thanksGivingAnimationEnabled:Qe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ge?`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(Ut,{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:Q,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:Q,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(Ze({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-DR8KfETq.js";import{a as d}from"./sentry-FwaDhTzy.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-Dh_SHcAD.js";import{fF as P,YV as w,YC as R,HF as E,Hz as q,HD as A,Hs as K,YE as Y,Hw as ae,HH as oe,Hv as z,HK as G,HG as C}from"./zeni-epic-state-DJh0-ZeR.js";import{z as T,w as J,bZ as pe,n as O,bT as Z,b_ as le,E as M,a8 as Q,b$ as se,c0 as ne}from"./index-CHaKE3QQ.js";import"./mui-BYn_Ugho.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-C__AcyMO.js";import ie from"./NotFoundScreen-BG5HsGgf.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]="b197b088-bf80-46f8-8cfa-87d27e69f3c0",e._sentryDebugIdIdentifier="sentry-dbid-b197b088-bf80-46f8-8cfa-87d27e69f3c0")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),T.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Z(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),T.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${L}`]:[],eventCallback:(i,I,m)=>{i.endsWith(L)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const N=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Z(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(H,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
1
|
+
import{j as u}from"./liveblocks-DXYs6rwe.js";import{a as d}from"./sentry-BmkYxd02.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-B2JcUSRu.js";import{fF as P,YV as w,YC as R,HF as E,Hz as q,HD as A,Hs as K,YE as Y,Hw as ae,HH as oe,Hv as z,HK as G,HG as C}from"./zeni-epic-state-DpjvBN7b.js";import{z as O,w as J,b_ as pe,n as T,bU as M,b$ as le,E as Q,a8 as X,c0 as se,c1 as ne}from"./index-DoNDPHnj.js";import"./mui-BLmtkCLd.js";import{u as Z,i as re}from"./ReimbursementApprovalRuleDetailScreen-DJEm2XXH.js";import ie from"./NotFoundScreen-tLaFUNLQ.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]="c9c3e040-00cf-437d-a696-78a45c7b8781",e._sentryDebugIdIdentifier="sentry-dbid-c9c3e040-00cf-437d-a696-78a45c7b8781")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(Y(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(J(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),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(F,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(Y(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=M(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));Z();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(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(F,{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(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(X,{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(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=M(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Z(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(X,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(H,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import{j as a}from"./liveblocks-DXYs6rwe.js";import{h as K,u as le,g as X,i as te,j as k,N as ee,l as Q,q as ia,n as oa,o as f}from"./core-B2JcUSRu.js";import{fF as Z,Yc as Ue,bq as kt,Sd as la,bo as wt,bJ as de,Yd as Bt,GV as Ct,Ii as Ve,Hw as sa,bn as Ae,Ye as ra,Yf as ca,c8 as da,Yg as ua,l$ as xt,Yh as At,Yi as Et,IM as _e,Hc as Ce,Yj as pa,GJ as at,Yk as ma,MB as ba,GN as ha,GT as Dt,Yl as Se,Ym as Me,Ij as Ne,H9 as Tt,Yn as ga,Yo as Sa,Im as Oe,Yp as ya,Is as fa,Yq as jt,HX as nt,I0 as Ia,Yr as va,Ys as ce,Yt as Pt,Yu as Ft,Yv as Rt,gV as ka,Hh as $e,cG as Vt,Yw as wa,gh as Ba,Yx as Ca,Yy as xa,d_ as $t,dZ as Lt,Yz as Ye,YA as Aa,YB as Ea,WN as ze,YC as Da,WO as ie,WP as He,YD as Ta,YE as ja,YF as Pa,I2 as it,H$ as Fa,YG as Ra,YH as Va,YI as $a,HN as La,YJ as Ga,YK as Ua,cu as Gt,da as Ut,ma as _a,bO as Ma,br as _t,bP as Mt,FZ as Na,YL as Oa,Mo as Ya,Mu as za,C9 as Ha,Ik as Za,IT as Wa,mn as ge,YM as qa,YN as Nt,mR as Ja,mh as Ot,mC as Yt,mB as ot,bE as pe,bN as Ka,YO as Xa,YP as ye,kN as Qa,YQ as lt,YR as en,kR as tn,la as an,J5 as nn,YS as on,mK as ln,IX as sn,YT as st,I$ as rn,J4 as cn,J2 as dn,IV as un,YU as zt,H2 as pn,YV as mn,YW as bn,gG as hn,gF as gn,gE as Sn,mq as yn,mI as rt,mT as fn,uT as In,mz as vn,IZ as kn,kX as wn,mY as Bn,YX as Cn,kP as xn,uK as An,YY as En,HT as Dn,bK as Tn,bt as jn,Uc as Pn,dd as Fn,dc as Rn,cF as Vn,cM as $n}from"./zeni-epic-state-DpjvBN7b.js";import{E as ue,z as L,Q as fe,at as Ze,c as oe,v as g,bj as We,a8 as se,F as A,a9 as Ee,j,bw as Ln,a5 as H,aw as qe,p as T,a2 as Ie,bx as ct,by as dt,bz as Gn,aA as Un,ag as _n,aT as Mn,ac as Ht,G as De,ah as Je,bA as Nn,af as Zt,bB as On,ar as Yn,W as Wt,w as zn,bC as Hn,bD as Zn,bE as Wn,bF as qn,bG as Jn,bH as Kn,bI as Xn,bJ as Qn,bK as ei,V as ti,bL as ai,bt as ni,bM as ii,aj as oi,bN as li,g as si}from"./index-DoNDPHnj.js";import{n as U,S as ri}from"./mui-BLmtkCLd.js";import{A as ut}from"./AddressScreen-DWOW-12j.js";import{g as ne,a as Te,i as qt,V as Ke,b as Xe,c as ci,v as di,d as ui,A as me,D as be}from"./DomesticWireDetailScreen-B2sK3gnq.js";import{a as S}from"./sentry-BmkYxd02.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-qSqQpxG4.js";import{u as Jt}from"./useInitialThreadRequest-DK2o3yi9.js";import{u as pi}from"./BusinessVerificationPageScreen-fkSKuDKx.js";import xe from"./NotFoundScreen-tLaFUNLQ.js";import{D as mi}from"./DrawerScreen-Cxs0fLXJ.js";import{M as Kt}from"./MobileAppDrawer-DEHTsboI.js";import{F as Xt}from"./FeaturePreviewScreen-DWnnuRXB.js";import{S as je}from"./SetupPagesScreen-BknhxMJr.js";import{B as bi}from"./BillPayApprovalRoutes-CwQ70Jsb.js";import{F as hi}from"./ScreenRoutes-HNN5txks.js";import"./recharts-UN7cJOXN.js";import"./analytics-BDCkEq_I.js";import"./plaid-DHQC2tsw.js";import"./dnd-BAPMa4RJ.js";import"./stripe-cKAAJElX.js";import"./lottie-C9Rxpkwh.js";import"./lexical-DGZ06Yv6.js";import"./pdf-DMCYUxGc.js";import"./utils-BGWE7tXK.js";import"./routePaths-V2hUGG4a.js";import"./InboxNotificationsProvider-B8qyHdbE.js";import"./useTaskManagerAccess-BNcDbxmw.js";import"./analyticsHelper-HN-E8Xpa.js";import"./ReimbursementApprovalRuleDetailScreen-DJEm2XXH.js";import"./getLocaleForTenant-CHied7Hb.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]="a88b4b82-0b14-436a-addd-6b3c09c30a6e",e._sentryDebugIdIdentifier="sentry-dbid-a88b4b82-0b14-436a-addd-6b3c09c30a6e")}catch{}})();const gi=Q((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:y,isMarkAsPaidBtnVisible:h}=ra(l.billActivities,ca(t.currentTenant),n);i=y,d=h}const p=da(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ua(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))(Ln);function Si(){const e=K(),t=le(),l=X(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const y=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y,[b,I]=S.useState(!1),[E,C]=S.useState(!1),[x,_]=S.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:N}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=B(We.zeniAssistConfig),v=la(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=D(g.billPaySetupShowInternationalPaymentByWise);if(S.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),S.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),S.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",N,$,!1)))}),[b,s,n,t]),S.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t(Ve(!1,N,$,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[E,s,n,t,N,$,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(gi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,yi={containerWidth:new Ht(100,58)},mt=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Mn);function w({appContent:e}){const t=le(),l=K(),{billId:n}=te(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));pi();const[x,_]=S.useState(!1),[D,B]=S.useState(!1),[N,V]=S.useState(!1),[W,O]=S.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const J=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;S.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),S.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&_(!1))}),[n]),S.useEffect((()=>{x||n==null||u||(_(!0),t(Ct(n,y,E,!1)),t(Tt(n)),D||(B(!0),t(Ve(!1,y,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,y,E,b,n)))}),[x,D,u,n,t,y,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(Oe(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","no"),t(ga({file:W,billId:n}))}},G=S.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(C.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:O,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:J}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Gn,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,N?a.jsx(Un,{titleComponent:a.jsx(Ci,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(fi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Ii(u,q,v),setShowConfirmationPopup:V,setPayload:O,showActionButtons:vi(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function fi(){const{triggerBack:e}=Nn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Ii(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(wi,{children:`${Le.recurringBill.recurringCycle}
|
|
2
|
+
${n}/${c}`}),a.jsx(Bi,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=U.div`
|
|
3
|
+
margin-bottom: 20px;
|
|
4
|
+
margin-top: 20px;
|
|
5
|
+
margin-left: ${A.sp5};
|
|
6
|
+
position: absolute;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
`,ki=U.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding-top: 9px;
|
|
14
|
+
gap: ${A.sp2};
|
|
15
|
+
margin-bottom: -${A.sp2};
|
|
16
|
+
`,wi=U(Je.StandardMedium)``,Bi=U((e=>S.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},S.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
|
|
17
|
+
color: ${e=>e.theme.colors.hero};
|
|
18
|
+
height: ${A.sp3};
|
|
19
|
+
width: ${A.sp3};
|
|
20
|
+
`,Qt=U((e=>S.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},S.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))))`
|
|
21
|
+
width: ${A.sp3};
|
|
22
|
+
height: ${A.sp3};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
color: ${e=>e.theme.colors.champion};
|
|
25
|
+
&:hover {
|
|
26
|
+
color: ${e=>e.theme.colors.primary};
|
|
27
|
+
}
|
|
28
|
+
`,Pe=U.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
height: 100vh;
|
|
31
|
+
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
32
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
33
|
+
position: relative;
|
|
34
|
+
&::after {
|
|
35
|
+
content: "";
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 57px;
|
|
38
|
+
left: 42%;
|
|
39
|
+
width: 1px;
|
|
40
|
+
height: calc(100% - 57px);
|
|
41
|
+
background-color: ${e=>e.theme.colors.grey2};
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
z-index: 3;
|
|
44
|
+
display: ${e=>e.windowSize==="small"?"none":"block"};
|
|
45
|
+
}
|
|
46
|
+
`,Fe=U.div`
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 56px;
|
|
49
|
+
left: 0;
|
|
50
|
+
width: 42%;
|
|
51
|
+
height: 1px;
|
|
52
|
+
background-color: ${e=>e.theme.colors.grey2};
|
|
53
|
+
z-index: 3;
|
|
54
|
+
`,ht=U.div`
|
|
55
|
+
position: fixed;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
background-color: ${_n.overlayBackgroundBlack};
|
|
61
|
+
z-index: 5;
|
|
62
|
+
`,Re=U.div`
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
width: ${e=>`${yi.containerWidth.value(e.windowSize)}%`};
|
|
66
|
+
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
67
|
+
`,Ci=U(Je.H6Regular)`
|
|
68
|
+
margin-top: ${A.sp7};
|
|
69
|
+
padding-left: ${A.sp8};
|
|
70
|
+
padding-right: ${A.sp8};
|
|
71
|
+
color: ${e=>e.theme.colors.primary};
|
|
72
|
+
word-break: break-word;
|
|
73
|
+
`,xi=U(Je.LargeRegularSp)`
|
|
74
|
+
color: ${e=>e.theme.colors.hero};
|
|
75
|
+
padding-left: ${A.sp8};
|
|
76
|
+
padding-right: ${A.sp8};
|
|
77
|
+
margin-bottom: 30px;
|
|
78
|
+
margin-top: ${A.sp4};
|
|
79
|
+
white-space: pre-line;
|
|
80
|
+
`,Ai=Q((function(e,t){return{billsReviewView:jt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/bills`),e(ce())},onCloseReviewItem:l=>{e(va(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(Ia());break;case"approve":case"review":e(nt("approved",n??""));break;case"reject":e(nt("rejected",n??""))}}}}))(On);function Ei({tenantEmailDomain:e}){const t=K(),l=k((c=>c.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:n}=k((c=>jt(c)));return S.useEffect((()=>{l!=="Completed"&&n.length!==0||t(`/${e}/bills`)}),[l,n.length,e]),a.jsx(Ai,{navigate:t,analytics:j,tenantEmailDomain:e})}const ae=Ea(),ea="bulk-operation-update",Ge="bill-approval-rule-update",{common:we}=De.getLocalizedStrings(),Di=U.div`
|
|
81
|
+
display: flex;
|
|
82
|
+
min-height: 100%;
|
|
83
|
+
width: 100%;
|
|
84
|
+
flex: 1 1 auto;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
align-items: center;
|
|
87
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
88
|
+
`,Ti=Q((function(e,t){const l=L.getSignedInUser(),n=Ae(l),c=Rt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=ze(e,"common"),s=e.tenantState.currentTenantId,i=Z(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,y=c.fetchState,h=Da(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:y,analytics:j,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(Pt(o))},onSubtabChange:o=>{e(ce()),e(Ft(o))},onTransactionClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Pi(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;j?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=T(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(Ga(o))},onReloadTransactions:()=>{e($e(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(La(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e($a({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&j.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&j.trackSpendManagementDownloadClick("bill_pay"),e(Va({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Ra(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Fa(o,s??""));break;case"send_for_approval":e(it("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(it("approve")),t.navigate("./bulk-review");break;case"review":e(Pa()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ge)&&e(ja(!1))},onEventReceived:o=>{o===ea&&e(Ta())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(zn(Hn));function ji(){const e=K(),t=le(),l=X(),n=Ie(),c=l.state,r=fe(),[u,o]=S.useState(!1),[s,i]=S.useState(null),d=ia("/:tenantEmailDomain/bills/bulk-review")!=null;S.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Pt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ce())})),[]);const p=L.getSignedInUser(),m=k((P=>Z(P))),{areTenantIdsInSync:y}=Yn(),[h,b]=S.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:E}=I(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:C}=I(g.isBillPayCommentingEnabled),{isFeatureEnabled:x}=I(g.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=I(g.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:D}=I(g.isBillPayBulkActionEnabled),{isFeatureEnabled:B}=I(g.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:N}=I(g.isBillPayDetectInsufficientFundsEnabled),V=k((P=>Rt(P,ae,D,p?.userId))),{isFeatureEnabled:W}=I(g.isDebitCardFeatureEnabled),O=V.fetchState,{isAiCfoAccessEnabled:v,onAskAiCfoClick:Y}=Qe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:O==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,$=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=k((P=>ka(P.companyState,m.companyId))),J=q?.company.featuresActivationInfo.connectedAccountProvider;if(S.useEffect((()=>{!h&&$&&y&&(b(!0),t($e(ae,!0,E,B)))}),[h,ae,y,t]),p==null)throw Error("Can't access address page without signing in...");const z=(P,re)=>{t(Aa({uiState:{sortKey:P,sortOrder:re},period:ae}))},G=Vt(r?.loggedInUserRoleMap),F=de(r?.loggedInUserRoleMap),ve=P=>{o(P)},{billsProcessed:ke,billsProcessing:et}=k((P=>wa(P)));S.useEffect((()=>{ke===et&&s!=null&&(t(Ba({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:ke>1?we.headers.bills:we.texts.bill2},{variableName:"_has_",variableValue:ke>1?we.texts.have:we.texts.has},{variableName:"_action_",variableValue:Ca(s)}]})),t(xa()),setTimeout((()=>{t($e(ae,!0,E,!0,B))}),3e3),i(null))}),[ke,et]);const ta={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${ea}`,`private-encrypted-${m.companyId}.${Ge}`]:[],eventCallback:(P,re,tt)=>{P.endsWith(Ge)?tt.onBillPayApprovalRulesEventReceived?.(P):re?.entity_type==="bill"&&(i(re.operation_type),tt.onEventReceived(P))}},aa=$t(W,m),na=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Xt,{}):$?a.jsxs(a.Fragment,{children:[O==="Completed"?a.jsx(Ee,{analytics:j,onLoad:P=>(re=>re.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ve}),a.jsx(mi,{isOpen:d,drawerLeftMargin:new Ht(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(Fi,{onClick:P=>P.stopPropagation(),children:a.jsx(Ei,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Ti,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:C,isReimbursementCommentingEnabled:x,period:ae,isAdmin:!1,uiState:V.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:G,isShowDeletedBillsEnabled:E,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:D,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ve(!0)},isDownloadEnabled:V.isDownloadEnabled,connectedAccountProvider:J,bulkSubmissionLimit:V.billBulkSubmissionLimit,bulkSubmissionFetchState:V.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:V.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:B,isDetectInsufficientFundsEnabled:N,isAiCfoAccessEnabled:v,onAskAiCfoClick:Y,...ta})]})]}):M===!0&&F===!0?a.jsx(ee,{to:"../setup"}):r!=null&&Ye(m,r.loggedInUserRoleMap)?a.jsx(ee,{to:"../promo"}):a.jsx(se,{fetchState:O}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=U(ri)`
|
|
89
|
+
display: flex;
|
|
90
|
+
min-height: 100%;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
`,{common:{currency:he},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=De.getLocalizedStrings(),$i=Q((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=H(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ae(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Vi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ma(t.billDetailsView.paymentDetailsSection?.paymentType?.method),y=t.currentTenant.createTime,h=_t(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=y.add(b,"month").isAfter(h),E=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Mt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),C=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,analytics:j,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:C.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:E,isZeniUser:d,isNewUser:I,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(ot(i));const d=St(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ot(d,!1)),e(Yt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(ot());const p=St(s,void 0,l),m=T(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Oe(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Ne(i))},onSaveChangesToLocalStore:(i,d,p,m,y)=>{const h=_i(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:y}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ja({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Nt("draft"))},reviewBillDetails:()=>{const i=Li(s,l),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(qa()),onClickDismiss:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=Gi(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Ui(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=qt(s,l,i),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(i,d)=>{const p=Te(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Wa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Jn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Za(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ha("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Ya(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Na("bill_pay","bill_pay_detail")),e(Oa({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Zn);function gt(){const e=K(),t=X(),l=le(),{billId:n,tenantEmailDomain:c}=te(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(g.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(g.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(g.isRecurringBillsFeatureEnabled),{isFeatureEnabled:h}=r(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(g.isShaDisabled),{isFeatureEnabled:I}=r(g.isOurDisabled),{isFeatureEnabled:E}=r(g.isBillPayDetectInsufficientFundsEnabled),{configValue:C}=u(We.sameDayAchDisablementConfig),x=Ua(C),_=L.getSignedInUser(),D=k((G=>Z(G))),B=k((G=>Me(G,m,h,n))),N=Jt(D?.companyId,{clearParams:B.fetchState==="Completed"}),{isAiCfoAccessEnabled:V,onAskAiCfoClick:W}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:B.fetchState==="Completed"});const O=D.companyId??L.getSignedInUserTenant(c)?.companyId,v=fe(),Y=Gt(v?.loggedInUserRoleMap),M=Ut(v?.loggedInUserRoleMap),$=de(v?.loggedInUserRoleMap),q=wt(D.userRole);if(S.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),S.useEffect((()=>{n!=null&&l(Tt(n))}),[n,l]),_==null)throw Error("Can't access address page without signing in...");const J=k((G=>_a(G.accountState,G.accountListState,"billPayAccountList"))),z={pathname:"../",search:t.search};return B.isDeleted===!0||B.billStage=="paid"||B.fetchState=="Not-Started"?a.jsx(ee,{to:z}):B.deleteStatus.fetchState==="In-Progress"||s?a.jsx(se,{fetchState:B.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:G=>(F=>{n!=null&&B.deleteStatus.fetchState!=="Completed"&&F.trackBillPayEditBill(n,B.isRecurring)})(G)}),a.jsx($i,{initialOpenThreadRequest:N??void 0,location:t,navigate:e,currentTenant:D,billId:n,companyId:O,billDetailsView:B,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:J,isInternationalPaymentShaVsOurEnabled:i,vendor:B.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:I,isRecurringBillsFeatureEnabled:y,hasZeniAccountsAdminAccess:Y,isZeniAccountsUser:M,isBillPayAdmin:$,isSuperAdmin:q,isDetectInsufficientFundsEnabled:E,sameDayAchDisablementConfig:x,isAiCfoAccessEnabled:V,onAskAiCfoClick:W})]})}const St=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Li=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Gi=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",_i=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?pe(t.whatFor.invoiceDate.toString()):_t(),billDueDate:t.whatFor.billDueDate?pe(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?pe(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[R]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(Ka)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Ri.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},y=Mi(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(y).length>0?Wn(y):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:y,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Mi=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=qn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??he.currencyCode,currencySymbol:o.currency?.currencySymbol??he.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??he.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??he.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},Ni=U.div`
|
|
93
|
+
display: flex;
|
|
94
|
+
height: 100vh;
|
|
95
|
+
width: 100%;
|
|
96
|
+
flex: 1 1 auto;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-items: center;
|
|
99
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
100
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
101
|
+
`,Oi=Q((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=Me(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(en({data:i}))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??yt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Xe(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Qa({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??yt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Kn);function Yi(){const e=K(),t=X(),l=Ie(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=ue(),o=L.getSignedInUser(),s=k((h=>Z(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((h=>ye(h,n))),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(g.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Ni,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:y})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
height: 100vh;
|
|
104
|
+
width: 100%;
|
|
105
|
+
flex: 1 1 auto;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
align-items: center;
|
|
108
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
109
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
110
|
+
`,Hi=Q((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(cn(s)),p&&e(dn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(rn(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(st())},onAddressClick:s=>{const i=Xe(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(st())}}}))(Xn);function Zi(){const e=K(),t=X(),l=Ie(),{vendorId:n,billId:c}=te(),r=le(),u=ue(),o=L.getSignedInUser(),s=k((x=>Z(x))),i=H(t.state?.pathnameStackToGoBack),[d,p]=S.useState(!1),m=k((x=>x.vendorViewState.newVendorState.fetchStatus.fetchState)),y=k((x=>n!=null?x.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?y:m;S.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,I]=S.useState(!1);S.useEffect((()=>{b||h==="In-Progress"||(I(!0),r(nn(c,n)))}),[b,h,r]);const E=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",C=k((x=>ye(x,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return E==="billDetail"&&C.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:C.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(zi,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Hi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:E})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},It=U.div`
|
|
111
|
+
display: flex;
|
|
112
|
+
height: 100vh;
|
|
113
|
+
width: 100%;
|
|
114
|
+
flex: 1 1 auto;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
align-items: center;
|
|
117
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
118
|
+
box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
119
|
+
`,Wi=Q((function(e,t){const l=L.getSignedInUser(),n=zt(e,t.billId),c=mn(e),r=Ae(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Mt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:j,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=T(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:n,data:s})),e(_e(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(At({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Nt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ce(t.billId,"retry"))}}}))(ei);function vt(){const e=K(),t=le(),l=X(),{billId:n}=te(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(g.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=L.getSignedInUser(),{isFeatureEnabled:i}=c(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(g.isBillPayCommentingEnabled),m=H(l.state?.pathnameStackToGoBack),{poppedPathname:y}=m,{isFeatureEnabled:h}=c(g.isRecurringBillsFeatureEnabled),b=k((C=>Z(C))),I=k((C=>zt(C,n))),E=I.fetchState??"Not-Started";if(S.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),S.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),S.useEffect((()=>{const C=I.vendor?.name,x=I.vendor?.id,_=I.totalAmount.amount,D=I.recipientTotalAmount.amount,B=I.invoiceNumber;C&&x&&t(pn(C,x,_,D,B,n))}),[]),y==null)return a.jsx(ee,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return E==="In-Progress"?a.jsx(It,{windowSize:o,children:a.jsx(Qn,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:h,isDetectInsufficientFundsEnabled:u})})}const qi=Q((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=ze(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=L.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:j,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(An(i))},saveVendorDetailLocalData:i=>{e(Yt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Cn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(rt(u))},updateSelectedVendorForCreate:i=>{e(Bn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):ui(s,t.billId,u):p=di(s,t.billId,u);const m=T(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?kn(i,"vendor",u):wn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Xe(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(vn({files:i}))},onEditFileName:(i,d)=>{e(In(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(rt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(yn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ci(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(Sn(i,"BillPayVendor"))},onResendOtp:i=>{e(gn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(hn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(bn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}}))(ii),Be=()=>{const e=K(),t=le(),l=ti(),n=X(),{billId:c,vendorId:r}=te(),u=k((b=>Z(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(g.isBillPayLocalCurrencyFeatureEnabled),[i,d]=S.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ye(b,r))),y=k((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?y:p;return S.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):h==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Ke,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=Q((function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:j,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(li),Ki=()=>{const e=oi(),t=K(),l=X(),{tenantEmailDomain:n}=te(),[c,r]=S.useState(!1),u=ue(),o=k((h=>Z(h))),s=o.companyId??L.getSignedInUserTenant(n)?.companyId,i=L.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),y=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(ee,{to:"../../bills/setup"}):p===!1||d!=null&&Ye(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:h=>(b=>b.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:c,handleDrawerToggle:y}),a.jsx(Ji,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{y(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function Po(){const e=k(($=>Z($))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Zi:Yi,{isFeatureEnabled:o}=c(g.isDebitCardFeatureEnabled),s=$t(o,e),i=Lt(e),d=X(),p=e?.userRole!=null&&kt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),y=Vt(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Tn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,I=b&&Gt(t?.loggedInUserRoleMap),{isFeatureEnabled:E}=c(g.isChargeCardFeatureEnabled),C=si(e,E,o)&&!p,x=C&&jn(t?.loggedInUserRoleMap),_=Pn(t?.loggedInUserRoleMap),D=Ut(t?.loggedInUserRoleMap),B=Fn(t?.loggedInUserRoleMap),N=b&&D,V=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&B,W=Rn(t?.loggedInUserRoleMap),O=Vn(t?.loggedInUserRoleMap),v=$n(t?.loggedInUserRoleMap),Y=C&&W,{tenantEmailDomain:M}=te();return a.jsxs(oa,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(f,{path:"setup",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(f,{path:"verification",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(f,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(f,{path:"approval-rules/*",element:m?a.jsx(bi,{}):a.jsx(hi,{showZeniAccountRoute:N,isUserHasBillPayAccess:O,isUserHasReimbursementAccess:v,showTreasuryRoute:V,isTenantBankingOnly:s,showChargeCardRoute:Y,tenantEmailDomain:M??""})}),a.jsx(f,{path:"international-wire",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:y,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(f,{path:"*",element:a.jsx(ji,{})}),(s===!0||i===!0)&&a.jsx(f,{path:"/*",element:a.jsx(Xt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(f,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&Ye(e,t.loggedInUserRoleMap)&&a.jsx(f,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(f,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(f,{path:":billId",element:a.jsx(w,{appContent:a.jsx(Si,{})})}),a.jsx(f,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(f,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(f,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(f,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(f,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(f,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(f,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(f,{path:"*",element:a.jsx(xe,{})})]}):a.jsx(f,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(f,{path:"*",element:a.jsx(xe,{})})]})}export{Po as default};
|