@zeniai/web-app-ui 5.1.55-qa → 5.1.56-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/assets/AddressRoutes-DOG6BtAE.js +1 -0
  2. package/dist/assets/{AddressScreen-CvPxhYFs.js → AddressScreen-w3BS5T__.js} +2 -2
  3. package/dist/assets/{AiCfoScreen-DTTgGSqT.js → AiCfoScreen-C4K6FzbI.js} +2 -2
  4. package/dist/assets/{BillPayApprovalRoutes-2y_Smb3L.js → BillPayApprovalRoutes-D2l3MfyU.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-D1KmPs-P.js → BillPayRoutes-puCF7hIb.js} +9 -9
  6. package/dist/assets/BusinessVerificationPageScreen-BCOKpvnp.js +9 -0
  7. package/dist/assets/CardsAiCfoScreen-DkQHJJyD.js +14 -0
  8. package/dist/assets/{ChargeCardRoutes-YoDH7ylN.js → ChargeCardRoutes-Ch4Au-Rk.js} +12 -12
  9. package/dist/assets/{CompanyPassportScreen-CfrYFFuL.js → CompanyPassportScreen-CLNMvqEv.js} +1 -1
  10. package/dist/assets/ConnectionAuthScreen-yTkCaoK1.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-DSnDsx1L.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-BAxjCtaH.js → CustomerOnboardingRoutes-_QxL9WL8.js} +4 -4
  13. package/dist/assets/{DashboardRoutes-Cnv2Os-7.js → DashboardRoutes-BKcrEPsw.js} +3 -3
  14. package/dist/assets/{DefaultTenantHome-D1mjvDxR.js → DefaultTenantHome-DWIyuza_.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-CG8HU9uQ.js +18 -0
  16. package/dist/assets/DrawerScreen-BkOQSI_V.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-QX_SVg1Y.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-UMX9R2ZB.js → ExpenseAutomationRoutes-BoyNxPcQ.js} +4 -4
  19. package/dist/assets/FeaturePreviewScreen-DVS7yzIQ.js +1 -0
  20. package/dist/assets/HubSpotOAuthCallbackScreen-Dsb1nJdq.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-C4TLmrqp.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-Cp5Vo4Py.js +12 -0
  23. package/dist/assets/MobileAppDrawer-BzjU__HS.js +1 -0
  24. package/dist/assets/NotFoundScreen-uCKl6Wx4.js +1 -0
  25. package/dist/assets/NotificationRoutes-CC398QC1.js +1 -0
  26. package/dist/assets/OAuthConsentScreen-DNPJKfDX.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-C3ftWleu.js +1 -0
  28. package/dist/assets/{PeopleRoutes-DwtjCeU9.js → PeopleRoutes-DAFt_Bcx.js} +3 -3
  29. package/dist/assets/PerformanceRoutes-DbR-tZSr.js +1 -0
  30. package/dist/assets/{Preview-JiizEL_C.js → Preview-f2ns8xny.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-BD3gRv9C.js → QBOConnectionScreen-BEi0Zm8x.js} +1 -1
  32. package/dist/assets/{ReferralListScreen-DPPvxoTI.js → ReferralListScreen-DUY0_-v6.js} +2 -2
  33. package/dist/assets/ReimbursementApprovalRoutes-Chh2ITQV.js +1 -0
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CcTmDK2L.js → ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes-DHjMtvfB.js → ReimbursementRoutes-COtGoxgk.js} +7 -7
  36. package/dist/assets/{ReportsRoutes-B4rkl99K.js → ReportsRoutes-BcPE2nyn.js} +1 -1
  37. package/dist/assets/RewardsRoutes-Dok3xTzo.js +1 -0
  38. package/dist/assets/ScreenRoutes-C6QOgyjY.js +2 -0
  39. package/dist/assets/{SettingsRoutes-Bvbg8LVY.js → SettingsRoutes-NVzDxtS7.js} +7 -7
  40. package/dist/assets/{SetupPagesScreen-N7NZbMog.js → SetupPagesScreen-Df4FCfYh.js} +5 -5
  41. package/dist/assets/SignInScreen-DroHIon2.js +1 -0
  42. package/dist/assets/SignOutScreen-DoPJci6D.js +9 -0
  43. package/dist/assets/{TaskListScreen-DNjQxRsg.js → TaskListScreen-NFjvdEWw.js} +2 -2
  44. package/dist/assets/TaskRoutes-8aOjIEkV.js +9 -0
  45. package/dist/assets/{TransactionDetailRoutes-9wsPGvQA.js → TransactionDetailRoutes-D3MSXmNL.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-DdyjxpNe.js → TransactionDetailScreen-CSArdLSZ.js} +2 -2
  47. package/dist/assets/{TransactionListRoutes-Y3HUjCX4.js → TransactionListRoutes-UucRW17G.js} +1 -1
  48. package/dist/assets/{TreasuryRoutes-Po66nW-G.js → TreasuryRoutes-DwgadYGN.js} +5 -5
  49. package/dist/assets/{VendorsRoutes-Bhe46MLu.js → VendorsRoutes-Im4S2wjo.js} +14 -14
  50. package/dist/assets/WiseConfirmationScreen-C6UoDkmK.js +12 -0
  51. package/dist/assets/{ZeniAccountRoutes-BVrcLxAX.js → ZeniAccountRoutes-Dczw62ti.js} +13 -13
  52. package/dist/assets/ZeniAccountStatementScreen-prmZg4t5.js +9 -0
  53. package/dist/assets/{accountMappingHelper-BfrLGhoG.js → accountMappingHelper-DS9ya8eF.js} +1 -1
  54. package/dist/assets/{analytics-CQmVOD4d.js → analytics-BLbM2ksu.js} +1 -1
  55. package/dist/assets/{analyticsHelper-Bvqx3iRr.js → analyticsHelper-B_k9Kjrd.js} +1 -1
  56. package/dist/assets/{core-CbpoBsNm.js → core-OMb8nkC1.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-9Mzf3G8U.js → decodeURIComponentSafe-CrZYJ6cg.js} +1 -1
  58. package/dist/assets/{dnd-CX5suNP6.js → dnd-DVcQZAG5.js} +1 -1
  59. package/dist/assets/{empty-DhAifQ6-.js → empty-BACf_dXg.js} +1 -1
  60. package/dist/assets/{empty-BijKctOw.js → empty-CyDTyMxd.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-D-mIIbkx.js → emptyVideoElement-wUn7k4Wi.js} +1 -1
  62. package/dist/assets/{epic-D_RLnD_Y.js → epic-C0I2MvV5.js} +1 -1
  63. package/dist/assets/getLocaleForTenant-CDmBpg_y.js +1 -0
  64. package/dist/assets/{index-B781xFYL.js → index-5gq8gNHx.js} +2 -2
  65. package/dist/assets/{index-Mdt1gUpR.js → index-BNIZfLgU.js} +1 -1
  66. package/dist/assets/{index-Bg6fgf4p.js → index-BQIzm-tN.js} +1 -1
  67. package/dist/assets/{index-D-GsKzyX.js → index-CPre97x9.js} +1 -1
  68. package/dist/assets/{index-CR_Xz42r.js → index-CVJX5WNC.js} +1 -1
  69. package/dist/assets/{index-aZImxzjX.js → index-DLAYU8mN.js} +7454 -7454
  70. package/dist/assets/{index-CTRa-Eva.js → index-DmsNrKhC.js} +1 -1
  71. package/dist/assets/{index-cXBO33fb.js → index-SfOqAjbR.js} +1 -1
  72. package/dist/assets/{lexical-BS7d_1CV.js → lexical-CNfNgAkp.js} +1 -1
  73. package/dist/assets/{liveblocks-BLlSTcoD.js → liveblocks-BUQfB0Zp.js} +1 -1
  74. package/dist/assets/{lottie-BY8e0Ufw.js → lottie-DDI83OWz.js} +1 -1
  75. package/dist/assets/{mui-DcNGd9L2.js → mui-JZY-3hhJ.js} +1 -1
  76. package/dist/assets/{pathToGoBack-C2QnAeVh.js → pathToGoBack-iJW8VSI1.js} +1 -1
  77. package/dist/assets/{pdf-BslZhgI8.js → pdf-6FZlivdz.js} +4 -4
  78. package/dist/assets/{pdf-lib-BxiXr152.js → pdf-lib-CtBKoWQc.js} +1 -1
  79. package/dist/assets/{plaid-B62punae.js → plaid-B_OuebQv.js} +1 -1
  80. package/dist/assets/{pusher-yI34WBaU.js → pusher-BqrLLY7v.js} +1 -1
  81. package/dist/assets/{react-bALoVfnT.js → react-BVW_zt6p.js} +1 -1
  82. package/dist/assets/{react-BhNVTcBK.js → react-Crq75Q-S.js} +1 -1
  83. package/dist/assets/{react-D4d29E8H.js → react-D-VI0x0-.js} +1 -1
  84. package/dist/assets/{react-Bxt57-xI.js → react-PG_EpTGq.js} +1 -1
  85. package/dist/assets/{react-CcJOgdcP.js → react-axoushfz.js} +1 -1
  86. package/dist/assets/{react-DP_wuGKo.js → react-uplfhPO2.js} +1 -1
  87. package/dist/assets/{recharts-C0aThBg3.js → recharts-DAM4r1-u.js} +1 -1
  88. package/dist/assets/{routePaths-DyIc-n3M.js → routePaths-CLQbotzs.js} +1 -1
  89. package/dist/assets/{sentry-D_xp3E3Q.js → sentry-BLIwU6uZ.js} +1 -1
  90. package/dist/assets/{url-Cn_1-HsX.js → url-BMb7_G4N.js} +1 -1
  91. package/dist/assets/{url-DZdoYQOC.js → url-CbGZb3kM.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-ClwyrxTK.js → useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js} +1 -1
  93. package/dist/assets/{useAskAiCfoHostNavButtonProps-BZImc5qT.js → useAskAiCfoHostNavButtonProps-Cw5yceVN.js} +1 -1
  94. package/dist/assets/useCashManagementBanner-COC9VygZ.js +1 -0
  95. package/dist/assets/{useDeviceId-BX67JldO.js → useDeviceId-l9JfwAte.js} +1 -1
  96. package/dist/assets/{useInitialThreadRequest-DVxzaQcg.js → useInitialThreadRequest-CgLG7-4I.js} +1 -1
  97. package/dist/assets/{utils-BQO84dIV.js → utils-Bia5qc4p.js} +1 -1
  98. package/dist/assets/{withTransactionSidePanel-MinVWpma.js → withTransactionSidePanel-Dtr8LlVa.js} +4 -4
  99. package/dist/assets/{zeni-epic-state-CkeDRiud.js → zeni-epic-state-BZ6N8nVI.js} +6 -6
  100. package/dist/index.html +1 -1
  101. package/package.json +3 -3
  102. package/dist/assets/AddressRoutes-ENVkkepY.js +0 -1
  103. package/dist/assets/BusinessVerificationPageScreen-D2N5zUvV.js +0 -9
  104. package/dist/assets/CardsAiCfoScreen-bhVF9e_F.js +0 -14
  105. package/dist/assets/ConnectionAuthScreen-B6tGghLx.js +0 -11
  106. package/dist/assets/CustomerOnboardingAuthScreen-CpXzEPeL.js +0 -1
  107. package/dist/assets/DomesticWireDetailScreen-DEZpmV1y.js +0 -18
  108. package/dist/assets/DrawerScreen-CfPgZFbu.js +0 -1
  109. package/dist/assets/EntityDetailRoutes-ByNAOdBV.js +0 -1
  110. package/dist/assets/FeaturePreviewScreen-Bbo-4gXG.js +0 -1
  111. package/dist/assets/HubSpotOAuthCallbackScreen-Cngdo8vI.js +0 -1
  112. package/dist/assets/MagicLinkRoutes-CP3FxH4t.js +0 -72
  113. package/dist/assets/MagicLinkSignInScreen-DfMGZywc.js +0 -12
  114. package/dist/assets/MobileAppDrawer-CWBhYKqW.js +0 -1
  115. package/dist/assets/NotFoundScreen-Bnx2UPHv.js +0 -1
  116. package/dist/assets/NotificationRoutes-Qy8HYHkb.js +0 -1
  117. package/dist/assets/OAuthConsentScreen-DffRqRWT.js +0 -1
  118. package/dist/assets/PandLWithForecastRoutes-DzMNbzsJ.js +0 -1
  119. package/dist/assets/PerformanceRoutes-DJjg_nmN.js +0 -1
  120. package/dist/assets/ReimbursementApprovalRoutes-BwiPly2p.js +0 -1
  121. package/dist/assets/RewardsRoutes-CmWH02Nb.js +0 -1
  122. package/dist/assets/ScreenRoutes-BVhH5D33.js +0 -2
  123. package/dist/assets/SignInScreen-DqCXO7t5.js +0 -1
  124. package/dist/assets/SignOutScreen-PgaK8hUe.js +0 -9
  125. package/dist/assets/TaskRoutes-DddYQsp2.js +0 -9
  126. package/dist/assets/WiseConfirmationScreen-gcw35kRr.js +0 -12
  127. package/dist/assets/ZeniAccountStatementScreen-NjdxQEux.js +0 -9
  128. package/dist/assets/getLocaleForTenant-9euvow3p.js +0 -1
  129. package/dist/assets/useCashManagementBanner-BWjfwjGa.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BUQfB0Zp.js";import{A as d}from"./AddressScreen-w3BS5T__.js";import i from"./NotFoundScreen-uCKl6Wx4.js";import"./sentry-BLIwU6uZ.js";import{o as s,p as r}from"./core-OMb8nkC1.js";import"./zeni-epic-state-BZ6N8nVI.js";import"./recharts-DAM4r1-u.js";import"./index-DLAYU8mN.js";import"./mui-JZY-3hhJ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-BLlSTcoD.js";import{a as h}from"./sentry-D_xp3E3Q.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-CbpoBsNm.js";import{K as $,m as D,z as K,j as L,B as O,A as z,d as C,f as S,n as F,h as b,p as N}from"./index-aZImxzjX.js";import{Ml as w,hO as R,eW as U,Mm as G,c7 as V,Mn as q,l7 as H}from"./zeni-epic-state-CkeDRiud.js";import{n as W}from"./mui-DcNGd9L2.js";import J from"./NotFoundScreen-Bnx2UPHv.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]="b8c762e4-0ab2-4314-8e02-9cd5dbf13d64",e._sentryDebugIdIdentifier="sentry-dbid-b8c762e4-0ab2-4314-8e02-9cd5dbf13d64")}catch{}})();const Q=W.div`
1
+ import{j as r}from"./liveblocks-BUQfB0Zp.js";import{a as h}from"./sentry-BLIwU6uZ.js";import{h as T,u as _,g as E,i as j,j as M,n as B}from"./core-OMb8nkC1.js";import{J as $,m as D,z as L,j as K,B as N,E as R,d as C,f as S,x as z,k as b,q as F}from"./index-DLAYU8mN.js";import{Mk as k,hN as U,eV as V,Ml as q,c6 as G,Mm as O,l6 as H}from"./zeni-epic-state-BZ6N8nVI.js";import{n as J}from"./mui-JZY-3hhJ.js";import Q from"./NotFoundScreen-uCKl6Wx4.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]="c102055e-3927-402b-98f2-f05dad092bfa",e._sentryDebugIdIdentifier="sentry-dbid-c102055e-3927-402b-98f2-f05dad092bfa")}catch{}})();const W=J.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as r}from"./liveblocks-BLlSTcoD.js";import{a as h}from"./sentry-D_xp3E3
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,X=B(function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=U(e),a=t.roleMap!=null&&G(t.roleMap),d=i||c==="user_address"||V(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=q(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=w(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}},function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,n=N(d?.pathnameStackToGoBack);let s=n.poppedPathname??A();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(s=`${s}?${g}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=Y(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}})(F);function re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=_(),n=j(),{addressId:s,addressType:u}=M(),g=$(),I=D(),k=K.getSignedInUser(),[f,v]=h.useState(s==null),p=E(m=>s!=null?w(m,s).fetchState:"Not-Started"),x=L();if(k==null)throw Error("Can't access address page without signing in...");const P=m=>m.trackPageLoaded(s!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect(()=>{f||s==null||(v(!0),d(R(s,!1)))},[f,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!f&&p==="Not-Started"||f&&p==="In-Progress"?r.jsx(O,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):s!=null&&p==="Error"?(a(`${A(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(z,{analytics:C,onLoad:P}),r.jsx(Q,{windowSize:g,children:r.jsx(X,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):r.jsx(J,{})}const A=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},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
+ `,X=B(function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=V(e),a=t.roleMap!=null&&q(t.roleMap),d=i||c==="user_address"||G(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=O(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=k(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}},function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,n=F(d?.pathnameStackToGoBack);let s=n.poppedPathname??w();const u=d?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(s=`${s}?${f}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=Y(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}})(z);function re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=_(),n=E(),{addressId:s,addressType:u}=j(),f=$(),x=D(),I=L.getSignedInUser(),[g,v]=h.useState(s==null),p=M(m=>s!=null?k(m,s).fetchState:"Not-Started"),A=K();if(I==null)throw Error("Can't access address page without signing in...");const P=m=>m.trackPageLoaded(s!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect(()=>{g||s==null||(v(!0),d(U(s,!1)))},[g,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!g&&p==="Not-Started"||g&&p==="In-Progress"?r.jsx(N,{fetchState:p,style:{backgroundColor:x.colors.grey5}}):s!=null&&p==="Error"?(a(`${w(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(R,{analytics:C,onLoad:P}),r.jsx(W,{windowSize:f,children:r.jsx(X,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):r.jsx(Q,{})}const w=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,Y as t};
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-BLlSTcoD.js";import{a as r}from"./sentry-D_xp3E3Q.js";import{u as xe,h as Pe,g as we,j as Z,i as ye,n as Ee}from"./core-CbpoBsNm.js";import{W as Te,d9 as ve,z as Ae,K as Qe,da as _e,db as Oe,b6 as J,dc as ae,dd as Ue,b5 as se,p as M,A as B,d as I,de as R,df as je,dg as Le,a1 as Fe,f as De,a7 as Be,dh as Re,di as Ve,a2 as Me,dj as $e,dk as Ge,dl as Ne,s as qe,b1 as We,dm as ze}from"./index-aZImxzjX.js";import{gj as He,eV as oe,eW as Ke,iu as Xe,Ts as Ye,fn as Ze,iE as Je,iA as et,eX as V,fu as tt,g4 as at,fZ as st,g1 as ee,g5 as ot,g6 as nt,g7 as it,g8 as rt,g9 as lt}from"./zeni-epic-state-CkeDRiud.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-DcNGd9L2.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-ClwyrxTK.js";import{p as pt}from"./pathToGoBack-C2QnAeVh.js";import"./recharts-C0aThBg3.js";import"./analytics-CQmVOD4d.js";import"./plaid-B62punae.js";import"./dnd-CX5suNP6.js";import"./stripe-DMRn4zHo.js";import"./lottie-BY8e0Ufw.js";import"./lexical-BS7d_1CV.js";import"./pdf-BslZhgI8.js";import"./utils-BQO84dIV.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="c1e0b77b-bf06-487d-aea0-21f3e2873e6a",e._sentryDebugIdIdentifier="sentry-dbid-c1e0b77b-bf06-487d-aea0-21f3e2873e6a")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&We(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Z(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=Z(i=>Ke(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[J]!==!0)return;S(!0);const f={...i};delete f[J],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),N=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),q=N.get("ref")??w?.aiCfoRef,L=N.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||q!=="month-end-email"||L==null||n!=null||s==null||(t(Xe("controller",s.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[q,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",K=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ze({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:z.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[z]);r.useEffect(()=>{F!=="In-Progress"&&D&&t(Je())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&K&&s!=null&&F==="Completed"&&!D&&t(et(n,s.userId))},[H,K,n,s,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:Y}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
1
+ import{j as c}from"./liveblocks-BUQfB0Zp.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xe,h as Pe,g as we,j as X,i as ye,n as Ee}from"./core-OMb8nkC1.js";import{V as Te,d9 as ve,z as Ae,J as Qe,da as _e,db as Ue,b6 as Z,dc as ae,dd as Oe,b5 as se,q as M,E as V,d as I,de as B,df as je,dg as Le,a1 as De,f as Fe,a7 as Ve,dh as Be,di as Re,a2 as Me,dj as $e,dk as Ge,dl as qe,s as Ne,b1 as ze,dm as We}from"./index-DLAYU8mN.js";import{gi as He,eU as oe,eV as Ye,it as Je,Tr as Ke,fm as Xe,iD as Ze,iz as et,eW as R,ft as tt,g3 as at,fY as st,g0 as ee,g4 as ot,g5 as nt,g6 as it,g7 as rt,g8 as lt}from"./zeni-epic-state-BZ6N8nVI.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-JZY-3hhJ.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js";import{p as pt}from"./pathToGoBack-iJW8VSI1.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="f6f82459-1d9e-4e72-98da-d1822acbfba6",e._sentryDebugIdIdentifier="sentry-dbid-f6f82459-1d9e-4e72-98da-d1822acbfba6")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,We(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&ze(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Dt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=X(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=De(d),p=X(i=>Ye(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),q=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect(()=>{z.current||N!=="month-end-email"||L==null||n!=null||s==null||(t(Je("controller",s.userId,L,"MONTH_END_EMAIL")),z.current=!0)},[N,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Oe(n),D=m.fetchState,F=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Xe({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{D!=="In-Progress"&&F&&t(Ze())},[D,F,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&Y&&s!=null&&D==="Completed"&&!F&&t(et(n,s.userId))},[H,Y,n,s,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(R(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(V,{analytics:I,onLoad:K}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(V,{analytics:I,onLoad:i=>i.trackPageLoaded(Fe.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -19,4 +19,4 @@ import{j as c}from"./liveblocks-BLlSTcoD.js";import{a as r}from"./sentry-D_xp3E3
19
19
  `,Ct=k(ut)`
20
20
  box-shadow: ${({theme:e})=>e.colors.elevation2};
21
21
  color: ${({theme:e})=>e.colors.grey4};
22
- `;export{Ft as default};
22
+ `;export{Dt as default};
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-BLlSTcoD.js";import{a as v}from"./sentry-D_xp3E3Q.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as x}from"./core-CbpoBsNm.js";import{eW as P,PD as A,Pj as h,zb as E,z3 as q,z7 as R,yY as K,Pl as J,zd as ae,y$ as Y,zg as G,zc as C}from"./zeni-epic-state-CkeDRiud.js";import{z as V,a7 as H,bI as oe,af as O,bz as M,bJ as le,m as Q,B as X,bK as pe,bL as se}from"./index-aZImxzjX.js";import"./mui-DcNGd9L2.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CcTmDK2L.js";import re from"./NotFoundScreen-Bnx2UPHv.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="0599711c-cc2d-4b5c-b8bd-9c7978a6044e",e._sentryDebugIdIdentifier="sentry-dbid-0599711c-cc2d-4b5c-b8bd-9c7978a6044e")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(J(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(J(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>P(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=M(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Y(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let D=[];L==="role"&&N!=null?D=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(D=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:D,operator:D.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>P(t)),{isApprovalRulesV3Enabled:p}=M(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Y(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function De(){return c.jsxs(te,{children:[c.jsx(x,{path:"/",element:c.jsx(de,{})}),c.jsx(x,{path:"/new",element:c.jsx($,{})}),c.jsx(x,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(x,{path:"*",element:c.jsx(re,{})})]})}export{De as B};
1
+ import{j as c}from"./liveblocks-BUQfB0Zp.js";import{a as v}from"./sentry-BLIwU6uZ.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-OMb8nkC1.js";import{eV as V,PC as A,Pi as h,za as E,z2 as q,z6 as R,yX as K,Pk as J,zc as ae,y_ as X,zf as G,zb as C}from"./zeni-epic-state-BZ6N8nVI.js";import{z as P,a7 as H,bI as oe,af as O,bz as M,bJ as le,m as Q,B as Y,bK as pe,bL as se}from"./index-DLAYU8mN.js";import"./mui-JZY-3hhJ.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js";import re from"./NotFoundScreen-uCKl6Wx4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="d79f5ba6-1ced-4e53-9764-9a1466833c91",e._sentryDebugIdIdentifier="sentry-dbid-d79f5ba6-1ced-4e53-9764-9a1466833c91")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(J(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>V(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),P.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(J(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>V(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=M(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>V(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),P.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(X(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>V(t)),{isApprovalRulesV3Enabled:p}=M(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(X(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as ae,j as v,N as te,n as Q,l as na,o as ia,p as y}from"./core-CbpoBsNm.js";import{eW as Z,OV as _e,bt as It,JS as oa,bo as wt,bJ as pe,OW as At,yt as Bt,zI as $e,z0 as la,bn as De,OX as sa,OY as ra,c7 as ca,OZ as da,kr as Ct,O_ as xt,O$ as Et,Ah as Ge,yI as Ce,P0 as ua,yh as tt,P1 as pa,Ee as ma,yl as ba,yr as Dt,P2 as ke,P3 as Me,zJ as Oe,P4 as ha,P5 as ga,zM as Ne,P6 as Sa,zZ as ya,P7 as Pt,zt as at,zy as fa,P8 as ka,P9 as ue,Pa as jt,Pb as Tt,Pc as Ft,gn as va,yN as Le,cB as Rt,Pd as Ia,fw as wa,Pe as Aa,Pf as Ba,fB as Vt,fz as $t,Pg as ze,Ph as Ca,Pi as xa,ME as Ze,Pj as Ea,MF as oe,MG as He,Pk as Da,Pl as Pa,Pm as ja,zA as nt,zx as Ta,Pn as Fa,Po as Ra,Pp as Va,zj as $a,Pq as La,Pr as Ua,Ps as _a,cp as Lt,cR as Ut,kC as Ga,bP as Ma,bq as _t,bQ as Gt,xz as Oa,Pt as Na,E1 as za,E7 as Za,tZ as Ha,zK as Wa,Ao as qa,kP as fe,Pu as Ja,Pv as Mt,lh as Ka,kJ as Ot,l2 as Nt,l1 as it,bE as be,bO as Xa,Pw as Qa,Px as ve,jm as Ya,Py as ot,Pz as en,jq as tn,jL as an,AC as nn,PA as on,la as ln,As as sn,PB as lt,Aw as rn,AB as cn,Ay as dn,Aq as un,PC as zt,yC as pn,PD as mn,PE as bn,gf as hn,ge as gn,gd as Sn,kS as yn,l8 as st,lj as fn,rx as kn,k$ as vn,Au as In,jw as wn,lo as An,PF as Bn,jo as Cn,ro as xn,PG as En,zp as Dn,bK as Pn,bs as jn,LA as Tn,cT as Fn,cS as Rn,cA as Vn,cH as $n}from"./zeni-epic-state-CkeDRiud.js";import{m as me,z as V,j as Ie,_ as We,F as le,x as S,aN as xe,B as re,o as x,A as Pe,d as D,be as Ln,p as z,a2 as qe,s as E,K as we,bf as rt,bg as ct,bh as Un,ak as _n,I as Gn,aH as Mn,G as Zt,D as Je,J as Ke,bi as On,at as Ht,bj as Nn,X as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Xn,bq as Qn,br as Yn,bs as ei,w as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-aZImxzjX.js";import{n as U,S as si}from"./mui-DcNGd9L2.js";import{A as dt}from"./AddressScreen-CvPxhYFs.js";import{g as ie,a as je,i as qt,V as Xe,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-DEZpmV1y.js";import{a as f}from"./sentry-D_xp3E3Q.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BZImc5qT.js";import{u as Jt}from"./useInitialThreadRequest-DVxzaQcg.js";import Ee from"./NotFoundScreen-Bnx2UPHv.js";import{D as ui}from"./DrawerScreen-CfPgZFbu.js";import{M as Kt}from"./MobileAppDrawer-CWBhYKqW.js";import{F as Xt}from"./FeaturePreviewScreen-Bbo-4gXG.js";import{S as Te}from"./SetupPagesScreen-N7NZbMog.js";import{B as pi}from"./BillPayApprovalRoutes-2y_Smb3L.js";import{FallBackRoute as mi}from"./ScreenRoutes-BVhH5D33.js";import"./recharts-C0aThBg3.js";import"./analytics-CQmVOD4d.js";import"./plaid-B62punae.js";import"./dnd-CX5suNP6.js";import"./stripe-DMRn4zHo.js";import"./lottie-BY8e0Ufw.js";import"./lexical-BS7d_1CV.js";import"./pdf-BslZhgI8.js";import"./utils-BQO84dIV.js";import"./analyticsHelper-Bvqx3iRr.js";import"./routePaths-DyIc-n3M.js";import"./BusinessVerificationPageScreen-D2N5zUvV.js";import"./ReimbursementApprovalRuleDetailScreen-CcTmDK2L.js";import"./getLocaleForTenant-9euvow3p.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]="96187d5a-f7dd-481a-a1bc-69b9b8e863e4",e._sentryDebugIdIdentifier="sentry-dbid-96187d5a-f7dd-481a-a1bc-69b9b8e863e4")}catch{}})();const bi=Q(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.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(tt(l,o.type,"")):e(tt(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=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(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(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=X(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(O=>Z(O)),s=v(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(S.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:J}=j(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),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(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Se=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=v(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=v(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Qt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:Se.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Se.overwriteDescription}),primaryButtonText:Se.buttons.yes,secondaryButtonText:Se.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=On();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${Se.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-BUQfB0Zp.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as Q,l as na,o as ia,p as S}from"./core-OMb8nkC1.js";import{eV as Z,OU as _e,bs as It,JR as oa,bq as wt,bJ as pe,OV as At,ys as Bt,zH as $e,y$ as la,bn as De,OW as sa,OX as ra,c6 as ca,OY as da,kq as Ct,OZ as xt,O_ as Et,Ag as Ge,yH as Ce,O$ as ua,yg as tt,P0 as pa,Ed as ma,yk as ba,yq as Dt,P1 as ve,P2 as Me,zI as Oe,P3 as ha,P4 as ga,zL as Ne,P5 as ya,zY as Sa,P6 as Pt,zs as at,zx as fa,P7 as va,P8 as ue,P9 as jt,Pa as Tt,Pb as Ft,gm as ka,yM as Le,cA as Rt,Pc as Ia,fv as wa,Pd as Aa,Pe as Ba,fA as Vt,fy as $t,Pf as ze,Pg as Ca,Ph as xa,MD as Ze,Pi as Ea,ME as oe,MF as He,Pj as Da,Pk as Pa,Pl as ja,zz as nt,zw as Ta,Pm as Fa,Pn as Ra,Po as Va,zi as $a,Pp as La,Pq as Ua,Pr as _a,co as Lt,cQ as Ut,kB as Ga,bP as Ma,bo as _t,bQ as Gt,xy as Oa,Ps as Na,E0 as za,E6 as Za,tY as Ha,zJ as Wa,An as qa,kO as fe,Pt as Ja,Pu as Mt,lg as Ka,kI as Ot,l1 as Nt,l0 as it,bE as be,bO as Ya,Pv as Qa,Pw as ke,jl as Xa,Px as ot,Py as en,jp as tn,jK as an,AB as nn,Pz as on,l9 as ln,Ar as sn,PA as lt,Av as rn,AA as cn,Ax as dn,Ap as un,PB as zt,yB as pn,PC as mn,PD as bn,ge as hn,gd as gn,gc as yn,kR as Sn,l7 as st,li as fn,rw as vn,k_ as kn,At as In,jv as wn,ln as An,PE as Bn,jn as Cn,rn as xn,PF as En,zo as Dn,bK as Pn,bt as jn,Lz as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-BZ6N8nVI.js";import{m as me,z as V,j as Ie,_ as We,a as le,F as y,aN as xe,B as re,o as x,E as Pe,d as D,be as Ln,q as z,a2 as qe,s as E,J as we,bf as rt,bg as ct,bh as Un,ak as _n,H as Gn,aH as Mn,A as Zt,D as Je,N as Ke,bi as On,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Yn,bq as Qn,br as Xn,bs as ei,Z as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-DLAYU8mN.js";import{n as U,S as si}from"./mui-JZY-3hhJ.js";import{A as dt}from"./AddressScreen-w3BS5T__.js";import{g as ie,a as je,i as qt,V as Ye,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-CG8HU9uQ.js";import{a as f}from"./sentry-BLIwU6uZ.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-Cw5yceVN.js";import{u as Jt}from"./useInitialThreadRequest-CgLG7-4I.js";import Ee from"./NotFoundScreen-uCKl6Wx4.js";import{D as ui}from"./DrawerScreen-BkOQSI_V.js";import{M as Kt}from"./MobileAppDrawer-BzjU__HS.js";import{F as Yt}from"./FeaturePreviewScreen-DVS7yzIQ.js";import{S as Te}from"./SetupPagesScreen-Df4FCfYh.js";import{B as pi}from"./BillPayApprovalRoutes-D2l3MfyU.js";import{FallBackRoute as mi}from"./ScreenRoutes-C6QOgyjY.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./analyticsHelper-B_k9Kjrd.js";import"./routePaths-CLQbotzs.js";import"./BusinessVerificationPageScreen-BCOKpvnp.js";import"./ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js";import"./getLocaleForTenant-CDmBpg_y.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]="52595b0a-7e44-43a7-9e7b-61eac003b95a",e._sentryDebugIdIdentifier="sentry-dbid-52595b0a-7e44-43a7-9e7b-61eac003b95a")}catch{}})();const bi=Q(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.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(tt(l,o.type,"")):e(tt(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=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(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(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=k(O=>Z(O)),s=k(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:J}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),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(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=k(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=k(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const X=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Qt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(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:`${ye.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -6,14 +6,14 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
6
6
  position: absolute;
7
7
  display: flex;
8
8
  align-items: center;
9
- `,ki=U.div`
9
+ `,vi=U.div`
10
10
  display: flex;
11
11
  justify-content: center;
12
12
  align-items: center;
13
13
  padding-top: 9px;
14
14
  gap: ${x.sp2};
15
15
  margin-bottom: -${x.sp2};
16
- `,vi=U(Ke.StandardMedium)``,Ii=U(e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))`
16
+ `,ki=U(Ke.StandardMedium)``,Ii=U(e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))`
17
17
  color: ${e=>e.theme.colors.hero};
18
18
  height: ${x.sp3};
19
19
  width: ${x.sp3};
@@ -77,7 +77,7 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
77
77
  margin-bottom: 30px;
78
78
  margin-top: ${x.sp4};
79
79
  white-space: pre-line;
80
- `,Bi=Q(function(e,t){return{billsReviewView:Pt(e),analytics:t.analytics}},function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(ka(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(fa());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}})(Nn);function Ci(){const e=K(),t=v(n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState),{billsForReview:l}=v(n=>Pt(n));return f.useEffect(()=>{t!=="Completed"&&l.length!==0||e("./")},[t,l.length]),a.jsx(Bi,{navigate:e,analytics:D})}const ne=xa(),Yt="bulk-operation-update",Ue="bill-approval-rule-update",{spendManagement:xi,common:bt}=Je.getLocalizedStrings(),ht=xi.billPay.bulkActions,Ei=U.div`
80
+ `,Bi=Q(function(e,t){return{billsReviewView:Pt(e),analytics:t.analytics}},function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(va(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(fa());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}})(Nn);function Ci(){const e=K(),t=k(n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState),{billsForReview:l}=k(n=>Pt(n));return f.useEffect(()=>{t!=="Completed"&&l.length!==0||e("./")},[t,l.length]),a.jsx(Bi,{navigate:e,analytics:D})}const ne=xa(),Xt="bulk-operation-update",Ue="bill-approval-rule-update",{spendManagement:xi,common:bt}=Je.getLocalizedStrings(),ht=xi.billPay.bulkActions,Ei=U.div`
81
81
  display: flex;
82
82
  min-height: 100%;
83
83
  width: 100%;
@@ -85,11 +85,11 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
85
85
  flex-direction: column;
86
86
  align-items: center;
87
87
  background-color: ${e=>e.theme.colors.grey4};
88
- `,Di=Q(function(e,t){const l=V.getSignedInUser(),n=De(l),c=Ft(e,ne,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,h=c.fetchState,g=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:h,analytics:D,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ne,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:g.affectedEntityIds}},function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ue()),e(jt(o))},onSubtabChange:o=>{e(ue()),e(Tt(o))},onTransactionClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=ji(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;D?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=E(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e(Le(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)&&D.trackSpendManagmentFilterChange("bill_pay",o.categories.map(s=>`${s.field}-${JSON.stringify(s.values)}`))},updateDownloadStateHandler:o=>{o==="In-Progress"&&D.trackSpendManagementDownloadClick("bill_pay"),e(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Ta(o,s??""));break;case"send_for_approval":e(nt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(nt("approve")),t.navigate("./bulk-review");break;case"review":e(ja()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ue)&&e(Pa(!1))},onEventReceived:o=>{o===Yt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}})(Zn(Hn));function Pi(){const e=K(),t=se(),l=X(),n=we(),c=l.state,r=Ie(),[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(Tt(c?.subTab))),()=>{t(ue())}),[]);const p=V.getSignedInUser(),m=v(T=>Z(T)),{areTenantIdsInSync:h}=zn(),[g,b]=f.useState(!1),{useFeatureGate:k}=le(),{isFeatureEnabled:P}=k(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=k(S.isBillPayCommentingEnabled),{isFeatureEnabled:B}=k(S.isReimbursementCommentingEnabled),{isFeatureEnabled:G}=k(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:j}=k(S.isBillPayBulkActionEnabled),{isFeatureEnabled:_}=k(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:$}=k(S.isBillPayDetectInsufficientFundsEnabled),I=v(T=>Ft(T,ne,j,p?.userId)),{isFeatureEnabled:H}=k(S.isDebitCardFeatureEnabled),M=I.fetchState,{isAiCfoAccessEnabled:C,onAskAiCfoClick:q}=Ye({mobileExploreReferrer:"Bills List"});We({isDataReady:M==="Completed"});const W=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,L=!!m.companyBillPayInfo?.info?.isBillPayEnabled,J=v(T=>va(T.companyState,m.companyId)),Y=J?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect(()=>{!g&&L&&h&&(b(!0),t(Le(ne,!0,P,_)))},[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const O=(T,de)=>{t(Ca({uiState:{sortKey:T,sortOrder:de},period:ne}))},ee=Rt(r?.loggedInUserRoleMap),F=pe(r?.loggedInUserRoleMap),ce=T=>{o(T)},{billsProcessed:N,billsProcessing:Ae}=v(T=>Ia(T));f.useEffect(()=>{N===Ae&&s!=null&&(t(wa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:N>1?ht.bills:ht.bill},{variableName:"_has_",variableValue:N>1?bt.texts.have:bt.texts.has},{variableName:"_action_",variableValue:Aa(s)}]})),t(Ba()),setTimeout(()=>{t(Le(ne,!0,P,!0,_))},3e3),i(null))},[N,Ae]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Yt}`,`private-encrypted-${m.companyId}.${Ue}`]:[],eventCallback:(T,de,et)=>{T.endsWith(Ue)?et.onBillPayApprovalRulesEventReceived?.(T):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(T))}},ta=Vt(H,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(Xt,{}):L?a.jsxs(a.Fragment,{children:[M==="Completed"?a.jsx(Pe,{analytics:D,onLoad:T=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(T)}):null,a.jsxs(Ei,{windowSize:n,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Ti,{onClick:T=>T.stopPropagation(),children:a.jsx(Ci,{})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:A,isReimbursementCommentingEnabled:B,period:ne,isAdmin:!1,uiState:I.uiState,onColumnSortConfigChanged:O,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:P,isShowDeletedReimbursementEnabled:G,isBulkActionEnabled:j,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:I.billBulkSubmissionLimit,bulkSubmissionFetchState:I.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:I.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:_,isDetectInsufficientFundsEnabled:$,isAiCfoAccessEnabled:C,onAskAiCfoClick:q,...ea})]})]}):W===!0&&F===!0?a.jsx(te,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:M}):a.jsx(Ee,{})}const ji=e=>`/${e}/bills/setup`,Ti=U(si)`
88
+ `,Di=Q(function(e,t){const l=V.getSignedInUser(),n=De(l),c=Ft(e,ne,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,h=c.fetchState,g=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:h,analytics:D,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ne,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:g.affectedEntityIds}},function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ue()),e(jt(o))},onSubtabChange:o=>{e(ue()),e(Tt(o))},onTransactionClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=ji(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;D?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=E(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e(Le(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)&&D.trackSpendManagmentFilterChange("bill_pay",o.categories.map(s=>`${s.field}-${JSON.stringify(s.values)}`))},updateDownloadStateHandler:o=>{o==="In-Progress"&&D.trackSpendManagementDownloadClick("bill_pay"),e(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Ta(o,s??""));break;case"send_for_approval":e(nt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(nt("approve")),t.navigate("./bulk-review");break;case"review":e(ja()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ue)&&e(Pa(!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(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}})(Zn(Hn));function Pi(){const e=K(),t=se(),l=Y(),n=we(),c=l.state,r=Ie(),[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(Tt(c?.subTab))),()=>{t(ue())}),[]);const p=V.getSignedInUser(),m=k(T=>Z(T)),{areTenantIdsInSync:h}=zn(),[g,b]=f.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:P}=v(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=v(y.isBillPayCommentingEnabled),{isFeatureEnabled:B}=v(y.isReimbursementCommentingEnabled),{isFeatureEnabled:G}=v(y.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:j}=v(y.isBillPayBulkActionEnabled),{isFeatureEnabled:_}=v(y.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:$}=v(y.isBillPayDetectInsufficientFundsEnabled),I=k(T=>Ft(T,ne,j,p?.userId)),{isFeatureEnabled:H}=v(y.isDebitCardFeatureEnabled),M=I.fetchState,{isAiCfoAccessEnabled:C,onAskAiCfoClick:q}=Xe({mobileExploreReferrer:"Bills List"});We({isDataReady:M==="Completed"});const W=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,L=!!m.companyBillPayInfo?.info?.isBillPayEnabled,J=k(T=>ka(T.companyState,m.companyId)),X=J?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect(()=>{!g&&L&&h&&(b(!0),t(Le(ne,!0,P,_)))},[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const O=(T,de)=>{t(Ca({uiState:{sortKey:T,sortOrder:de},period:ne}))},ee=Rt(r?.loggedInUserRoleMap),F=pe(r?.loggedInUserRoleMap),ce=T=>{o(T)},{billsProcessed:N,billsProcessing:Ae}=k(T=>Ia(T));f.useEffect(()=>{N===Ae&&s!=null&&(t(wa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:N>1?ht.bills:ht.bill},{variableName:"_has_",variableValue:N>1?bt.texts.have:bt.texts.has},{variableName:"_action_",variableValue:Aa(s)}]})),t(Ba()),setTimeout(()=>{t(Le(ne,!0,P,!0,_))},3e3),i(null))},[N,Ae]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Xt}`,`private-encrypted-${m.companyId}.${Ue}`]:[],eventCallback:(T,de,et)=>{T.endsWith(Ue)?et.onBillPayApprovalRulesEventReceived?.(T):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(T))}},ta=Vt(H,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(Yt,{}):L?a.jsxs(a.Fragment,{children:[M==="Completed"?a.jsx(Pe,{analytics:D,onLoad:T=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(T)}):null,a.jsxs(Ei,{windowSize:n,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Ti,{onClick:T=>T.stopPropagation(),children:a.jsx(Ci,{})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:A,isReimbursementCommentingEnabled:B,period:ne,isAdmin:!1,uiState:I.uiState,onColumnSortConfigChanged:O,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:P,isShowDeletedReimbursementEnabled:G,isBulkActionEnabled:j,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:X,bulkSubmissionLimit:I.billBulkSubmissionLimit,bulkSubmissionFetchState:I.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:I.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:_,isDetectInsufficientFundsEnabled:$,isAiCfoAccessEnabled:C,onAskAiCfoClick:q,...ea})]})]}):W===!0&&F===!0?a.jsx(te,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:M}):a.jsx(Ee,{})}const ji=e=>`/${e}/bills/setup`,Ti=U(si)`
89
89
  display: flex;
90
90
  min-height: 100%;
91
91
  flex-direction: column;
92
- `,{common:{currency:ye},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=Je.getLocalizedStrings(),Vi=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=z(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=De(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=Ma(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=_t(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,k=h.add(b,"month").isAfter(g),P=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Gt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),A=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Ct(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,analytics:D,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:A.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:P,isZeniUser:d,isNewUser:k,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(it(i));const d=St(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ot(d,!1)),e(Nt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(it());const p=St(s,void 0,l),m=E(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Oe(i))},onSaveChangesToLocalStore:(i,d,p,m,h)=>{const g=_i(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ka({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Ge("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Mt("draft"))},reviewBillDetails:()=>{const i=$i(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(ke({billId:i}))},clearBillPayReviewLocalState:()=>e(Ja()),onClickDismiss:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ie(s),d=E(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=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(fe(!1,i));const d=Li(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(fe(!1,i));const d=Ui(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(fe(!1,i));const d=qt(s,l,i),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);e(ke({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(i,d)=>{const p=je(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ie(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(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(i,d){e(qa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Kn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Wa(!0,i,l))},onSignUpAccountClick:()=>{t.hasZeniAccountsAdminAccess?window.open(`/${s}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{t.isZeniAccountsUser?window.open(`/${s}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ha("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(za(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}})(Wn);function gt(){const e=K(),t=X(),l=se(),{billId:n,tenantEmailDomain:c}=ae(),{useFeatureGate:r,useDynamicConfig:u}=le(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(S.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(S.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(S.isRecurringBillsFeatureEnabled),{isFeatureEnabled:g}=r(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(S.isShaDisabled),{isFeatureEnabled:k}=r(S.isOurDisabled),{isFeatureEnabled:P}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(xe.zeniAccountsConfig),B=Ua(A),{configValue:G}=u(xe.sameDayAchDisablementConfig),j=_a(G),_=V.getSignedInUser(),$=v(N=>Z(N)),I=v(N=>Me(N,m,g,n)),H=Jt($?.companyId,{clearParams:I.fetchState==="Completed"}),{isAiCfoAccessEnabled:M,onAskAiCfoClick:C}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:I.fetchState==="Completed"});const q=$.companyId??V.getSignedInUserTenant(c)?.companyId,W=!!$.companyZeniAccountInfo?.info?.isZeniAccountEnabled,L=Ie(),J=Lt(L?.loggedInUserRoleMap),Y=Ut(L?.loggedInUserRoleMap),O=pe(L?.loggedInUserRoleMap),ee=wt($.userRole);if(f.useEffect(()=>{n!=null&&l(At(n))},[n]),_==null)throw Error("Can't access address page without signing in...");const F=v(N=>Ga(N.accountState,N.accountListState,"billPayAccountList")),ce={pathname:"../",search:t.search};return I.isDeleted===!0||I.billStage=="paid"||I.fetchState=="Not-Started"?a.jsx(te,{to:ce}):I.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:I.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(Ae=>{n!=null&&I.deleteStatus.fetchState!=="Completed"&&Ae.trackBillPayEditBill(n,I.isRecurring)})(N)}),a.jsx(Vi,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:$,billId:n,companyId:q,billDetailsView:I,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:F,isInternationalPaymentShaVsOurEnabled:i,vendor:I.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:k,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:W,hasZeniAccountsAdminAccess:J,isZeniAccountsUser:Y,isBillPayAdmin:O,isSuperAdmin:ee,accountsPromoConfig:B,isDetectInsufficientFundsEnabled:P,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:M,onAskAiCfoClick:C})]})}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},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",_i=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):_t(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?be(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(Xa)&&u?.vendorCurrencyCode===ye.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:Qa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?be(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},h=Gi(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),g=Object.keys(h).length>0?qn(h):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:g,recipientTotalAmount:g,file:e.file,updatesByLineId:h,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Gi=(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=Jn(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??ye.currencyCode,currencySymbol:o.currency?.currencySymbol??ye.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??ye.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??ye.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}}),u},Mi=U.div`
92
+ `,{common:{currency:Se},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=Je.getLocalizedStrings(),Vi=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=z(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=De(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=Ma(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=_t(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,v=h.add(b,"month").isAfter(g),P=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Gt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),A=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Ct(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,analytics:D,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:A.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:P,isZeniUser:d,isNewUser:v,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(it(i));const d=yt(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ot(d,!1)),e(Nt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(it());const p=yt(s,void 0,l),m=E(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(Ne(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Oe(i))},onSaveChangesToLocalStore:(i,d,p,m,h)=>{const g=_i(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ka({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Ge("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Mt("draft"))},reviewBillDetails:()=>{const i=$i(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(ve({billId:i}))},clearBillPayReviewLocalState:()=>e(Ja()),onClickDismiss:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ie(s),d=E(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=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(fe(!1,i));const d=Li(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(fe(!1,i));const d=Ui(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(fe(!1,i));const d=qt(s,l,i),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);e(ve({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(i,d)=>{const p=je(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ie(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(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(i,d){e(qa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Kn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Wa(!0,i,l))},onSignUpAccountClick:()=>{t.hasZeniAccountsAdminAccess?window.open(`/${s}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{t.isZeniAccountsUser?window.open(`/${s}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ha("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(za(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}})(Wn);function gt(){const e=K(),t=Y(),l=se(),{billId:n,tenantEmailDomain:c}=ae(),{useFeatureGate:r,useDynamicConfig:u}=le(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(y.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(y.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.isRecurringBillsFeatureEnabled),{isFeatureEnabled:g}=r(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(y.isShaDisabled),{isFeatureEnabled:v}=r(y.isOurDisabled),{isFeatureEnabled:P}=r(y.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(xe.zeniAccountsConfig),B=Ua(A),{configValue:G}=u(xe.sameDayAchDisablementConfig),j=_a(G),_=V.getSignedInUser(),$=k(N=>Z(N)),I=k(N=>Me(N,m,g,n)),H=Jt($?.companyId,{clearParams:I.fetchState==="Completed"}),{isAiCfoAccessEnabled:M,onAskAiCfoClick:C}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:I.fetchState==="Completed"});const q=$.companyId??V.getSignedInUserTenant(c)?.companyId,W=!!$.companyZeniAccountInfo?.info?.isZeniAccountEnabled,L=Ie(),J=Lt(L?.loggedInUserRoleMap),X=Ut(L?.loggedInUserRoleMap),O=pe(L?.loggedInUserRoleMap),ee=wt($.userRole);if(f.useEffect(()=>{n!=null&&l(At(n))},[n]),_==null)throw Error("Can't access address page without signing in...");const F=k(N=>Ga(N.accountState,N.accountListState,"billPayAccountList")),ce={pathname:"../",search:t.search};return I.isDeleted===!0||I.billStage=="paid"||I.fetchState=="Not-Started"?a.jsx(te,{to:ce}):I.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:I.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(Ae=>{n!=null&&I.deleteStatus.fetchState!=="Completed"&&Ae.trackBillPayEditBill(n,I.isRecurring)})(N)}),a.jsx(Vi,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:$,billId:n,companyId:q,billDetailsView:I,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:F,isInternationalPaymentShaVsOurEnabled:i,vendor:I.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:v,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:W,hasZeniAccountsAdminAccess:J,isZeniAccountsUser:X,isBillPayAdmin:O,isSuperAdmin:ee,accountsPromoConfig:B,isDetectInsufficientFundsEnabled:P,sameDayAchDisablementConfig:j,isAiCfoAccessEnabled:M,onAskAiCfoClick:C})]})}const yt=(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},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",_i=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):_t(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?be(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find(b=>b.id===t[R]?.withdrawFrom?.selectedOption),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(Ya)&&u?.vendorCurrencyCode===Se.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:Qa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?be(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},h=Gi(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),g=Object.keys(h).length>0?qn(h):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:g,recipientTotalAmount:g,file:e.file,updatesByLineId:h,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Gi=(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=Jn(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??Se.currencyCode,currencySymbol:o.currency?.currencySymbol??Se.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??Se.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??Se.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}}),u},Mi=U.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
98
98
  align-items: center;
99
99
  background-color: ${e=>e.theme.colors.grey4};
100
100
  box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
101
- `,Oi=Q(function(e,t){const{vendorId:l,billId:n}=t,c=ve(e,l),r=Me(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(en({data:i}))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??yt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ya({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??yt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}})(Xn);function Ni(){const e=K(),t=X(),l=we(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=V.getSignedInUser(),s=v(g=>Z(g)),i=z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v(g=>ve(g,n)),{isFeatureEnabled:m}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(S.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(re,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Mi,{windowSize:l,children:[a.jsx(Xe,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.div`
101
+ `,Oi=Q(function(e,t){const{vendorId:l,billId:n}=t,c=ke(e,l),r=Me(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(en({data:i}))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??St();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Xa({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??St(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}})(Yn);function Ni(){const e=K(),t=Y(),l=we(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=V.getSignedInUser(),s=k(g=>Z(g)),i=z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k(g=>ke(g,n)),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.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(re,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Mi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const St=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=U.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
107
107
  align-items: center;
108
108
  background-color: ${e=>e.theme.colors.grey4};
109
109
  box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
110
- `,Zi=Q(function(e,t){const{vendorId:l}=t,n=ve(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(cn(s)),p&&e(dn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(rn(s,i,d,!1))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}})(Qn);function Hi(){const e=K(),t=X(),l=we(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=V.getSignedInUser(),s=v(B=>Z(B)),i=z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=v(B=>B.vendorViewState.newVendorState.fetchStatus.fetchState),h=v(B=>n!=null?B.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started"),g=n!==void 0?h:m;f.useEffect(()=>{d===!1&&g==="Not-Started"&&n!=null&&(r(fe(!1,n)),p(!0))},[d,g,n]);const[b,k]=f.useState(!1);f.useEffect(()=>{b||g==="In-Progress"||(k(!0),r(nn(c,n)))},[b,g,r]);const P=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=v(B=>ve(B,n));if(o==null)throw Error("Can't access international wire page without signing in...");return P==="billDetail"&&A.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:A.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(zi,{windowSize:l,children:[a.jsx(Xe,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:P})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},kt=U.div`
110
+ `,Zi=Q(function(e,t){const{vendorId:l}=t,n=ke(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(cn(s)),p&&e(dn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(rn(s,i,d,!1))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}})(Qn);function Hi(){const e=K(),t=Y(),l=we(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=V.getSignedInUser(),s=k(B=>Z(B)),i=z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=k(B=>B.vendorViewState.newVendorState.fetchStatus.fetchState),h=k(B=>n!=null?B.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started"),g=n!==void 0?h:m;f.useEffect(()=>{d===!1&&g==="Not-Started"&&n!=null&&(r(fe(!1,n)),p(!0))},[d,g,n]);const[b,v]=f.useState(!1);f.useEffect(()=>{b||g==="In-Progress"||(v(!0),r(nn(c,n)))},[b,g,r]);const P=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=k(B=>ke(B,n));if(o==null)throw Error("Can't access international wire page without signing in...");return P==="billDetail"&&A.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:A.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(zi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:P})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},vt=U.div`
111
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-BLlSTcoD.js";import{h as K,u as se,g as X,i as a
116
116
  align-items: center;
117
117
  background-color: ${e=>e.theme.colors.grey4};
118
118
  box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
119
- `,Wi=Q(function(e,t){const l=V.getSignedInUser(),n=zt(e,t.billId),c=mn(e),r=De(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Gt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:D,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}},function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ie(c.tenantEmailDomain),s=E(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:n,data:s})),e(Ge(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(xt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Mt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=je(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ce(t.billId,"retry"))}}})(ei);function vt(){const e=K(),t=se(),l=X(),{billId:n}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(S.isBillPayDetectInsufficientFundsEnabled),o=we(),s=V.getSignedInUser(),{isFeatureEnabled:i}=c(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(S.isBillPayCommentingEnabled),m=z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(S.isRecurringBillsFeatureEnabled),b=v(A=>Z(A)),k=v(A=>zt(A,n)),P=k.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 A=k.vendor?.name,B=k.vendor?.id,G=k.totalAmount.amount,j=k.recipientTotalAmount.amount,_=k.invoiceNumber;A&&B&&t(pn(A,B,G,j,_,n))},[]),h==null)return a.jsx(te,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return P==="In-Progress"?a.jsx(kt,{windowSize:o,children:a.jsx(Yn,{})}):a.jsx(kt,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=Q(function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=V.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:D,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(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:i=>{e(An(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?In(i,"vendor",u):wn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Qe(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(vn({files:i}))},onEditFileName:(i,d)=>{e(kn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(yn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ri(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(Sn(i,"BillPayVendor"))},onResendOtp:i=>{e(gn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(hn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(bn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}})(ii),Be=()=>{const e=K(),t=se(),l=ti(),n=X(),{billId:c,vendorId:r}=ae(),u=v(b=>Z(b)),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=v(b=>b.vendorViewState.newVendorState.fetchStatus.fetchState),m=v(b=>ve(b,r)),h=v(b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started"),g=r!==void 0?h:p;return f.useEffect(()=>{i===!1&&g==="Not-Started"&&r!=null&&(t(fe(!1,r)),d(!0))},[i,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):g==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Xe,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=Q(function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:D,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}},function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}})(oi),Ki=()=>{const e=K(),t=X(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=v(h=>Z(h)),o=u.companyId??V.getSignedInUserTenant(l)?.companyId,s=V.getSignedInUser(),i=Ie(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(i?.loggedInUserRoleMap),m=h=>{c(h)};if(s==null)throw Error("Can't access bill pay promo page without signing in...");return u.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(te,{to:"../../../bills"}):d===!0&&p===!0?a.jsx(te,{to:"../../bills/setup"}):d===!1||i!=null&&ze(u,i.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ji,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function Do(){const e=v(M=>Z(M)),t=Ie(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=Vt(o,e),i=$t(e),d=X(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Rt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Pn(t?.loggedInUserRoleMap),{isFeatureEnabled:b}=c(S.isDepositAccountsFeatureEnabled),k=b&&!p&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:P}=c(S.isChargeCardFeatureEnabled),A=li(e,P,o)&&!p&&jn(t?.loggedInUserRoleMap),B=Tn(t?.loggedInUserRoleMap),G=Ut(t?.loggedInUserRoleMap),j=Fn(t?.loggedInUserRoleMap),_=Rn(t?.loggedInUserRoleMap),$=Vn(t?.loggedInUserRoleMap),I=$n(t?.loggedInUserRoleMap),{tenantEmailDomain:H}=ae();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{isUserHasZeniAccountsAccess:G,isUserHasChargeCardAccess:_,isUserHasBillPayAccess:$,isUserHasReimbursementAccess:I,isUserHasTreasuryAccess:j,isTenantBankingOnly:s,tenantEmailDomain:H??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Pi,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Xt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(te,{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(hi,{})})}),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(dt,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{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(he,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),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(he,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),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(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),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(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),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(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Ee,{})})]}):a.jsx(y,{path:"*",element:a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Ee,{})})]})}export{Do as default};
119
+ `,Wi=Q(function(e,t){const l=V.getSignedInUser(),n=zt(e,t.billId),c=mn(e),r=De(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Gt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:D,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}},function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ie(c.tenantEmailDomain),s=E(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:n,data:s})),e(Ge(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(xt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Mt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=je(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ce(t.billId,"retry"))}}})(ei);function kt(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(y.isBillPayDetectInsufficientFundsEnabled),o=we(),s=V.getSignedInUser(),{isFeatureEnabled:i}=c(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(y.isBillPayCommentingEnabled),m=z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(y.isRecurringBillsFeatureEnabled),b=k(A=>Z(A)),v=k(A=>zt(A,n)),P=v.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 A=v.vendor?.name,B=v.vendor?.id,G=v.totalAmount.amount,j=v.recipientTotalAmount.amount,_=v.invoiceNumber;A&&B&&t(pn(A,B,G,j,_,n))},[]),h==null)return a.jsx(te,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return P==="In-Progress"?a.jsx(vt,{windowSize:o,children:a.jsx(Xn,{})}):a.jsx(vt,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=Q(function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=V.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:D,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(Nt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Bn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:i=>{e(An(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?In(i,"vendor",u):wn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Qe(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(kn({files:i}))},onEditFileName:(i,d)=>{e(vn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("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(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ri(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(yn(i,"BillPayVendor"))},onResendOtp:i=>{e(gn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(hn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(bn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}})(ii),Be=()=>{const e=K(),t=se(),l=ti(),n=Y(),{billId:c,vendorId:r}=ae(),u=k(b=>Z(b)),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(y.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k(b=>b.vendorViewState.newVendorState.fetchStatus.fetchState),m=k(b=>ke(b,r)),h=k(b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started"),g=r!==void 0?h:p;return f.useEffect(()=>{i===!1&&g==="Not-Started"&&r!=null&&(t(fe(!1,r)),d(!0))},[i,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):g==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Ye,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=Q(function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:D,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}},function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}})(oi),Ki=()=>{const e=K(),t=Y(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=k(h=>Z(h)),o=u.companyId??V.getSignedInUserTenant(l)?.companyId,s=V.getSignedInUser(),i=Ie(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(i?.loggedInUserRoleMap),m=h=>{c(h)};if(s==null)throw Error("Can't access bill pay promo page without signing in...");return u.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(te,{to:"../../../bills"}):d===!0&&p===!0?a.jsx(te,{to:"../../bills/setup"}):d===!1||i!=null&&ze(u,i.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ji,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function Do(){const e=k(M=>Z(M)),t=Ie(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(y.isDebitCardFeatureEnabled),s=Vt(o,e),i=$t(e),d=Y(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Rt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Pn(t?.loggedInUserRoleMap),{isFeatureEnabled:b}=c(y.isDepositAccountsFeatureEnabled),v=b&&!p&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:P}=c(y.isChargeCardFeatureEnabled),A=li(e,P,o)&&!p&&jn(t?.loggedInUserRoleMap),B=Tn(t?.loggedInUserRoleMap),G=Ut(t?.loggedInUserRoleMap),j=Fn(t?.loggedInUserRoleMap),_=Rn(t?.loggedInUserRoleMap),$=Vn(t?.loggedInUserRoleMap),I=$n(t?.loggedInUserRoleMap),{tenantEmailDomain:H}=ae();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(S,{path:"setup",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"setup"})}),a.jsx(S,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"verification"})}),a.jsx(S,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(S,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{isUserHasZeniAccountsAccess:G,isUserHasChargeCardAccess:_,isUserHasBillPayAccess:$,isUserHasReimbursementAccess:I,isUserHasTreasuryAccess:j,isTenantBankingOnly:s,tenantEmailDomain:H??""})}),a.jsx(S,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:B,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(S,{path:"*",element:a.jsx(Pi,{})}),(s===!0||i===!0)&&a.jsx(S,{path:"/*",element:a.jsx(Yt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(S,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(S,{path:"*",element:a.jsx(te,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(S,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(S,{path:":billId",element:a.jsx(w,{appContent:a.jsx(hi,{})})}),a.jsx(S,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(S,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(kt,{})})}),a.jsx(S,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(kt,{})})}),a.jsx(S,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Be,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"*",element:a.jsx(Ee,{})})]}):a.jsx(S,{path:"*",element:a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(S,{path:"*",element:a.jsx(Ee,{})})]})}export{Do as default};
@@ -0,0 +1,9 @@
1
+ import{j as k}from"./liveblocks-BUQfB0Zp.js";import{a as V}from"./sentry-BLIwU6uZ.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-OMb8nkC1.js";import{j as ce,a as ue,aN as de,z as E,E as pe,d as z,af as P,f as x,bE as le,at as me,s as B,au as R}from"./index-DLAYU8mN.js";import{Pq as fe,eV as G,tn as ye,JU as Se,zi as ge,CK as Ie,Fm as he,F$ as be,G$ as Oe,PN as Te,PO as De,PP as ke,PQ as Ce,PR as Ve,Ml as we,OP as Ne,Mw as Ae,l6 as _e,ge as Fe,gd as ve,gc as Pe,rw as xe,rn as Ee,rk as ze,k_ as Be,tw as Re,tu as M,bE as U,tI as j,cy as Me}from"./zeni-epic-state-BZ6N8nVI.js";import{n as Ue}from"./mui-JZY-3hhJ.js";import{d as L}from"./routePaths-CLQbotzs.js";import{M as je}from"./MobileAppDrawer-BzjU__HS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="00a72f73-38e2-40ee-9e3e-6aa06d675c21",e._sentryDebugIdIdentifier="sentry-dbid-00a72f73-38e2-40ee-9e3e-6aa06d675c21")}catch{}})();const Le=Ue.div`
2
+ display: flex;
3
+ min-height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ `,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=we(d.roleMap)&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=Ne(e.companyConfigState),s=Ae(e.userRoleConfigState);return{businessVerificationDetails:i,verficationDetailsFetchState:i.fetchState,isRefreshingViewInBackground:i.isRefreshingViewInBackground,allNationalityCountries:i.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:s.companyTitles}},function(e,d){const{companyId:i,productType:r,currentTenant:y,navigate:S,location:l}=d,{tenantEmailDomain:b}=y;return{onCompanyDetailsChanged:t=>{const{companyDescription:s,companyIndustry:p,companyIndustryType:T,companyLegalName:D,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:c,primaryContactName:n,primaryContactUserId:u,primaryContactSyncToken:O,syncToken:f,fileIds:a,incDate:o,typeOfIncorporation:w,stateOfIncorporation:N,sourceOfFunds:A,companySubIndustry:_,countriesOfOperations:h,companySourceOfFunds:$,companySourceOfFundsDescription:q,transactionVolume:Z,transactionVolumeDescription:J,purposeOfAccount:K,purposeOfAccountDescription:Q,regulatedStatus:W,regulatedStatusDescription:H,usNexus:X,usNexusTypes:Y}=t,F=T?.selectedOption,ee={companyId:i,companyDescription:s,companyIndustry:p.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:D,taxIdOrEIN:g,website:m!=""&&m!=null?Me(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:o!=null?U(o?.toString()):o,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:A?.selectedOption??"",companySubIndustry:_?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map(v=>v.length===2?v:R(v))??[],companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:q,transactionVolume:Z?.selectedOption??"",transactionVolumeDescription:J,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:Q,regulatedStatus:W??"",regulatedStatusDescription:H,usNexus:X,usNexusTypes:Y?.selectedOptions??[]},te={userId:u,firstName:n.firstName,lastName:n.lastName,email:c,syncToken:O};e(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:t=>{const s=t.map(p=>{const{officerType:T,userId:D,name:g,email:m,nationalityCountryCode:I,ssn:c,dob:n,phone:u,syncToken:O,selectDocument:f,role:a,ownership:o,isSelectedForVerification:w,userVerificationStatus:N,treasuryUserVerificationStatus:A,fileIds:_}=p;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:T,userId:D,firstName:g.firstName,lastName:g.lastName,email:m,ssn:c,nationalityCountryCode:I?.selectedOption!=null?R(I.selectedOption):void 0,phone:u,birthday:n!=null?U(n?.toString()):n,syncToken:O,titleAtCompany:a.selectedOption,ownershipInCompany:o,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:N,treasuryUserVerificationStatus:A,fileIds:_,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}});e(j({officers:s}))},onSaveDetailsClick:t=>{e(M(i,t,r))},onSendForVerificationClick:t=>{e(M(i,t,r,!0))},onAddressClick:t=>{const s=L(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:t=>{const s=L(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onBackClick:()=>{e(Re({companyId:i})),S("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(ze(t))},onDeleteFileList:t=>{e(Ee(t))},onEditFileName:(t,s)=>{e(xe(t,s.split(".")[0]))},onGetOtp:t=>{e(Pe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(ve(t,"SpendManagementSetup"))},onVerifyOtp:(t,s)=>{e(Fe(t,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,s)=>{e(_e({addressType:t,addressToCreate:s}))}}})(le),Xe=({productType:e})=>{const d=ae(),i=ne(),r=se(),[y,S]=V.useState(!1),[l,b]=V.useState(!1),{tenantEmailDomain:t}=ie(),s=ce(),{useDynamicConfig:p}=ue(),{configValue:T}=p(de.zeniAccountsConfig),D=fe(T),g=C(a=>{switch(e){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}}),m=C(a=>a.companyConfigState.fetchState),I=C(a=>a.userRoleConfigState.fetchState),c=C(a=>G(a)),n=c.companyId??E.getSignedInUserTenant(t)?.companyId;if(V.useEffect(()=>{m==="Not-Started"&&r(ye()),I==="Not-Started"&&r(Se(!0))},[m,I,r]),V.useEffect(()=>{if(!y&&g==="Not-Started"&&n!=null)switch(S(!0),e){case"zeni_accounts":r(Oe(n,!0));break;case"zeni_treasury":r(be(n,!0));break;case"reimbursement":r(he(n,!0));break;case"charge_cards":r(Ie(n,!0));break;default:r(ge(n,!0))}},[y,g,n,r]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let u;switch(e){case"zeni_accounts":u=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":u=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":u=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":u=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:u=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=a=>{b(a)},f=C(a=>{let o;switch(e){case"zeni_accounts":o=Ve(a,n);break;case"zeni_treasury":o=Ce(a,n);break;case"charge_cards":o=ke(a,n);break;case"reimbursement":o=De(a,n);break;default:o=Te(a,n)}return o});return u===!1?k.jsx(oe,{to:"../promo"}):k.jsxs(Le,{children:[k.jsx(pe,{analytics:z,onLoad:a=>(o=>{switch(e){case"zeni_accounts":return o.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return o.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return o.trackPageLoaded(x.Event.billPayBusinessVerification,P(i)?"Settings":void 0)}})(a)}),P(i)?k.jsx(je,{isAppContentDrawerOpen:l,handleDrawerToggle:O}):null,k.jsx(Ge,{businessVerificationDetails:f,navigate:d,location:i,companyId:n,analytics:z,currentTenant:c,productType:e,isSettings:P(i),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:D.maxInsuredAmount})]})};export{Xe as B};
@@ -0,0 +1,14 @@
1
+ import{j as g}from"./liveblocks-BUQfB0Zp.js";import{a as l}from"./sentry-BLIwU6uZ.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-OMb8nkC1.js";import{V as ge,d9 as be,z as ye,da as Pe,dc as z,dd as Ie,b5 as W,E as we,d as D,de as B,dn as Ee,D as ke,f as Ae,a7 as Te,dh as xe,di as Ue,a2 as _e,dl as Oe,b1 as ve,dm as Qe}from"./index-DLAYU8mN.js";import{gi as Fe,eU as G,eV as De,fm as Ve,iD as $e,iz as Le,eW as H,g3 as je,fY as Re,g0 as N,g4 as qe,g5 as Me,g6 as Be,g7 as He,g8 as Ne}from"./zeni-epic-state-BZ6N8nVI.js";import{D as ze,n as $,P as We,S as Ge}from"./mui-JZY-3hhJ.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b172a50c-53c3-49af-9b82-6d95b5951fc8",e._sentryDebugIdIdentifier="sentry-dbid-b172a50c-53c3-49af-9b82-6d95b5951fc8")}catch{}})();const Y="chat-response-generated",Z="cards/ask",J="card_policy_hero";function V(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Ye=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):V(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?D.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):D.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Be(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(He({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${Z}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=X.pageTitle,Ze=ee.pageTitle,Je=X.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>De(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Ze:A,subtitle:I?Ke:Je}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${Z}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${Y}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o($e())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))},[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:D,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(H(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Xe,{onClick:r=>r.stopPropagation(),children:g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(H(n.userRoleId)),h(!1)}})})})]})},Xe=$(Ge)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,et=$.div`
6
+ flex: 1 1 auto;
7
+ display: flex;
8
+ flex-direction: column;
9
+ min-height: 0;
10
+ width: 100%;
11
+ `,tt=$(We)`
12
+ box-shadow: ${({theme:e})=>e.colors.elevation2};
13
+ color: ${({theme:e})=>e.colors.grey4};
14
+ `;export{St as default};