@zeniai/web-app-ui 5.3.51-qa → 5.3.52-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.
Files changed (127) hide show
  1. package/dist/assets/{AccountMappingScreen-B_fgGC93.js → AccountMappingScreen-BFD6zGSo.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-ikXtEKwi.js → ActualMatchingMatchDetailScreen--CUkwe-7.js} +1 -1
  3. package/dist/assets/AddressRoutes-IFU8jeyM.js +1 -0
  4. package/dist/assets/{AddressScreen-CbT6uv6I.js → AddressScreen-C5gOC9K1.js} +2 -2
  5. package/dist/assets/{AiCfoScreen-DfyYoDqG.js → AiCfoScreen-Dk4NZsn4.js} +1 -1
  6. package/dist/assets/{AppDrawer-mu7ycbk8.js → AppDrawer-BioYAA8q.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-CknU7mwh.js → BillPayApprovalRoutes-CbgUcPPn.js} +1 -1
  8. package/dist/assets/BillPayRoutes-BLaPoSH3.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-pHiRAFhL.js → BusinessVerificationPageScreen-_lNpLbtb.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-D361jHJH.js → CardsAiCfoScreen-_v8KOvIs.js} +2 -2
  11. package/dist/assets/{ChargeCardRoutes-CKtFRGHw.js → ChargeCardRoutes-Cm8gRyWo.js} +9 -9
  12. package/dist/assets/{CompanyPassportScreen-B2uwHchn.js → CompanyPassportScreen-LNhKVlPD.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-Co2Gq7ws.js → ConnectionAuthScreen-CvbL5gXS.js} +2 -2
  14. package/dist/assets/CustomerOnboardingAuthScreen-1_BAWSpj.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-7fWlDVF_.js → CustomerOnboardingRoutes-CFt1axWu.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-Bjdlm30G.js → DashboardRoutes-B_RKHDQw.js} +3 -3
  17. package/dist/assets/{DefaultTenantHome-Dfnzea8-.js → DefaultTenantHome-CzERteR_.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-EjxcD88e.js → DomesticWireDetailScreen-DdGRU08t.js} +3 -3
  19. package/dist/assets/{DrawerScreen-BXUZLhOQ.js → DrawerScreen-BkWdrsyD.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-BPBuXfdV.js → EntityDetailRoutes-BJQ1CgrE.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-C3_3tauz.js → ExpenseAutomationRoutes-90qVj0mK.js} +1 -1
  22. package/dist/assets/FeaturePreviewScreen-DmuM1Efe.js +1 -0
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-C0le1wc_.js → HubSpotOAuthCallbackScreen-D5Csp1UO.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-DGF7zUT5.js → InboxNotificationsProvider-Bd8tLMl8.js} +1 -1
  25. package/dist/assets/{InvoicingRoutes-C0ncpiOU.js → InvoicingRoutes-CexYyC5q.js} +1 -1
  26. package/dist/assets/{MagicLinkRoutes-BFAq8G59.js → MagicLinkRoutes-JEaRIrxB.js} +19 -19
  27. package/dist/assets/MagicLinkSignInScreen-DwZW3Erw.js +12 -0
  28. package/dist/assets/{MobileAppDrawer-BR5bPsUA.js → MobileAppDrawer-C-ti4sM2.js} +1 -1
  29. package/dist/assets/NotFoundScreen-3qucmnjW.js +1 -0
  30. package/dist/assets/{NotificationRoutes--RK95rni.js → NotificationRoutes-bEJ4pL_q.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-DFq3gVzH.js → OAuthConsentScreen-CH9GHZTu.js} +1 -1
  32. package/dist/assets/PandLWithForecastRoutes-BuxQksyO.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-DTThbeQW.js → PaymentLinkScreen-Dgt4_0Sf.js} +4 -4
  34. package/dist/assets/PeopleRoutes-B9g6bB_r.js +22 -0
  35. package/dist/assets/PerformanceRoutes-hC8UVG3D.js +1 -0
  36. package/dist/assets/{Preview-CL5JOwkW.js → Preview-Bt5Z89U4.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-CjiaoAEy.js → QBOConnectionScreen-BT2gd9dq.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-B_Sln0sl.js → ReimbursementApprovalRoutes-CoFA16rX.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-Ci4A_vGT.js → ReimbursementApprovalRuleDetailScreen-uAvwHmVJ.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-CYup41Xj.js → ReimbursementRoutes-BnvmE75X.js} +1 -1
  41. package/dist/assets/{ReportsRoutes-DbEpEdcA.js → ReportsRoutes-ByrzWoSX.js} +1 -1
  42. package/dist/assets/RewardsRoutes-BrjKJijg.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-Du3o3smk.js → ScheduleDetailsPrepaidExpensesScreen-CcW917MW.js} +4 -4
  44. package/dist/assets/ScreenRoutes-BgjTH3MD.js +2 -0
  45. package/dist/assets/{SettingsRoutes-D-wxWAud.js → SettingsRoutes-DCgOWsFJ.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-C9dw8W4L.js → SetupPagesScreen-CgVfrQ5w.js} +1 -1
  47. package/dist/assets/SignInScreen-QbBLEpYE.js +1 -0
  48. package/dist/assets/SignOutScreen-Cg98jLSX.js +9 -0
  49. package/dist/assets/{TaskListScreen-pzfHHZL9.js → TaskListScreen-BKRaew41.js} +2 -2
  50. package/dist/assets/{TaskRoutes-C8ixfF_K.js → TaskRoutes-tj9-zwIR.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-BSNaBZbG.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-CxDwuuF_.js → TransactionDetailScreen-DHysjIND.js} +2 -2
  53. package/dist/assets/{TransactionListRoutes-BPYKZEc9.js → TransactionListRoutes-BcKO42ff.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-CiS0ghvk.js → TreasuryRoutes-0_eMw0Wx.js} +1 -1
  55. package/dist/assets/{VendorsRoutes-DWH4y4fQ.js → VendorsRoutes-B3eT8rLn.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-CAHKrI7T.js → WiseConfirmationScreen-DJ2wN1Fx.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-B32R3mCM.js → ZeniAccountRoutes-BNdYEOcI.js} +1 -1
  58. package/dist/assets/{ZeniAccountStatementScreen-CPBp7ImC.js → ZeniAccountStatementScreen-Cua_2c_y.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-3Hm_-9n-.js → accountMappingHelper-DQktkWkn.js} +1 -1
  60. package/dist/assets/{analytics-D_bfwrdA.js → analytics-GZ8dIY_c.js} +1 -1
  61. package/dist/assets/{analyticsHelper-BCS-l0Hm.js → analyticsHelper-DnGDW6mo.js} +1 -1
  62. package/dist/assets/{core-C5ZG3tJS.js → core-DOBELRta.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-ukN1WN7f.js → decodeURIComponentSafe-DjVlhgki.js} +1 -1
  64. package/dist/assets/{dnd-C67Dx0fq.js → dnd-0MaFz9wL.js} +1 -1
  65. package/dist/assets/{empty-D8AdB3zX.js → empty-C3pt8GU3.js} +1 -1
  66. package/dist/assets/{empty-CytNejfB.js → empty-DsXUnWhI.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-DRkRIcLt.js → emptyVideoElement-DObxt-h2.js} +1 -1
  68. package/dist/assets/{epic-Dij6qtSX.js → epic-BqUfEKD1.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-TRaObTJj.js → expenseAutomationHelper-CRKfrxDD.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-C4S7jDsD.js → getLocaleForTenant-U4ff53sp.js} +1 -1
  71. package/dist/assets/{index-BQn16-dp.js → index-1mAhqt2L.js} +1 -1
  72. package/dist/assets/{index-C-mLGw3d.js → index-BmFszw0H.js} +1 -1
  73. package/dist/assets/{index-BJSiEm2J.js → index-C_zqEcVM.js} +1 -1
  74. package/dist/assets/{index-CHAUl04f.js → index-D0or4oV9.js} +13154 -13154
  75. package/dist/assets/{index-GiMM0ckT.js → index-F4l7OCjI.js} +2 -2
  76. package/dist/assets/{index-BkMAt9Jn.js → index-JlXkO7-y.js} +1 -1
  77. package/dist/assets/{index-B7_eMJP9.js → index-px1SxWJw.js} +1 -1
  78. package/dist/assets/{index-BUVBGxEt.js → index-rIJ81ix1.js} +1 -1
  79. package/dist/assets/{lexical-BpFcNSrv.js → lexical-CAgOy6Q-.js} +1 -1
  80. package/dist/assets/{liveblocks-DsNaXx1Y.js → liveblocks-BPL36a6x.js} +1 -1
  81. package/dist/assets/{lottie-x1U_1T_X.js → lottie-38LSfraF.js} +1 -1
  82. package/dist/assets/{mui-BWEZqJM6.js → mui-wO6EIETx.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bx2jKiUl.js → pathToGoBack-BTiQNxwp.js} +1 -1
  84. package/dist/assets/{pdf-Da5t4yqS.js → pdf-B2N0erO1.js} +3 -3
  85. package/dist/assets/{pdf-lib-BkS3YoMW.js → pdf-lib-Ct6vdrHd.js} +1 -1
  86. package/dist/assets/{plaid-B_2YsVA4.js → plaid-C-eBmVPr.js} +1 -1
  87. package/dist/assets/{pusher-BHd7HOLE.js → pusher-Qt-2jBy4.js} +1 -1
  88. package/dist/assets/{react-CXAUR01O.js → react-9dynYr-j.js} +1 -1
  89. package/dist/assets/{react-BQz1q-qh.js → react-BogDsHCA.js} +1 -1
  90. package/dist/assets/{react-aer_dY1C.js → react-ByoUrZyD.js} +1 -1
  91. package/dist/assets/{react-CLpDx285.js → react-D0sfM7Iy.js} +1 -1
  92. package/dist/assets/{react-Cl3JZyLA.js → react-DSWUEYTa.js} +1 -1
  93. package/dist/assets/{react-CluwtJMc.js → react-ofgvrscL.js} +1 -1
  94. package/dist/assets/{recharts-Cbxp2ciV.js → recharts-Sp9X2zHo.js} +1 -1
  95. package/dist/assets/{routePaths-B9I9gBKX.js → routePaths-DTZH71MW.js} +1 -1
  96. package/dist/assets/{sentry-D4qoEIco.js → sentry-_x3Yh1Jc.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Ca96gi6n.js → stripSplatSuffix-bz-VGo3l.js} +1 -1
  98. package/dist/assets/{url-C1Mc-kLe.js → url-DBFa8kl5.js} +1 -1
  99. package/dist/assets/{url-rUBTkYeh.js → url-DW2CK7rX.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-DLemcCW2.js → useActualMatchingMatchDetail-CtxH6NWw.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CJKPWqKp.js → useAiCfoDashboardSuggestedQuestionsChips-BHQEdJfL.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-eAE85_k_.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-D0ho77Y5.js → useChargeCardPusherEvents-CLlJNBdI.js} +1 -1
  104. package/dist/assets/{useDeviceId-D51quroZ.js → useDeviceId-EJu2KjP1.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-BcoabO7K.js → useEmailConnectResultRefresh-DfrDVqu0.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-uHraoUFG.js → useInitialThreadRequest-DYGeNL0J.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-DyYkiipc.js → useTaskManagerAccess-CxAfFVI5.js} +1 -1
  108. package/dist/assets/{utils-DBZ_QSme.js → utils-BU0XThgM.js} +1 -1
  109. package/dist/assets/{withTransactionSidePanel-DRYGp088.js → withTransactionSidePanel-CQ96RPah.js} +4 -4
  110. package/dist/assets/{zeni-epic-state-BcPOXb6_.js → zeni-epic-state-DXFYDM66.js} +3 -3
  111. package/dist/index.html +1 -1
  112. package/package.json +2 -2
  113. package/dist/assets/AddressRoutes-C8S7gDv2.js +0 -1
  114. package/dist/assets/BillPayRoutes-Dab4Lv9I.js +0 -119
  115. package/dist/assets/CustomerOnboardingAuthScreen-Ca7OSsdg.js +0 -1
  116. package/dist/assets/FeaturePreviewScreen-CVSsRSRt.js +0 -1
  117. package/dist/assets/MagicLinkSignInScreen-DJPBAc7a.js +0 -12
  118. package/dist/assets/NotFoundScreen-Bs6jlvSW.js +0 -1
  119. package/dist/assets/PandLWithForecastRoutes-0w_j-_X8.js +0 -1
  120. package/dist/assets/PeopleRoutes-hj0tExCw.js +0 -22
  121. package/dist/assets/PerformanceRoutes-KCu8tZ8L.js +0 -1
  122. package/dist/assets/RewardsRoutes-rrdbBIHj.js +0 -1
  123. package/dist/assets/ScreenRoutes-CwbD03ss.js +0 -2
  124. package/dist/assets/SignInScreen-DLbFHc0Z.js +0 -1
  125. package/dist/assets/SignOutScreen-ChtEJ69Z.js +0 -9
  126. package/dist/assets/TransactionDetailRoutes-Cid-1lkg.js +0 -1
  127. package/dist/assets/useAskAiCfoHostNavButtonProps-CeD5Zw-D.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as L}from"./liveblocks-DsNaXx1Y.js";import{a as o}from"./sentry-D4qoEIco.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-C5ZG3tJS.js";import{aj as Z,c as ee,A as $,z as te,o as G,ak as ne,k as ae,S as ce}from"./index-CHAUl04f.js";import{bn as se,fF as oe,gV as ie,oB as Q,Uz as re,i8 as J,gh as le,os as ue,UA as de,UB as pe,u6 as ge,l$ as me,oq as Ae,om as be,ox as Ie,ia as ye,UC as fe,UD as Se}from"./zeni-epic-state-BcPOXb6_.js";import{n as he}from"./mui-BWEZqJM6.js";import{M as Ee}from"./MobileAppDrawer-BR5bPsUA.js";import{q as R}from"./QBOConnectionScreen-CjiaoAEy.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-3Hm_-9n-.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]="104e107e-4a1b-42a1-b47b-2dd5ddee15b1",a._sentryDebugIdIdentifier="sentry-dbid-104e107e-4a1b-42a1-b47b-2dd5ddee15b1")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ve=he.div`
1
+ import{j as L}from"./liveblocks-BPL36a6x.js";import{a as o}from"./sentry-_x3Yh1Jc.js";import{h as K,g as W,u as X,j as m,s as q,l as Y}from"./core-DOBELRta.js";import{aj as Z,c as ee,A as $,z as te,o as G,ak as ne,k as ae,V as ce}from"./index-D0or4oV9.js";import{bn as se,fF as oe,gV as ie,oB as Q,Uz as re,i8 as J,gh as le,os as ue,UA as de,UB as pe,u6 as ge,l$ as me,oq as Ae,om as be,ox as fe,ia as Ie,UC as ye,UD as Se}from"./zeni-epic-state-DXFYDM66.js";import{n as he}from"./mui-wO6EIETx.js";import{M as Ee}from"./MobileAppDrawer-C-ti4sM2.js";import{q as R}from"./QBOConnectionScreen-BT2gd9dq.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-DQktkWkn.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]="8afc5f6d-8031-4487-ac2e-ca1d6ada7584",a._sentryDebugIdIdentifier="sentry-dbid-8afc5f6d-8031-4487-ac2e-ca1d6ada7584")}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 L}from"./liveblocks-DsNaXx1Y.js";import{a as o}from"./sentry-D4qoEIc
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:k,expenseCategory1099:M}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),j=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),y=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),D=E(e.accountMappingView.bankAccounts1099FilingAccountList,k.selectedOptions),f=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,M),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:I?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:y.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:D.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:f};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(fe())):a(J())},onSaveClick:()=>{a(ye()),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=K(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),k=o.useCallback(((t,n)=>{c(Q(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,H]=g[0]??[];S!=null&&c(Q(s.companyId,S,H,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[I,_]=o.useState(!1),[P,U]=o.useState(!1);o.useEffect((()=>{I===!1&&(c(J()),_(!0))}),[I]);const y=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((()=>{y&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[y,s?.tenantEmailDomain,c]);const D=m((t=>pe(t))),f=t=>{U(t)};return L.jsxs(ve,{children:[L.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:f}),L.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:D,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:k,onSaveCapitalizationAccountThresholds:M,location:i,isSettings:G(i),onClickMenuIcon:()=>f(!0)})]})};export{l as P,_e as U,u as a};
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:k,expenseCategory1099:M}=x,b=h(e.accountMappingView.incomeAccountList,C.selectedOption),j=h(e.accountMappingView.expenseAccountList,F.selectedOption),f=h(e.accountMappingView.billPayAccountList,s.selectedOption),_=h(e.accountMappingView.reimbursementsAccountList,V.selectedOption),P=E(e.accountMappingView.prepaidExpensesAccountList,p.selectedOptions),U=E(e.accountMappingView.fixedAssetsAccountList,T.selectedOptions),I=E(e.accountMappingView.accruedExpensesAccountList,O.selectedOptions),D=E(e.accountMappingView.bankAccounts1099FilingAccountList,k.selectedOptions),y=ze(e.accountMappingView.expenseAccounts1099FilingAccountList,M),t={selectedIncomeAccountId:b?.accountId,selectedExpenseAccountId:j?.accountId,selectedBillPayAccountId:f?.accountId,selectedReimbursementsAccountId:_?.accountId,selectedPrepaidExpensesAccountIds:P.map((n=>n.accountId)),selectedFixedAssetsAccountIds:U.map((n=>n.accountId)),selectedAccruedExpensesAccountIds:I.map((n=>n.accountId)),selectedBankAccounts1099FilingAccountIds:D.map((n=>n.accountId)),selectedExpenseAccounts1099FilingAccountIds:y};a(Se({data:t}))},onBackClick:()=>{G(c)===!1?(i("../../dashboard"),a(ye())):a(J())},onSaveClick:()=>{a(Ie()),A&&ae.track(ce.Event.vendor1099AccountingSettingsSave)},onAccountingClassesToggle:r=>{a(fe(e.currentTenant.companyId,r))},onAccountingProjectsToggle:r=>{const d=sessionStorage.getItem(l);d===u.pending||d===u.ready||a(r?Ae(e.currentTenant.companyId):be(e.currentTenant.companyId))}}}))(ne),_e=()=>{const a=Z(),e=K(),i=W(),c=X(),{useFeatureGate:A,useDynamicConfig:r}=ee(),{isFeatureEnabled:d}=A($.isFiling1099FeatureEnabled),{isFeatureEnabled:z}=A($.isScheduledJEAccruedExpensesFeatureEnabled),{configValue:v,isDynamicConfigLoading:w}=r("transaction_categorization_config"),x=!w&&v?.capitalization_enabled===!0,C=te.getSignedInUser(),F=se(C),s=m((t=>oe(t))),{capitalizableAccounts:V,capitalizableAccountOverrides:p,isCapitalizationThresholdSaving:T,currencySymbol:O}=m((t=>{const n=t.tenantState.currentTenantId,g=n!=null?t.tenantState.tenantsById[n]:void 0,S=ie(t.companyState,s.companyId);return{capitalizableAccounts:g?.capitalizableAccounts??null,capitalizableAccountOverrides:g?.capitalizableAccountOverrides??null,isCapitalizationThresholdSaving:t.companyViewState.passportView?.capitalizationThresholdUpdateStatus?.fetchState==="In-Progress",currencySymbol:S?.company.companyLocaleInfo?.currencySymbol??"$"}}),q),k=o.useCallback(((t,n)=>{c(Q(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,H]=g[0]??[];S!=null&&c(Q(s.companyId,S,H,void 0,Object.keys(n).length>0?n:null))}),[c,s.companyId,p]),b=m((t=>re(t.accountState)),q),j=o.useMemo((()=>{const t={};for(const n of b)n.accountId!=null&&n.accountName!=null&&(t[n.accountId]=n.accountName);return t}),[b]),[f,_]=o.useState(!1),[P,U]=o.useState(!1);o.useEffect((()=>{f===!1&&(c(J()),_(!0))}),[f]);const I=m((t=>t.companyViewState.passportView?.needsQboProjectsReconnect===!0));o.useEffect((()=>{sessionStorage.getItem(l)===u.pending&&(sessionStorage.removeItem(l),c(le({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})))}),[c]),o.useEffect((()=>{sessionStorage.getItem(l)===u.ready&&s?.companyId!=null&&(sessionStorage.removeItem(l),c(ue(s.companyId)))}),[s?.companyId,c]),o.useEffect((()=>{I&&s?.tenantEmailDomain!=null&&(sessionStorage.setItem(l,u.pending),c(de()),R.init("/connection/auth",s.tenantEmailDomain),R.handleClick())}),[I,s?.tenantEmailDomain,c]);const D=m((t=>pe(t))),y=t=>{U(t)};return L.jsxs(ve,{children:[L.jsx(Ee,{isAppContentDrawerOpen:P,handleDrawerToggle:y}),L.jsx(we,{currentTenant:s,navigate:e,meetingUrl:a("account_mapping"),accountMappingView:D,isFiling1099FeatureEnabled:d&&F,isAccruedExpensesFeatureEnabled:z,isCapitalizationFeatureEnabled:x,capitalizableAccounts:V,accountNamesById:j,capitalizableAccountOverrides:p,currencySymbol:O,isCapitalizationThresholdSaving:T,onSaveCapitalizationAccountThreshold:k,onSaveCapitalizationAccountThresholds:M,location:i,isSettings:G(i),onClickMenuIcon:()=>y(!0)})]})};export{l as P,_e as U,u as a};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-DsNaXx1Y.js";import{a as k}from"./sentry-D4qoEIco.js";import{a5 as I,dQ as g}from"./index-CHAUl04f.js";import"./mui-BWEZqJM6.js";import{u as y}from"./useActualMatchingMatchDetail-DLemcCW2.js";import b from"./NotFoundScreen-Bs6jlvSW.js";import{i as v,h as U,g as w}from"./core-C5ZG3tJS.js";import"./zeni-epic-state-BcPOXb6_.js";import"./recharts-Cbxp2ciV.js";import"./analytics-D_bfwrdA.js";import"./plaid-B_2YsVA4.js";import"./dnd-C67Dx0fq.js";import"./stripe-cKAAJElX.js";import"./lottie-x1U_1T_X.js";import"./lexical-BpFcNSrv.js";import"./pdf-Da5t4yqS.js";import"./utils-DBZ_QSme.js";import"./stripSplatSuffix-Ca96gi6n.js";import"./decodeURIComponentSafe-ukN1WN7f.js";import"./routePaths-B9I9gBKX.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};
1
+ import{j as s}from"./liveblocks-BPL36a6x.js";import{a as k}from"./sentry-_x3Yh1Jc.js";import{a5 as I,dQ as g}from"./index-D0or4oV9.js";import"./mui-wO6EIETx.js";import{u as y}from"./useActualMatchingMatchDetail-CtxH6NWw.js";import b from"./NotFoundScreen-3qucmnjW.js";import{i as v,h as U,g as w}from"./core-DOBELRta.js";import"./zeni-epic-state-DXFYDM66.js";import"./recharts-Sp9X2zHo.js";import"./analytics-GZ8dIY_c.js";import"./plaid-C-eBmVPr.js";import"./dnd-0MaFz9wL.js";import"./stripe-cKAAJElX.js";import"./lottie-38LSfraF.js";import"./lexical-CAgOy6Q-.js";import"./pdf-B2N0erO1.js";import"./utils-BU0XThgM.js";import"./stripSplatSuffix-bz-VGo3l.js";import"./decodeURIComponentSafe-DjVlhgki.js";import"./routePaths-DTZH71MW.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-BPL36a6x.js";import{A as i}from"./AddressScreen-C5gOC9K1.js";import s from"./NotFoundScreen-3qucmnjW.js";import"./sentry-_x3Yh1Jc.js";import{n as d,o as r}from"./core-DOBELRta.js";import"./zeni-epic-state-DXFYDM66.js";import"./recharts-Sp9X2zHo.js";import"./index-D0or4oV9.js";import"./mui-wO6EIETx.js";import"./analytics-GZ8dIY_c.js";import"./plaid-C-eBmVPr.js";import"./dnd-0MaFz9wL.js";import"./stripe-cKAAJElX.js";import"./lottie-38LSfraF.js";import"./lexical-CAgOy6Q-.js";import"./pdf-B2N0erO1.js";import"./utils-BU0XThgM.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};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-DsNaXx1Y.js";import{a as h}from"./sentry-D4qoEIco.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-C5ZG3tJS.js";import{a2 as $,E as D,z as L,Q as V,a8 as K,a9 as F,k as _,S,a4 as z,_ as b,a5 as N}from"./index-CHAUl04f.js";import{Ve as C,ip as R,fF as U,Vf as G,c8 as H,Vg as O,mH as q}from"./zeni-epic-state-BcPOXb6_.js";import{n as Q}from"./mui-BWEZqJM6.js";import J from"./NotFoundScreen-Bs6jlvSW.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]="f3357cda-2948-4726-895b-f419049a388b",e._sentryDebugIdIdentifier="sentry-dbid-f3357cda-2948-4726-895b-f419049a388b")}catch{}})();const W=Q.div`
1
+ import{j as r}from"./liveblocks-BPL36a6x.js";import{a as h}from"./sentry-_x3Yh1Jc.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-DOBELRta.js";import{a2 as V,E as $,z as D,N as L,a8 as K,a9 as F,k as C,V as S,a4 as N,Z as b,a5 as z}from"./index-D0or4oV9.js";import{Ve as _,ip as R,fF as U,Vf as G,c8 as H,Vg as O,mH as q}from"./zeni-epic-state-DXFYDM66.js";import{n as Z}from"./mui-wO6EIETx.js";import J from"./NotFoundScreen-3qucmnjW.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]="97402e44-e138-4347-8340-38ba83c2d604",e._sentryDebugIdIdentifier="sentry-dbid-97402e44-e138-4347-8340-38ba83c2d604")}catch{}})();const Q=Z.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as r}from"./liveblocks-DsNaXx1Y.js";import{a as h}from"./sentry-D4qoEIc
6
6
  flex-direction: column;
7
7
  align-items: center;
8
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??v();const u=n?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}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(),g=$(),I=D(),k=L.getSignedInUser(),[f,w]=h.useState(t==null),p=B((m=>t!=null?C(m,t).fetchState:"Not-Started")),x=V();if(k==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((()=>{f||t==null||(w(!0),n(R(t,!1)))}),[f,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)?!f&&p==="Not-Started"||f&&p==="In-Progress"?r.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(F,{analytics:_,onLoad:A}),r.jsx(W,{windowSize:g,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(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,Y as t};
9
+ `,W=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=_(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=z(n?.pathnameStackToGoBack);let t=d.poppedPathname??v();const u=n?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}o(t,{state:{pathnameStackToGoBack:d.newStack}})}};return{onSubmitHandler:a=>{const n=X(a);e(q({addressType:c,addressToCreate:n})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(N);function 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(),g=V(),I=$(),k=D.getSignedInUser(),[p,w]=h.useState(t==null),f=B((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=L();if(k==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((()=>{p||t==null||(w(!0),n(R(t,!1)))}),[p,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)?!p&&f==="Not-Started"||p&&f==="In-Progress"?r.jsx(K,{fetchState:f,style:{backgroundColor:I.colors.grey5}}):t!=null&&f==="Error"?(a(`${v(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(F,{analytics:C,onLoad:A}),r.jsx(Q,{windowSize:g,children:r.jsx(W,{location:d,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):r.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},X=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,X as t};
@@ -1,4 +1,4 @@
1
- import{j as S}from"./liveblocks-DsNaXx1Y.js";import{a}from"./sentry-D4qoEIco.js";import{u as Rt,h as Tt,i as jt,g as Ot,j as b,l as At}from"./core-C5ZG3tJS.js";import{a as Qt,h as Dt,e7 as Lt,z as Ut,a2 as _t,e8 as Bt,e9 as Ft,ea as Mt,bp as Ae,eb as Ne,ec as Vt,bo as Ge,a5 as me,a9 as re,k as B,ed as le,ee as $t,ef as Nt,av as Gt,S as qt,w as Ht,eg as zt,eh as Wt,aw as Yt,ei as Jt,ej as Kt,ek as Xt,el as Zt,p as es,bl as Qe,em as ts}from"./index-CHAUl04f.js";import{fE as _,gt as y,TY as ss,a24 as as,a25 as ns,jM as os,a26 as is,jJ as rs,a27 as de,jD as ue,jT as z,jl as Se,jB as De,jz as ls,jQ as ds,ju as qe,U5 as Le,gv as F,gK as us,U4 as cs,TR as Ue,fF as ms,j3 as Ss,a28 as hs,g8 as ps,jh as fs,jd as gs,fG as ce,gf as Cs,a29 as Is,a2a as ks,a2b as bs,gu as vs,go as _e,k4 as Be,gq as Fe,gw as Es,a2c as Me,jV as Ps,ja as ws,jo as ys,jR as Ve,jr as xs,gx as Rs,gy as Ts,gz as js,gA as Os}from"./zeni-epic-state-BcPOXb6_.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-BWEZqJM6.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-CJKPWqKp.js";import{p as Us}from"./pathToGoBack-Bx2jKiUl.js";import{j as _s}from"./routePaths-B9I9gBKX.js";import"./recharts-Cbxp2ciV.js";import"./analytics-D_bfwrdA.js";import"./plaid-B_2YsVA4.js";import"./dnd-C67Dx0fq.js";import"./stripe-cKAAJElX.js";import"./lottie-x1U_1T_X.js";import"./lexical-BpFcNSrv.js";import"./pdf-Da5t4yqS.js";import"./utils-DBZ_QSme.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]="87ced464-9214-45be-b1c1-7d58175bd65c",s._sentryDebugIdIdentifier="sentry-dbid-87ced464-9214-45be-b1c1-7d58175bd65c")}catch{}})();const He="chat-response-generated";function Bs(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=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Fs=At((function(s,r){const t=_(s),l=r.isSubmitting,u=t.uiState?.currentChatSessionId,i=u!=null?Cs(s.aiCfoState,u):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),T=bs(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:`${Yt}/tableDownload`,exportDownloadEndPoint:Xt(),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:y(s).skills,skillSaveState:Bs(s,T),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:T.fetchState==="In-Progress",skillSaveError:T.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Jt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:u,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:T,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Rs(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:Y}=Ge(p,v);E!=="answer"?B.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(Y,W),c.metadata.message_id??null):B.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Ts(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:u}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,u,E,c,void 0,v)},onFetchSkills:()=>{s(qe())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Ve({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Ve({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(F()),s(_e()),Qe(s,o,"user_input",void 0,p,u,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Fe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Fe(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(F()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:T,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Rt(),l=Tt(),{session_id:u}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),T=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[Y,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Ye=a.useCallback((()=>{v(void 0),x(!1)}),[]),Je=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?ue({scheduleId:j}):de())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??u,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(ue({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(ue({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(ds({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),J=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(qe()),t(Le())}),[t]),ot=a.useCallback((()=>{t(F())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:dt}=Lt();a.useEffect((()=>{t(us())}),[t]);const g=b((e=>_(e))),R=Ut.getSignedInUser();a.useEffect((()=>u==="routines"?(t(F()),void t(cs())):u==="skills"?(t(de()),t(Ue()),void t(Le())):(U==null&&t(de()),t(Ue()),void t(F()))),[t,U,f,u]);const ut=_t(),O=Gt(ut),k=b((e=>ms(e))),d=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Bt(I),skillName:I.isAdHoc===!0?void 0:J.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,J]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Ft({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:d,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),V=i.state,$=V?.aiCfoInitialQuestion,ke=!!V?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&$!=null&&$!==""){const e=i.state;se($),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[$,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??V?.aiCfoRef,ie=ve.get("emailRefId")??V?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||d!=null||R==null||(t(Ss("controller",R.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,d,t,R]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&d!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,d,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=Vt(d),G=g.fetchState,q=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=d!=null?g.fetchChatSessionHistoryByChatSessionId?.[d]?.fetchState??"Not-Started":"Not-Started",xe=d==null||(g.uiState.chatHistoryNextPageToken[d]?.hasMore??!0),Re=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Re,d),Et=vt.length===0;a.useEffect((()=>{w||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Te=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=u!==Te.current,h=d!==je.current;Te.current=u,je.current=d,u!==d&&(!e||u==null||_s(u)?h&&d!=null&&l(`../ai-cfo/${d}`,{state:{...i.state}}):t(ps({sessionId:u,agentId:"controller"})))}),[d,u]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[we]);a.useEffect((()=>{G!=="In-Progress"&&q&&t(fs())}),[G,q,t]),a.useEffect((()=>{d!=null&&ye!=="In-Progress"&&xe&&R!=null&&(u===d||G==="Completed"&&!q)&&t(gs(d,R.userId))}),[ye,G,xe,q,d,R,u,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(R==null||u==null)throw Error("Can't access AI Controller page without signing in...");const yt=d!=null&&g.responseStateByChatSessionId?.[d]?.answer?.fetchState==="In-Progress";if(!w&&O)return S.jsxs(Vs,{children:[S.jsx(re,{analytics:B,onLoad:Oe}),te.drawerElement,S.jsx($s,{children:S.jsx($e,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:B,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:B,onLoad:e=>e.trackPageLoaded(qt.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx(Fs,{...wt,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:Re,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:R.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:u,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:dt,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:T,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:J,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:Y,onRoutineOpenDetail:X,onRoutineEditorCancel:Ye,onRoutineLoadSkillInstructions:nt,onRoutineSave:Je,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx($e,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx($t,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},$e=M(Qs)`
1
+ import{j as S}from"./liveblocks-BPL36a6x.js";import{a}from"./sentry-_x3Yh1Jc.js";import{u as Rt,h as Tt,i as jt,g as Ot,j as b,l as At}from"./core-DOBELRta.js";import{a as Qt,H as Dt,e7 as Lt,z as Ut,a2 as _t,e8 as Bt,e9 as Ft,ea as Mt,bp as Ae,eb as Ne,ec as Vt,bo as Ge,a5 as me,a9 as re,k as B,ed as le,ee as $t,ef as Nt,av as Gt,V as Ht,w as qt,eg as zt,eh as Wt,aw as Yt,ei as Jt,ej as Kt,ek as Xt,el as Zt,p as es,bl as Qe,em as ts}from"./index-D0or4oV9.js";import{fE as _,gt as y,TY as ss,a24 as as,a25 as ns,jM as os,a26 as is,jJ as rs,a27 as de,jD as ue,jT as z,jl as Se,jB as De,jz as ls,jQ as ds,ju as He,U5 as Le,gv as F,gK as us,U4 as cs,TR as Ue,fF as ms,j3 as Ss,a28 as hs,g8 as ps,jh as fs,jd as gs,fG as ce,gf as Cs,a29 as Is,a2a as ks,a2b as bs,gu as vs,go as _e,k4 as Be,gq as Fe,gw as Es,a2c as Me,jV as Ps,ja as ws,jo as ys,jR as Ve,jr as xs,gx as Rs,gy as Ts,gz as js,gA as Os}from"./zeni-epic-state-DXFYDM66.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-wO6EIETx.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-BHQEdJfL.js";import{p as Us}from"./pathToGoBack-BTiQNxwp.js";import{j as _s}from"./routePaths-DTZH71MW.js";import"./recharts-Sp9X2zHo.js";import"./analytics-GZ8dIY_c.js";import"./plaid-C-eBmVPr.js";import"./dnd-0MaFz9wL.js";import"./stripe-cKAAJElX.js";import"./lottie-38LSfraF.js";import"./lexical-CAgOy6Q-.js";import"./pdf-B2N0erO1.js";import"./utils-BU0XThgM.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]="8e40b9a4-bc42-4493-9122-e742c44cedfc",s._sentryDebugIdIdentifier="sentry-dbid-8e40b9a4-bc42-4493-9122-e742c44cedfc")}catch{}})();const qe="chat-response-generated";function Bs(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=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Fs=At((function(s,r){const t=_(s),l=r.isSubmitting,u=t.uiState?.currentChatSessionId,i=u!=null?Cs(s.aiCfoState,u):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),T=bs(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:`${Yt}/tableDownload`,exportDownloadEndPoint:Xt(),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:y(s).skills,skillSaveState:Bs(s,T),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:T.fetchState==="In-Progress",skillSaveError:T.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Jt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:u,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:T,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===qe&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Rs(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:Y}=Ge(p,v);E!=="answer"?B.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(Y,W),c.metadata.message_id??null):B.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Ts(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:u}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,u,E,c,void 0,v)},onFetchSkills:()=>{s(He())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Ve({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Ve({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(F()),s(_e()),Qe(s,o,"user_input",void 0,p,u,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Fe(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Fe(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Be(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(F()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:T,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(qt(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Rt(),l=Tt(),{session_id:u}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),T=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[Y,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Ye=a.useCallback((()=>{v(void 0),x(!1)}),[]),Je=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?ue({scheduleId:j}):de())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??u,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(ue({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(ue({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(ds({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),J=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(He()),t(Le())}),[t]),ot=a.useCallback((()=>{t(F())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:dt}=Lt();a.useEffect((()=>{t(us())}),[t]);const g=b((e=>_(e))),R=Ut.getSignedInUser();a.useEffect((()=>u==="routines"?(t(F()),void t(cs())):u==="skills"?(t(de()),t(Ue()),void t(Le())):(U==null&&t(de()),t(Ue()),void t(F()))),[t,U,f,u]);const ut=_t(),O=Gt(ut),k=b((e=>ms(e))),d=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const q=e.sessionId??C.sessionId;q!=null&&D&&l(`/${P}/ai-cfo/${q}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Bt(I),skillName:I.isAdHoc===!0?void 0:J.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,J]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Ft({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:d,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),V=i.state,$=V?.aiCfoInitialQuestion,ke=!!V?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&$!=null&&$!==""){const e=i.state;se($),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[$,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??V?.aiCfoRef,ie=ve.get("emailRefId")??V?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||d!=null||R==null||(t(Ss("controller",R.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,d,t,R]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&d!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,d,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=Vt(d),G=g.fetchState,H=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=d!=null?g.fetchChatSessionHistoryByChatSessionId?.[d]?.fetchState??"Not-Started":"Not-Started",xe=d==null||(g.uiState.chatHistoryNextPageToken[d]?.hasMore??!0),Re=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Re,d),Et=vt.length===0;a.useEffect((()=>{w||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Te=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=u!==Te.current,h=d!==je.current;Te.current=u,je.current=d,u!==d&&(!e||u==null||_s(u)?h&&d!=null&&l(`../ai-cfo/${d}`,{state:{...i.state}}):t(ps({sessionId:u,agentId:"controller"})))}),[d,u]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${qe}`)),eventCallback:(e,h,q)=>q.onEventReceived(e,h)})),[we]);a.useEffect((()=>{G!=="In-Progress"&&H&&t(fs())}),[G,H,t]),a.useEffect((()=>{d!=null&&ye!=="In-Progress"&&xe&&R!=null&&(u===d||G==="Completed"&&!H)&&t(gs(d,R.userId))}),[ye,G,xe,H,d,R,u,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(R==null||u==null)throw Error("Can't access AI Controller page without signing in...");const yt=d!=null&&g.responseStateByChatSessionId?.[d]?.answer?.fetchState==="In-Progress";if(!w&&O)return S.jsxs(Vs,{children:[S.jsx(re,{analytics:B,onLoad:Oe}),te.drawerElement,S.jsx($s,{children:S.jsx($e,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:B,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:B,onLoad:e=>e.trackPageLoaded(Ht.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx(Fs,{...wt,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:Re,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:R.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:u,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:dt,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:T,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:J,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:Y,onRoutineOpenDetail:X,onRoutineEditorCancel:Ye,onRoutineLoadSkillInstructions:nt,onRoutineSave:Je,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx($e,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx($t,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},$e=M(Qs)`
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-DsNaXx1Y.js";import{a as o,R as va}from"./sentry-D4qoEIco.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-C5ZG3tJS.js";import{fF as Fe,TP as Ba,TQ as Re,g9 as xa,gv as X,TR as Q,ju as Ie,jB as Te,TS as Aa,TT as _a,gO as Da,p$ as Ma,TU as Fa,TV as ve,gm as Ra,TW as $,fE as Za,gt as Ga,TX as Pa,TY as Va,TZ as ja,T_ as ye,T$ as Ha,U0 as $e,U1 as La,E5 as Na,gn as Ua,h1 as Oa,cV as za,U2 as Ya,U3 as qa,qC as Wa,g8 as Xa,j6 as Qa,U4 as Ja,U5 as Ka,wq as et,go as at}from"./zeni-epic-state-BcPOXb6_.js";import{w as tt,i as nt,a as ot,M as st,E as rt,c as it,A as m,d as lt,u as dt,e as ct,X as ut,f as mt,g as Ct,N as pt,h as ht,j as ft,z as gt,k as P,p,m as Be,l as bt,Y as St,n as xe,o as kt,W as Ae,q as Et,R as wt,r as K,s as J,v as It,x as Tt,y as vt,L as yt,B as $t,C as Bt,D as ee,F as xt,U as At}from"./index-CHAUl04f.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-BWEZqJM6.js";import{u as Rt}from"./InboxNotificationsProvider-DGF7zUT5.js";import{u as Zt}from"./useTaskManagerAccess-DyYkiipc.js";import{u as Gt}from"./expenseAutomationHelper-TRaObTJj.js";import"./recharts-Cbxp2ciV.js";import"./analytics-D_bfwrdA.js";import"./plaid-B_2YsVA4.js";import"./dnd-C67Dx0fq.js";import"./stripe-cKAAJElX.js";import"./lottie-x1U_1T_X.js";import"./lexical-BpFcNSrv.js";import"./pdf-Da5t4yqS.js";import"./utils-DBZ_QSme.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]="047f2218-2b13-4311-af13-07342bdab0fe",a._sentryDebugIdIdentifier="sentry-dbid-047f2218-2b13-4311-af13-07342bdab0fe")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Pt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,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]=va.useState(!1),[S,Ze]=o.useState(!1),t=ya(),s=$a(),ae=xa(),te=st(),n=Me(),[Ge,Pe]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(X()),n(Q()))}),[n,ne]),o.useEffect((()=>{n(X()),n(Q())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(Te()))}),[n,w,i.tenantId,E]);const[L,He]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ne}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Ne,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=()=>{Pe(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const N=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:I}=f,Ye=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&&N.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,N.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const qe=Ye||g,U=r((e=>e.tenantState)),We=r((e=>U.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Xe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=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=>Za(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Pa(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),[T,z]=o.useState(void 0),Y=O.uiState.currentChatSessionId,F=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,me=ft(F),{inboxNotifications:q,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Rt(),R=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(T!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:T})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:T})),z(void 0)))}),[n,t.state,s,F,T,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||R.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,R.fetchState,n]),o.useEffect((()=>{if(L!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:L},"comments")))}}),[L,R.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Xe===!1&&v.push("accounts_payable_aging"),Qe===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>La(e,v).fetchState)),ge=r((e=>Na(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(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),y=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&&P.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(ve(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:U.currentTenantId??"",tenants:U.fetchState==="Completed"?We:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:N.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:Le,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!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(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&P.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Te()),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(Ka()),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(X()),n(Q()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",Y??null,null),!H)return void J({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const Z=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:Z,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||P.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const Z=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${Z.month}-${Z.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const Ta=Tt(e.type);vt(e.type)?(Y!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ta}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),Y===e&&z(e)},handleLogOutClick:()=>{y(!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:Ze,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Xa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Je,thanksGivingAnimationEnabled:Ke,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:()=>y(!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(Pt,{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:()=>y(!1),PaperProps:{sx:{width:K,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:K,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(Re({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-BPL36a6x.js";import{a as o,R as va}from"./sentry-_x3Yh1Jc.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-DOBELRta.js";import{fF as Fe,TP as Ba,TQ as Re,g9 as xa,gv as W,TR as J,ju as Ie,jB as Te,TS as Aa,TT as _a,gO as Da,p$ as Ma,TU as Fa,TV as ve,gm as Ra,TW as $,fE as Za,gt as Ga,TX as Pa,TY as Va,TZ as ja,T_ as ye,T$ as Ha,U0 as $e,U1 as La,E5 as Na,gn as Ua,h1 as Oa,cV as za,U2 as qa,U3 as Ya,qC as Qa,g8 as Wa,j6 as Ja,U4 as Xa,U5 as Ka,wq as et,go as at}from"./zeni-epic-state-DXFYDM66.js";import{w as tt,i as nt,a as ot,R as st,E as rt,c as it,A as m,d as lt,u as dt,e as ct,f as ut,g as mt,h as Ct,_ as pt,H as ht,j as ft,z as gt,k as P,p,m as Be,l as bt,q as St,n as xe,o as kt,Q as Ae,r as Et,O as wt,s as K,v as X,x as It,y as Tt,B as vt,L as yt,C as $t,D as Bt,F as ee,I as xt,J as At}from"./index-D0or4oV9.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-wO6EIETx.js";import{u as Rt}from"./InboxNotificationsProvider-Bd8tLMl8.js";import{u as Zt}from"./useTaskManagerAccess-CxAfFVI5.js";import{u as Gt}from"./expenseAutomationHelper-CRKfrxDD.js";import"./recharts-Sp9X2zHo.js";import"./analytics-GZ8dIY_c.js";import"./plaid-C-eBmVPr.js";import"./dnd-0MaFz9wL.js";import"./stripe-cKAAJElX.js";import"./lottie-38LSfraF.js";import"./lexical-CAgOy6Q-.js";import"./pdf-B2N0erO1.js";import"./utils-BU0XThgM.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]="d90e326b-bdc2-4a55-8a25-f3f86e7dc5ba",a._sentryDebugIdIdentifier="sentry-dbid-d90e326b-bdc2-4a55-8a25-f3f86e7dc5ba")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Pt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:K,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]=va.useState(!1),[S,Ze]=o.useState(!1),t=ya(),s=$a(),ae=xa(),te=st(),n=Me(),[Ge,Pe]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(W()),n(J()))}),[n,ne]),o.useEffect((()=>{n(W()),n(J())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Ie()),n(Te()))}),[n,w,i.tenantId,E]);const[L,He]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ne}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Ne,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=()=>{Pe(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const N=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&&N.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,N.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const Ye=qe||g,U=r((e=>e.tenantState)),Qe=r((e=>U.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:We}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Je}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Ke}=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=>Za(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Pa(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),[T,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=T!=null?O.deleteChatSessionStateByChatSessionId[T]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Rt(),R=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(T!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:T})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:T})),z(void 0)))}),[n,t.state,s,F,T,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||R.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,R.fetchState,n]),o.useEffect((()=>{if(L!=null){const{fetchState:e}=R;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Re({unreadCount:L},"comments")))}}),[L,R.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];We===!1&&v.push("accounts_payable_aging"),Je===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>La(e,v).fetchState)),ge=r((e=>Na(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(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),y=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&&P.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(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Qa({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,I.monthEndCloseChecks?.auditSummary,I.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:U.currentTenantId??"",tenants:U.fetchState==="Completed"?Qe:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:N.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:Le,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!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(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&P.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Ie()),n(Ka()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(W()),n(J()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&b(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!H)return void X({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const Z=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:Z,referrer:"Sidebar"}})}const x=p(t.state?.pathnameStackToGoBack,t.pathname),Q=e.type,we=At(Q)&&Q!=="command_center";if(Q!=="command_center"&&!we||h[i.tenantId]==null||P.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const Z=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${Z.month}-${Z.year}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})}const Ta=Tt(e.type);vt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:x.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ta}`,{state:{pathnameStackToGoBack:x,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),q===e&&z(e)},handleLogOutClick:()=>{y(!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:Ze,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Xe,thanksGivingAnimationEnabled:Ke,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:()=>y(!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(Pt,{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:()=>y(!1),PaperProps:{sx:{width:K,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ia?null:d.jsx(De,{PaperProps:{sx:{width:K,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(Re({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-DsNaXx1Y.js";import{a as d}from"./sentry-D4qoEIco.js";import{h as U,g as B,u as j,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-C5ZG3tJS.js";import{fF as P,YQ as w,Yx as R,HB as E,Hv as q,Hz as A,Ho as z,Yz as Y,Hs as ae,HD as oe,Hr as K,HG as G,HC as C}from"./zeni-epic-state-BcPOXb6_.js";import{z as T,w as J,bZ as pe,o as O,bT as Q,b_ as le,E as Z,a8 as M,b$ as se,c0 as ne}from"./index-CHAUl04f.js";import"./mui-BWEZqJM6.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-Ci4A_vGT.js";import ie from"./NotFoundScreen-Bs6jlvSW.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]="d85a50e5-e217-4122-9b22-bbf9146eab3b",e._sentryDebugIdIdentifier="sentry-dbid-d85a50e5-e217-4122-9b22-bbf9146eab3b")}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(z(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=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),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(z(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}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),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=j(),t=B(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=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}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(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-BPL36a6x.js";import{a as d}from"./sentry-_x3Yh1Jc.js";import{h as U,g as B,u as j,j as y,N as F,l as V,i as W,n as te,o as x}from"./core-DOBELRta.js";import{fF as P,YQ as w,Yx as R,HB as E,Hv as q,Hz as A,Ho as z,Yz as Y,Hs as ae,HD as oe,Hr as K,HG as G,HC as C}from"./zeni-epic-state-DXFYDM66.js";import{z as T,w as J,bZ as pe,o as O,bT as Q,b_ as le,E as Z,a8 as M,b$ as se,c0 as ne}from"./index-D0or4oV9.js";import"./mui-wO6EIETx.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-uAvwHmVJ.js";import ie from"./NotFoundScreen-3qucmnjW.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]="d85a50e5-e217-4122-9b22-bbf9146eab3b",e._sentryDebugIdIdentifier="sentry-dbid-d85a50e5-e217-4122-9b22-bbf9146eab3b")}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(z(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=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),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(z(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}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=B(),o=j(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),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=j(),t=B(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(K(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=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}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=j(),t=B(),{approvalRuleId:o}=W(),a=T.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(K(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(M,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(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-BPL36a6x.js";import{h as K,u as le,g as Q,i as te,j as k,N as ee,l as X,q as na,n as ia,o as y}from"./core-DOBELRta.js";import{fF as Z,Y7 as _e,bq as kt,S8 as oa,bo as wt,bJ as de,Y8 as Bt,GV as Ct,I6 as Ve,Hs as la,bn as Ae,Y9 as sa,Ya as ra,c8 as ca,Yb as da,l$ as xt,Yc as At,Yd as Et,IH as Ue,H8 as Ce,Ye as ua,GJ as at,Yf as pa,Mw as ma,GN as ba,GT as Dt,Yg as Se,Yh as Me,I7 as Ne,Yi as ha,Yj as ga,Ia as Oe,Yk as Sa,In as ya,Yl as Tt,HT as nt,HY as fa,Ym as Ia,Yn as ce,Yo as jt,Yp as Pt,Yq as Ft,gV as va,Hd as $e,cG as Rt,Yr as ka,gh as wa,Ys as Ba,Yt as Ca,d_ as Vt,dZ as $t,Yu as Ye,Yv as xa,Yw as Aa,WI as ze,Yx as Ea,WJ as ie,WK as He,Yy as Da,Yz as Ta,YA as ja,H_ as it,HX as Pa,YB as Fa,YC as Ra,YD as Va,HJ as $a,YE as La,YF as Ga,cu as Lt,da as Gt,ma as _a,bO as Ua,br as _t,bP as Ut,FZ as Ma,YG as Na,Mj as Oa,Mp as Ya,C9 as za,I8 as Ha,IO as Za,mn as ge,YH as Wa,YI as Mt,mR as qa,mh as Nt,mC as Ot,mB as ot,bE as pe,bN as Ja,YJ as Ka,YK as ye,kN as Qa,YL as lt,YM as Xa,kR as en,la as tn,J0 as an,YN as nn,mK as on,IS as ln,YO as st,IW as sn,I$ as rn,IZ as cn,IQ as dn,YP as Yt,H2 as un,YQ as pn,YR as mn,gG as bn,gF as hn,gE as gn,mq as Sn,mI as rt,mT as yn,uT as fn,mz as In,IU as vn,kX as kn,mY as wn,YS as Bn,kP as Cn,uK as xn,YT as An,HP as En,bK as Dn,bt as Tn,U7 as jn,dd as Pn,dc as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-DXFYDM66.js";import{E as ue,z as L,N as fe,at as Ze,c as oe,A as g,bj as We,a8 as se,I as A,a9 as Ee,k as j,bv as $n,a5 as H,aw as qe,p as T,a2 as Ie,bw as ct,bx as dt,by as Ln,aA as Gn,ag as _n,aT as Un,ac as zt,G as De,ah as Je,bz as Mn,af as Ht,bA as Nn,ar as On,V as Zt,w as Yn,bB as zn,bC as Hn,bD as Zn,bE as Wn,bF as qn,bG as Jn,bH as Kn,bI as Qn,bJ as Xn,R as ei,bK as ti,bs as ai,bL as ni,aj as ii,bM as oi,h as li}from"./index-D0or4oV9.js";import{n as _,S as si}from"./mui-wO6EIETx.js";import{A as ut}from"./AddressScreen-C5gOC9K1.js";import{g as ne,a as Te,i as Wt,V as Ke,b as Qe,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-DdGRU08t.js";import{a as f}from"./sentry-_x3Yh1Jc.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-eAE85_k_.js";import{u as qt}from"./useInitialThreadRequest-DYGeNL0J.js";import{u as ui}from"./BusinessVerificationPageScreen-_lNpLbtb.js";import xe from"./NotFoundScreen-3qucmnjW.js";import{D as pi}from"./DrawerScreen-BkWdrsyD.js";import{M as Jt}from"./MobileAppDrawer-C-ti4sM2.js";import{F as Kt}from"./FeaturePreviewScreen-DmuM1Efe.js";import{S as je}from"./SetupPagesScreen-CgVfrQ5w.js";import{B as mi}from"./BillPayApprovalRoutes-CbgUcPPn.js";import{F as bi}from"./ScreenRoutes-BgjTH3MD.js";import"./recharts-Sp9X2zHo.js";import"./analytics-GZ8dIY_c.js";import"./plaid-C-eBmVPr.js";import"./dnd-0MaFz9wL.js";import"./stripe-cKAAJElX.js";import"./lottie-38LSfraF.js";import"./lexical-CAgOy6Q-.js";import"./pdf-B2N0erO1.js";import"./utils-BU0XThgM.js";import"./routePaths-DTZH71MW.js";import"./InboxNotificationsProvider-Bd8tLMl8.js";import"./useTaskManagerAccess-CxAfFVI5.js";import"./analyticsHelper-DnGDW6mo.js";import"./ReimbursementApprovalRuleDetailScreen-uAvwHmVJ.js";import"./getLocaleForTenant-U4ff53sp.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]="0b27945e-c21d-4532-bc86-bd924eb44c39",e._sentryDebugIdIdentifier="sentry-dbid-0b27945e-c21d-4532-bc86-bd924eb44c39")}catch{}})();const hi=X((function(e,t){const l=_e(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled: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(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(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(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=K(),t=le(),l=Q(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>_e(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,C]=f.useState(!1),[x,U]=f.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=oa(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(f.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?U(!1):U(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]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",N,$,!1)))}),[b,s,n,t]),f.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(la()))}),[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(hi,{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,Si={containerWidth:new zt(100,58)},mt=X((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function w({appContent:e}){const t=le(),l=K(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));ui();const[x,U]=f.useState(!1),[D,B]=f.useState(!1),[N,V]=f.useState(!1),[W,O]=f.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>_e(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;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&U(!1))}),[n]),f.useEffect((()=>{x||n==null||u||(U(!0),t(Ct(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[x,D,u,n,t,S,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","yes"),t(ga({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(ha({file:W,billId:n}))}},G=f.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(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,N?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Ci,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:O,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
2
+ ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const bt=_.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
+ `,vi=_.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
+ `,ki=_(Je.StandardMedium)``,wi=_((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
17
+ color: ${e=>e.theme.colors.hero};
18
+ height: ${A.sp3};
19
+ width: ${A.sp3};
20
+ `,Qt=_((e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.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=_.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=_.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=_.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=_.div`
63
+ display: flex;
64
+ flex-direction: column;
65
+ width: ${e=>`${Si.containerWidth.value(e.windowSize)}%`};
66
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
+ `,Bi=_(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
+ `,Ci=_(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
+ `,xi=X((function(e,t){return{billsReviewView:Tt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/bills`),e(ce())},onCloseReviewItem:l=>{e(Ia(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(fa());break;case"approve":case"review":e(nt("approved",n??""));break;case"reject":e(nt("rejected",n??""))}}}}))(Nn);function Ai({tenantEmailDomain:e}){const t=K(),l=k((c=>c.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:n}=k((c=>Tt(c)));return f.useEffect((()=>{l!=="Completed"&&n.length!==0||t(`/${e}/bills`)}),[l,n.length,e]),a.jsx(xi,{navigate:t,analytics:j,tenantEmailDomain:e})}const ae=Aa(),Xt="bulk-operation-update",Ge="bill-approval-rule-update",{common:we}=De.getLocalizedStrings(),Ei=_.div`
81
+ display: flex;
82
+ min-height: 100%;
83
+ width: 100%;
84
+ flex: 1 1 auto;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ background-color: ${e=>e.theme.colors.grey4};
88
+ `,Di=X((function(e,t){const l=L.getSignedInUser(),n=Ae(l),c=Ft(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=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,S=c.fetchState,h=Ea(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:S,analytics:j,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:h.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ce()),e(jt(o))},onSubtabChange:o=>{e(ce()),e(Pt(o))},onTransactionClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=ji(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;j?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=T(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e($e(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e($a(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Va({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&j.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&j.trackSpendManagementDownloadClick("bill_pay"),e(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ce())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Pa(o,s??""));break;case"send_for_approval":e(it("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(it("approve")),t.navigate("./bulk-review");break;case"review":e(ja()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ge)&&e(Ta(!1))},onEventReceived:o=>{o===Xt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}}))(Yn(zn));function Ti(){const e=K(),t=le(),l=Q(),n=Ie(),c=l.state,r=fe(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=na("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(jt(c?.tab)),t(Pt(c?.subTab))),()=>{t(ce())})),[]);const p=L.getSignedInUser(),m=k((P=>Z(P))),{areTenantIdsInSync:S}=On(),[h,b]=f.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:E}=I(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:C}=I(g.isBillPayCommentingEnabled),{isFeatureEnabled:x}=I(g.isReimbursementCommentingEnabled),{isFeatureEnabled:U}=I(g.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:D}=I(g.isBillPayBulkActionEnabled),{isFeatureEnabled:B}=I(g.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:N}=I(g.isBillPayDetectInsufficientFundsEnabled),V=k((P=>Ft(P,ae,D,p?.userId))),{isFeatureEnabled:W}=I(g.isDebitCardFeatureEnabled),O=V.fetchState,{isAiCfoAccessEnabled:v,onAskAiCfoClick:Y}=Xe({mobileExploreReferrer:"Bills List"});Ze({isDataReady:O==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,$=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=k((P=>va(P.companyState,m.companyId))),J=q?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!h&&$&&S&&(b(!0),t($e(ae,!0,E,B)))}),[h,ae,S,t]),p==null)throw Error("Can't access address page without signing in...");const z=(P,re)=>{t(xa({uiState:{sortKey:P,sortOrder:re},period:ae}))},G=Rt(r?.loggedInUserRoleMap),F=de(r?.loggedInUserRoleMap),ve=P=>{o(P)},{billsProcessed:ke,billsProcessing:et}=k((P=>ka(P)));f.useEffect((()=>{ke===et&&s!=null&&(t(wa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:ke>1?we.headers.bills:we.texts.bill2},{variableName:"_has_",variableValue:ke>1?we.texts.have:we.texts.has},{variableName:"_action_",variableValue:Ba(s)}]})),t(Ca()),setTimeout((()=>{t($e(ae,!0,E,!0,B))}),3e3),i(null))}),[ke,et]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Xt}`,`private-encrypted-${m.companyId}.${Ge}`]:[],eventCallback:(P,re,tt)=>{P.endsWith(Ge)?tt.onBillPayApprovalRulesEventReceived?.(P):re?.entity_type==="bill"&&(i(re.operation_type),tt.onEventReceived(P))}},ta=Vt(W,m),aa=$t(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ta===!0||aa===!0?a.jsx(Kt,{}):$?a.jsxs(a.Fragment,{children:[O==="Completed"?a.jsx(Ee,{analytics:j,onLoad:P=>(re=>re.trackPageLoaded(Zt.Event.billPayHome))(P)}):null,a.jsxs(Ei,{windowSize:n,children:[a.jsx(Jt,{isAppContentDrawerOpen:u,handleDrawerToggle:ve}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new zt(0,0,300,600),onClose:()=>{e(`/${m.tenantEmailDomain}/bills`),t(ce())},children:a.jsx(Pi,{onClick:P=>P.stopPropagation(),children:a.jsx(Ai,{tenantEmailDomain:m.tenantEmailDomain})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:C,isReimbursementCommentingEnabled:x,period:ae,isAdmin:!1,uiState:V.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:G,isShowDeletedBillsEnabled:E,isShowDeletedReimbursementEnabled:U,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,...ea})]})]}):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 ji=e=>`/${e}/bills/setup`,Pi=_(si)`
89
+ display: flex;
90
+ min-height: 100%;
91
+ flex-direction: column;
92
+ `,{common:{currency:he},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=De.getLocalizedStrings(),Vi=X((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??Ri} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ua(t.billDetailsView.paymentDetailsSection?.paymentType?.method),S=t.currentTenant.createTime,h=_t(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=S.add(b,"month").isAfter(h),E=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Ut(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(Nt(d,!1)),e(Ot({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,S)=>{const h=_i(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:S}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(qa({billDetailLocalData:h,billId:l}))},saveBillDetails:()=>{e(Ue("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(Mt("draft"))},reviewBillDetails:()=>{const i=$i(s,l),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Se({billId:i}))},clearBillPayReviewLocalState:()=>e(Wa()),onClickDismiss:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ge(!1,i));const d=Li(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ge(!1,i));const d=Gi(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ge(!1,i));const d=Wt(s,l,i),p=T(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=T(r.state?.pathnameStackToGoBack,r.pathname);e(Se({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(i,d)=>{const p=Te(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Za(i,d,l))},onWiseVerifyClick:()=>{let i="";i=qn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Ha(!0,i,l))},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(za("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Ya(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Oa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Ma("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function gt(){const e=K(),t=Q(),l=le(),{billId:n,tenantEmailDomain:c}=te(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(g.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(g.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=r(g.isRecurringBillsFeatureEnabled),{isFeatureEnabled:h}=r(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(g.isShaDisabled),{isFeatureEnabled:I}=r(g.isOurDisabled),{isFeatureEnabled:E}=r(g.isBillPayDetectInsufficientFundsEnabled),{configValue:C}=u(We.sameDayAchDisablementConfig),x=Ga(C),U=L.getSignedInUser(),D=k((G=>Z(G))),B=k((G=>Me(G,m,h,n))),N=qt(D?.companyId,{clearParams:B.fetchState==="Completed"}),{isAiCfoAccessEnabled:V,onAskAiCfoClick:W}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:B.fetchState==="Completed"});const O=D.companyId??L.getSignedInUserTenant(c)?.companyId,v=fe(),Y=Lt(v?.loggedInUserRoleMap),M=Gt(v?.loggedInUserRoleMap),$=de(v?.loggedInUserRoleMap),q=wt(D.userRole);if(f.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),U==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(Vi,{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:S,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},$i=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Gi=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",_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(Ja)&&u?.vendorCurrencyCode===he.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Fi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Ka(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?pe(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?pe(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},S=Ui(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),h=Object.keys(S).length>0?Zn(S):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:h,recipientTotalAmount:h,file:e.file,updatesByLineId:S,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Ui=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Wn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??he.currencyCode,currencySymbol:o.currency?.currencySymbol??he.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??he.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??he.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},Mi=_.div`
93
+ display: flex;
94
+ height: 100vh;
95
+ width: 100%;
96
+ flex: 1 1 auto;
97
+ flex-direction: column;
98
+ align-items: center;
99
+ background-color: ${e=>e.theme.colors.grey4};
100
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
101
+ `,Ni=X((function(e,t){const{vendorId:l,billId:n}=t,c=ye(e,l),r=Me(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(tn(s))},onSaveHandler:()=>{e(en(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(Xa({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=Qe(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())}}}))(Jn);function Oi(){const e=K(),t=Q(),l=Ie(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=ue(),o=L.getSignedInUser(),s=k((h=>Z(h))),i=H(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((h=>ye(h,n))),{isFeatureEnabled:m}=r(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=r(g.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Mi,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Ni,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:S})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Yi=_.div`
102
+ display: flex;
103
+ height: 100vh;
104
+ width: 100%;
105
+ flex: 1 1 auto;
106
+ flex-direction: column;
107
+ align-items: center;
108
+ background-color: ${e=>e.theme.colors.grey4};
109
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
110
+ `,zi=X((function(e,t){const{vendorId:l}=t,n=ye(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=nn(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[on(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(dn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(rn(s)),p&&e(cn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(sn(s,i,d,!1))},onCancel:()=>{(()=>{const s=H(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(st())},onAddressClick:s=>{const i=Qe(o,s,l),d=T(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(ln({fetchState:"Not-Started"}));const s=H(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(st())}}}))(Kn);function Hi(){const e=K(),t=Q(),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]=f.useState(!1),m=k((x=>x.vendorViewState.newVendorState.fetchStatus.fetchState)),S=k((x=>n!=null?x.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),h=n!==void 0?S:m;f.useEffect((()=>{d===!1&&h==="Not-Started"&&n!=null&&(r(ge(!1,n)),p(!0))}),[d,h,n]);const[b,I]=f.useState(!1);f.useEffect((()=>{b||h==="In-Progress"||(I(!0),r(an(c,n)))}),[b,h,r]);const E=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",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(Yi,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:E})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},It=_.div`
111
+ display: flex;
112
+ height: 100vh;
113
+ width: 100%;
114
+ flex: 1 1 auto;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ background-color: ${e=>e.theme.colors.grey4};
118
+ box-shadow: ${e=>`0px 2px ${A.sp1} ${e.theme.colors.dropShadowNormal}`};
119
+ `,Zi=X((function(e,t){const l=L.getSignedInUser(),n=Yt(e,t.billId),c=pn(e),r=Ae(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Ut(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics: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(Ue(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(At({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Mt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ce(t.billId,"retry"))}}}))(Xn);function vt(){const e=K(),t=le(),l=Q(),{billId:n}=te(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(g.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=L.getSignedInUser(),{isFeatureEnabled:i}=c(g.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(g.isBillPayCommentingEnabled),m=H(l.state?.pathnameStackToGoBack),{poppedPathname:S}=m,{isFeatureEnabled:h}=c(g.isRecurringBillsFeatureEnabled),b=k((C=>Z(C))),I=k((C=>Yt(C,n))),E=I.fetchState??"Not-Started";if(f.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),f.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),f.useEffect((()=>{const C=I.vendor?.name,x=I.vendor?.id,U=I.totalAmount.amount,D=I.recipientTotalAmount.amount,B=I.invoiceNumber;C&&x&&t(un(C,x,U,D,B,n))}),[]),S==null)return a.jsx(ee,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return E==="In-Progress"?a.jsx(It,{windowSize:o,children:a.jsx(Qn,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Zi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:h,isDetectInsufficientFundsEnabled:u})})}const Wi=X((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:`${Ht.fileMicroServiceBaseUrl}`,authParams:i,analytics:j,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(Cn(u??void 0,t.billId)),i!=null&&e(xn(i))},saveVendorDetailLocalData:i=>{e(Ot({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(rt(u))},updateSelectedVendorForCreate:i=>{e(wn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Wt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=T(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?vn(i,"vendor",u):kn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Qe(s,i,l),p=T(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(In({files:i}))},onEditFileName:(i,d)=>{e(fn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(rt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(yn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(Sn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=H(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ri(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(gn(i,"BillPayVendor"))},onResendOtp:i=>{e(hn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(bn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(mn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Nt(i,!1))}}}))(ni),Be=()=>{const e=K(),t=le(),l=ei(),n=Q(),{billId:c,vendorId:r}=te(),u=k((b=>Z(b))),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(g.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ye(b,r))),S=k((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),h=r!==void 0?S:p;return f.useEffect((()=>{i===!1&&h==="Not-Started"&&r!=null&&(t(ge(!1,r)),d(!0))}),[i,h,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ti,{}):h==="Error"?a.jsx(ai,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Ke,{vendorId:r,billId:c}),a.jsx(Wi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},qi=X((function(e,t){const{companyId:l}=t;return{billPaySetupView:An(e,l),analytics:j,videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(En(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(oi),Ji=()=>{const e=ii(),t=K(),l=Q(),{tenantEmailDomain:n}=te(),[c,r]=f.useState(!1),u=ue(),o=k((h=>Z(h))),s=o.companyId??L.getSignedInUserTenant(n)?.companyId,i=L.getSignedInUser(),d=fe(),p=!!o.companyBillPayInfo?.info?.isBillPayTOSAccepted,m=de(d?.loggedInUserRoleMap),S=h=>{r(h)};if(i==null)throw Error("Can't access bill pay promo page without signing in...");return o.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):p===!0&&m===!0?a.jsx(ee,{to:"../../bills/setup"}):p===!1||d!=null&&Ye(o,d.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:h=>(b=>b.trackPageLoaded(Zt.Event.billPayPromoPage))(h)}),a.jsx(Jt,{isAppContentDrawerOpen:c,handleDrawerToggle:S}),a.jsx(qi,{companyId:s,navigate:t,location:l,meetingUrl:e("bill_pay_promo"),onClickMenuIcon:()=>{S(!0)}})]}):a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:u.colors.grey5}})};function jo(){const e=k(($=>Z($))),t=fe(),l=de(t?.loggedInUserRoleMap),n=ue(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(g.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Oi,{isFeatureEnabled:o}=c(g.isDebitCardFeatureEnabled),s=Vt(o,e),i=$t(e),d=Q(),p=e?.userRole!=null&&kt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&de(t?.loggedInUserRoleMap),S=Rt(t?.loggedInUserRoleMap),h=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Dn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,I=b&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:E}=c(g.isChargeCardFeatureEnabled),C=li(e,E,o)&&!p,x=C&&Tn(t?.loggedInUserRoleMap),U=jn(t?.loggedInUserRoleMap),D=Gt(t?.loggedInUserRoleMap),B=Pn(t?.loggedInUserRoleMap),N=b&&D,V=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&B,W=Fn(t?.loggedInUserRoleMap),O=Rn(t?.loggedInUserRoleMap),v=Vn(t?.loggedInUserRoleMap),Y=C&&W,{tenantEmailDomain:M}=te();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ji,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:N,isUserHasBillPayAccess:O,isUserHasReimbursementAccess:v,showTreasuryRoute:V,isTenantBankingOnly:s,showChargeCardRoute:Y,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(je,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:S,isReimbursementAdminLevelAccess:h,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:x,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Kt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&Ye(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(w,{appContent:a.jsx(gi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(ut,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(me,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(be,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(xe,{})})]}):a.jsx(y,{path:"*",element:a.jsx(se,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${A.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(xe,{})})]})}export{jo as default};