@zeniai/web-app-ui 5.2.10-qa → 5.2.11-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 (135) hide show
  1. package/dist/assets/AddressRoutes-Dd5BLPNk.js +1 -0
  2. package/dist/assets/AddressScreen-B9qIDuai.js +9 -0
  3. package/dist/assets/AiCfoScreen-vunuko6i.js +22 -0
  4. package/dist/assets/{BillPayApprovalRoutes-B4banQ09.js → BillPayApprovalRoutes-pStG307K.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-D3T-lEVk.js → BillPayRoutes-DbYnaX3_.js} +11 -11
  6. package/dist/assets/{BusinessVerificationPageScreen-Bsm9CkGv.js → BusinessVerificationPageScreen-C7ez20uI.js} +2 -2
  7. package/dist/assets/{CardsAiCfoScreen-wMkZzZ_n.js → CardsAiCfoScreen-gbRXVqr8.js} +3 -3
  8. package/dist/assets/{ChargeCardRoutes-DS6GEFEI.js → ChargeCardRoutes--zXOSegl.js} +10 -10
  9. package/dist/assets/CompanyPassportScreen-BFAkEtYn.js +1 -0
  10. package/dist/assets/ConnectionAuthScreen-DHpBzuhF.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-Dt45S7Zn.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-DdGAOHoB.js → CustomerOnboardingRoutes-DXqGvG-i.js} +6 -6
  13. package/dist/assets/{DashboardRoutes-D8tbohO7.js → DashboardRoutes-V58yuU0O.js} +4 -4
  14. package/dist/assets/{DefaultTenantHome-DqbO_FPa.js → DefaultTenantHome-DFUBuSUw.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-DV-LDQl5.js +18 -0
  16. package/dist/assets/DrawerScreen-CLmFnWBR.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-D-VExL9R.js +1 -0
  18. package/dist/assets/ExpenseAutomationRoutes-DxTIqyhg.js +25 -0
  19. package/dist/assets/{FeaturePreviewScreen-Bf8p9qA6.js → FeaturePreviewScreen-DQZK8Tkd.js} +1 -1
  20. package/dist/assets/HubSpotOAuthCallbackScreen-DD2ALtLX.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-0xFiI_gt.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-CAbcD9gJ.js +12 -0
  23. package/dist/assets/MobileAppDrawer-BSqYxsX2.js +1 -0
  24. package/dist/assets/NotFoundScreen-B35T6J3X.js +1 -0
  25. package/dist/assets/NotificationRoutes-BSEbFYc7.js +1 -0
  26. package/dist/assets/OAuthConsentScreen-DDzTn8ex.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-DL85XT-N.js +1 -0
  28. package/dist/assets/{PeopleRoutes-Bn-EuJ4v.js → PeopleRoutes-tvVCUcKN.js} +3 -3
  29. package/dist/assets/PerformanceRoutes-CRPowUNZ.js +1 -0
  30. package/dist/assets/{Preview-BH9guJVl.js → Preview-BFORWhGg.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-BePcKt2I.js → QBOConnectionScreen-BY-ET0xU.js} +1 -1
  32. package/dist/assets/ReimbursementApprovalRoutes-xDcJz-Qa.js +1 -0
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BFSR8IP5.js → ReimbursementApprovalRuleDetailScreen-Dds_onx1.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-CMRAQDmN.js → ReimbursementRoutes-Br35P7Ex.js} +6 -6
  35. package/dist/assets/{ReportsRoutes-DX1a3KYi.js → ReportsRoutes-DlFjy5j4.js} +1 -1
  36. package/dist/assets/RewardsRoutes-ybfqamBR.js +1 -0
  37. package/dist/assets/ScreenRoutes-ZHVecYPB.js +2 -0
  38. package/dist/assets/{SettingsRoutes-CeP6shWo.js → SettingsRoutes-BTJJZw7w.js} +7 -7
  39. package/dist/assets/{SetupPagesScreen-DGqDTbQK.js → SetupPagesScreen-BoNxDLXk.js} +5 -5
  40. package/dist/assets/{SignInScreen-gRUMEEH6.js → SignInScreen-DSHzSt42.js} +1 -1
  41. package/dist/assets/SignOutScreen-C0pSERkC.js +9 -0
  42. package/dist/assets/TaskListScreen-eY2qEexK.js +9 -0
  43. package/dist/assets/TaskRoutes-DK4tCNck.js +9 -0
  44. package/dist/assets/{TransactionDetailRoutes-BPpf7f9E.js → TransactionDetailRoutes-C2A6Ai04.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-BTy4CO79.js → TransactionDetailScreen-Y2A-PdMn.js} +2 -2
  46. package/dist/assets/{TransactionListRoutes-z_hNGDnV.js → TransactionListRoutes-DV5L4e1G.js} +1 -1
  47. package/dist/assets/TreasuryRoutes-foYlsfsF.js +37 -0
  48. package/dist/assets/{VendorsRoutes-CVd0Zx8K.js → VendorsRoutes-B1TOelcz.js} +21 -21
  49. package/dist/assets/WiseConfirmationScreen-CI_HPhh8.js +12 -0
  50. package/dist/assets/{ZeniAccountRoutes-Cx0DNwci.js → ZeniAccountRoutes-Cs3s5yj2.js} +11 -11
  51. package/dist/assets/ZeniAccountStatementScreen-COiOGQqB.js +9 -0
  52. package/dist/assets/{accountMappingHelper-BWbl_Mr6.js → accountMappingHelper-Bc02_HWR.js} +1 -1
  53. package/dist/assets/{analytics-BVZAGmSf.js → analytics-B6nQWxMm.js} +1 -1
  54. package/dist/assets/{analyticsHelper-DZApVryU.js → analyticsHelper-Og8Rmx5y.js} +1 -1
  55. package/dist/assets/{core-lpqyfl_C.js → core-D-w0syUt.js} +1 -1
  56. package/dist/assets/{decodeURIComponentSafe-miEPY4cs.js → decodeURIComponentSafe-C7k2Nrj_.js} +1 -1
  57. package/dist/assets/{dnd-xbSIuUzo.js → dnd-Dt7EosAi.js} +1 -1
  58. package/dist/assets/{empty-s6mdVY5S.js → empty-B7Efn92X.js} +1 -1
  59. package/dist/assets/{empty-Dcg7CF8X.js → empty-DF-g8Byo.js} +1 -1
  60. package/dist/assets/{emptyVideoElement-rePyiZcH.js → emptyVideoElement-CBdlopDC.js} +1 -1
  61. package/dist/assets/epic-DUSro8MZ.js +2 -0
  62. package/dist/assets/getLocaleForTenant-DXpgdwm2.js +1 -0
  63. package/dist/assets/{index-uOMVm9H-.js → index-B3J9WxT7.js} +2 -2
  64. package/dist/assets/{index-CPjWwtCH.js → index-BNrt1EOu.js} +1 -1
  65. package/dist/assets/{index-gZhpjgMs.js → index-BZ0hEAE3.js} +1 -1
  66. package/dist/assets/{index-DDmCCF1m.js → index-BrvX8Bq4.js} +1 -1
  67. package/dist/assets/{index-Dqe0xDu6.js → index-Cf0JRE_u.js} +1 -1
  68. package/dist/assets/{index-CFknKb_z.js → index-CnDcHHGX.js} +1 -1
  69. package/dist/assets/{index-CXwNHESf.js → index-DbHK73QC.js} +1 -1
  70. package/dist/assets/{index-CuLyKa_Q.js → index-DtTeUJqK.js} +13970 -13965
  71. package/dist/assets/{lexical-BzDpQEY5.js → lexical-BvIUj_Gq.js} +1 -1
  72. package/dist/assets/{liveblocks-DxMhjnNF.js → liveblocks-B6veqs_8.js} +1 -1
  73. package/dist/assets/{lottie-_pZcYgWm.js → lottie-HMB6u1mD.js} +1 -1
  74. package/dist/assets/{mui-AVGOiy8R.js → mui-CvZ4Namd.js} +1 -1
  75. package/dist/assets/{pathToGoBack-WoDZmsPZ.js → pathToGoBack-BAEsrU0U.js} +1 -1
  76. package/dist/assets/{pdf--GzjqSbO.js → pdf-DTyc8UuT.js} +4 -4
  77. package/dist/assets/{pdf-lib-BWfnoXie.js → pdf-lib-HRxxOoqR.js} +1 -1
  78. package/dist/assets/{plaid-4b1bk5sk.js → plaid-DOxsEQPt.js} +1 -1
  79. package/dist/assets/{pusher-CQ2CZwKk.js → pusher-NGpa4s20.js} +1 -1
  80. package/dist/assets/{react-WLXYAyOc.js → react-B0Ke89Rd.js} +1 -1
  81. package/dist/assets/{react-AjeIz02D.js → react-BlxcdXL2.js} +1 -1
  82. package/dist/assets/{react-B15Vuz5r.js → react-CH6MMJtW.js} +1 -1
  83. package/dist/assets/{react-BjQnbjRz.js → react-CiknC4Jf.js} +1 -1
  84. package/dist/assets/{react-CMNl5tFI.js → react-RglhJ9zO.js} +1 -1
  85. package/dist/assets/{react-D0m8D_2j.js → react-S6dZMq1W.js} +1 -1
  86. package/dist/assets/{recharts-BBgS6uq0.js → recharts-CCZTRBr_.js} +1 -1
  87. package/dist/assets/{routePaths-Cu5maDQS.js → routePaths-BXH8zPZv.js} +1 -1
  88. package/dist/assets/{sentry-Dg7lI3nb.js → sentry-BW637Fua.js} +1 -1
  89. package/dist/assets/{url-CpEGpwjz.js → url-CCU74SLo.js} +1 -1
  90. package/dist/assets/{url-CtDlmImG.js → url-CQ6e4A8i.js} +1 -1
  91. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CGRLsc4l.js → useAiCfoDashboardSuggestedQuestionsChips-C2yPn_Vp.js} +1 -1
  92. package/dist/assets/useAskAiCfoHostNavButtonProps-aY04YP0S.js +1 -0
  93. package/dist/assets/useCashManagementBanner-mgRwIUZG.js +1 -0
  94. package/dist/assets/{useChargeCardPusherEvents-Drg4ddme.js → useChargeCardPusherEvents-D2Li6UoT.js} +1 -1
  95. package/dist/assets/{useDeviceId-CntVV2j2.js → useDeviceId-BEnHMBJt.js} +1 -1
  96. package/dist/assets/useEmailConnectResultRefresh-D1no2UPa.js +1 -0
  97. package/dist/assets/{useInitialThreadRequest-Q2ekueW0.js → useInitialThreadRequest-BMYYqer4.js} +1 -1
  98. package/dist/assets/{utils-CXbpoo9S.js → utils-BAwT1yty.js} +1 -1
  99. package/dist/assets/{withTransactionSidePanel-LIW64rRE.js → withTransactionSidePanel-CRqIqwQF.js} +3 -3
  100. package/dist/assets/{zeni-epic-state-D-kJk6oz.js → zeni-epic-state-DyOMcw4f.js} +7 -7
  101. package/dist/index.html +1 -1
  102. package/package.json +4 -4
  103. package/dist/assets/AddressRoutes-DCUsc3KF.js +0 -1
  104. package/dist/assets/AddressScreen-Bwb2AT1P.js +0 -9
  105. package/dist/assets/AiCfoScreen-CpThag2f.js +0 -22
  106. package/dist/assets/CompanyPassportScreen-BHfvnSz2.js +0 -1
  107. package/dist/assets/ConnectionAuthScreen-7rbaCMEB.js +0 -11
  108. package/dist/assets/CustomerOnboardingAuthScreen-B94Uv_Zm.js +0 -1
  109. package/dist/assets/DomesticWireDetailScreen-CqRrfvdB.js +0 -18
  110. package/dist/assets/DrawerScreen-Bilbbpvv.js +0 -1
  111. package/dist/assets/EntityDetailRoutes-DdlrWmJC.js +0 -1
  112. package/dist/assets/ExpenseAutomationRoutes-BA62t3yd.js +0 -25
  113. package/dist/assets/HubSpotOAuthCallbackScreen-vkwq6Ud6.js +0 -1
  114. package/dist/assets/MagicLinkRoutes-Cw9n9GKd.js +0 -72
  115. package/dist/assets/MagicLinkSignInScreen-ClvrxnEy.js +0 -12
  116. package/dist/assets/MobileAppDrawer-DqPaZqu1.js +0 -1
  117. package/dist/assets/NotFoundScreen-ByEXcHxY.js +0 -1
  118. package/dist/assets/NotificationRoutes-DLMlcNHg.js +0 -1
  119. package/dist/assets/OAuthConsentScreen-DldzTmZH.js +0 -1
  120. package/dist/assets/PandLWithForecastRoutes-Qj_06fIE.js +0 -1
  121. package/dist/assets/PerformanceRoutes-C6bkps9k.js +0 -1
  122. package/dist/assets/ReimbursementApprovalRoutes-BbtlGccW.js +0 -1
  123. package/dist/assets/RewardsRoutes-C2tRacuM.js +0 -1
  124. package/dist/assets/ScreenRoutes-Bn1XDy7H.js +0 -2
  125. package/dist/assets/SignOutScreen-CP3gVj5D.js +0 -9
  126. package/dist/assets/TaskListScreen-BbAwvgct.js +0 -9
  127. package/dist/assets/TaskRoutes-VDJ42Di4.js +0 -9
  128. package/dist/assets/TreasuryRoutes-DaqzfOKU.js +0 -37
  129. package/dist/assets/WiseConfirmationScreen-B18w4PVg.js +0 -12
  130. package/dist/assets/ZeniAccountStatementScreen-DX37lKuf.js +0 -9
  131. package/dist/assets/epic-BOukt2t4.js +0 -2
  132. package/dist/assets/getLocaleForTenant-BCxMcs6_.js +0 -1
  133. package/dist/assets/useAskAiCfoHostNavButtonProps-Bk_He0fB.js +0 -1
  134. package/dist/assets/useCashManagementBanner-DnJJ_3dp.js +0 -1
  135. package/dist/assets/useEmailConnectResultRefresh-C6v7HzT7.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-B6veqs_8.js";import{A as d}from"./AddressScreen-B9qIDuai.js";import i from"./NotFoundScreen-B35T6J3X.js";import"./sentry-BW637Fua.js";import{o as s,p as r}from"./core-D-w0syUt.js";import"./zeni-epic-state-DyOMcw4f.js";import"./recharts-CCZTRBr_.js";import"./index-DtTeUJqK.js";import"./mui-CvZ4Namd.js";import"./analytics-B6nQWxMm.js";import"./plaid-DOxsEQPt.js";import"./dnd-Dt7EosAi.js";import"./stripe-cKAAJElX.js";import"./lottie-HMB6u1mD.js";import"./lexical-BvIUj_Gq.js";import"./pdf-DTyc8UuT.js";import"./utils-BAwT1yty.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};
@@ -0,0 +1,9 @@
1
+ import{j as d}from"./liveblocks-B6veqs_8.js";import{a as h}from"./sentry-BW637Fua.js";import{h as T,u as _,g as E,i as j,j as B,n as D}from"./core-D-w0syUt.js";import{J as M,y as $,z as L,e as N,E as K,F,f as C,h as S,D as z,m as b,r as R}from"./index-DtTeUJqK.js";import{N4 as w,hY as U,eZ as G,N5 as O,c7 as V,N6 as q,lm as H}from"./zeni-epic-state-DyOMcw4f.js";import{n as J}from"./mui-CvZ4Namd.js";import Y from"./NotFoundScreen-B35T6J3X.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]="4cf7e38a-401f-4836-8475-2149cf5b238d",e._sentryDebugIdIdentifier="sentry-dbid-4cf7e38a-401f-4836-8475-2149cf5b238d")}catch{}})();const Z=J.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ `,Q=D((function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=G(e),a=t.roleMap!=null&&O(t.roleMap),r=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:r,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=w(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:r}}),(function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const r=i.state,n=R(r?.pathnameStackToGoBack);let s=n.poppedPathname??I();const u=r?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(s=`${s}?${f}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const r=W(a);e(H({addressType:c,addressToCreate:r})),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 de({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),r=_(),n=E(),{addressId:s,addressType:u}=j(),f=M(),k=$(),v=L.getSignedInUser(),[g,x]=h.useState(s==null),p=B((m=>s!=null?w(m,s).fetchState:"Not-Started")),A=N();if(v==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||(x(!0),r(U(s,!1)))}),[g,s,r]),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"?d.jsx(K,{fetchState:p,style:{backgroundColor:k.colors.grey5}}):s!=null&&p==="Error"?(a(`${I(1)}/new`,{replace:!0}),d.jsx(d.Fragment,{})):d.jsxs(d.Fragment,{children:[d.jsx(F,{analytics:C,onLoad:P}),d.jsx(Z,{windowSize:f,children:d.jsx(Q,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):d.jsx(Y,{})}const I=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},W=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{de as A,W as t};
@@ -0,0 +1,22 @@
1
+ import{j as u}from"./liveblocks-B6veqs_8.js";import{a as l}from"./sentry-BW637Fua.js";import{u as we,h as Pe,g as ye,j as K,i as Ee,n as Te}from"./core-D-w0syUt.js";import{Z as ve,de as Ae,z as Qe,J as _e,df as Oe,dg as Ue,bb as X,dh as ae,di as je,ba as oe,r as V,F as B,f as I,dj as R,dk as Fe,dl as Le,a3 as De,h as Be,a9 as Re,dm as Me,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,v as ze,b6 as He,ds as We}from"./index-DtTeUJqK.js";import{gp as Ye,eY as ne,eZ as Ze,iE as Je,Uj as Ke,fs as Xe,iO as et,iK as tt,e_ as M,fz as st,g8 as at,g9 as ot,g1 as nt,j2 as ee,g5 as te,ga as it,gb as rt,gc as lt,gd as dt,ge as ct,gf as ut}from"./zeni-epic-state-DyOMcw4f.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-CvZ4Namd.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-C2yPn_Vp.js";import{p as gt}from"./pathToGoBack-BAEsrU0U.js";import"./recharts-CCZTRBr_.js";import"./analytics-B6nQWxMm.js";import"./plaid-DOxsEQPt.js";import"./dnd-Dt7EosAi.js";import"./stripe-cKAAJElX.js";import"./lottie-HMB6u1mD.js";import"./lexical-BvIUj_Gq.js";import"./pdf-DTyc8UuT.js";import"./utils-BAwT1yty.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="71afd406-8740-4669-a731-7c6e023ab8c3",e._sentryDebugIdIdentifier="sentry-dbid-71afd406-8740-4669-a731-7c6e023ab8c3")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:A}=oe(x,m);g!=="answer"?I.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,We(A,i),c.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&He(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=ze(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{b(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{b(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Re(Me)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=ye(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=Ae();l.useEffect((()=>{a(Ye())}),[a]);const h=K((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=K((r=>Ze(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:re}=Oe({isFileUploadEnabled:e,tenantEmailDomain:w}),Q=Ue({currentTenant:m,currentChatSessionId:i,aiCfoView:h}),{isSuggestedQuestionsLoading:le,suggestedPromptQuestions:de}=St(),P=o.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;l.useEffect((()=>{const r=o.state;if(r?.[X]!==!0)return;d(!0);const f={...r};delete f[X],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,O]=l.useState(!1),[me,U]=l.useState(void 0),[pe,j]=l.useState(void 0),G=l.useRef(!1);l.useEffect((()=>{if(!G.current&&y!=null&&y!==""){const r=o.state;_(y),O($),U(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[y,$,o.state]);const he=l.useCallback((()=>{_(null),O(!1),U(void 0),j(void 0),p(o.pathname,{replace:!0,state:ae(o.state)})}),[o.pathname,o.state,p]),q=l.useMemo((()=>new URLSearchParams(o.search)),[o.search]),N=q.get("ref")??P?.aiCfoRef,F=q.get("emailRefId")??P?.aiCfoEmailRefId,z=l.useRef(!1);l.useEffect((()=>{z.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Je("controller",s.userId,F,"MONTH_END_EMAIL")),z.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),O(!0),U(void 0),j(void 0),a(Ke()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:H}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,W=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",Y=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),Z=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(Z,i),fe=ge.length===0;l.useEffect((()=>{C||g||p("../dashboard",{state:{...o.state,message:"open_ai_cfo_drawer"}})}),[C,g,p,o.state]);const Ce=l.useCallback((()=>{const r=V(o.state?.pathnameStackToGoBack),f=m.tenantEmailDomain;p(r.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...o.state,pathnameStackToGoBack:r.newStack}})}),[m.tenantEmailDomain,o.state,p]);l.useEffect((()=>{i!=null&&t!==i&&p(`../ai-cfo/${i}`,{state:{...o.state}})}),[i,t]),l.useEffect((()=>{t!=null&&i==null&&t!=="new_chat"&&t!=="explore"&&a(Xe({sessionId:t,agentId:"controller"}))}),[]);const be=l.useMemo((()=>({events:H.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[H]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&W!=="In-Progress"&&Y&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[W,Y,i,s,a]);const J=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const Ie=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(bt,{children:[u.jsx(B,{analytics:I,onLoad:J}),Q.drawerElement,u.jsx(It,{children:u.jsx(se,{children:u.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(M(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:I,onLoad:J}):null,u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:I,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&Q.drawerElement,u.jsx(ft,{...be,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:Z,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>d(!0),userId:s.userId,setIsAiCfoOpen:n,navigate:p,sessionFromUrl:t,location:o,isSubmitting:Ie,isEmptyChatWithSession:fe,currentTenant:m,emailLinkQuestion:ce??void 0,autoSubmitEmailLinkQuestion:ue,onEmailLinkQuestionProcessed:he,routedInitialQuestionSource:me,routedInitialQuestionSuggestionIndex:pe,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:re,onUploadPromoClose:A,exploreSuggestedPromptQuestions:de,exploreSuggestedPromptQuestionsLoading:le}),S&&g?u.jsx(mt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:kt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:u.jsx(se,{onClick:r=>r.stopPropagation(),children:u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})})}):null]}),S&&!g?u.jsx(Fe,{open:S,onClose:()=>d(!1),children:u.jsx(Le,{children:ke})}):null]})},se=k(pt)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,Ct=k.div`
6
+ height: 100vh;
7
+ width: 100%;
8
+ `,bt=k.div`
9
+ height: 100vh;
10
+ width: 100%;
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 0;
14
+ `,It=k.div`
15
+ flex: 1;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ `,kt=k(ht)`
20
+ box-shadow: ${({theme:e})=>e.colors.elevation2};
21
+ color: ${({theme:e})=>e.colors.grey4};
22
+ `;export{Rt as default};
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-DxMhjnNF.js";import{a as v}from"./sentry-Dg7lI3nb.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-lpqyfl_C.js";import{eW as V,Qk as A,Q0 as h,zG as E,zy as q,zC as R,zr as Q,Q2 as K,zI as ae,zu as G,zL as H,zH as C}from"./zeni-epic-state-D-kJk6oz.js";import{z as O,a9 as M,bL as oe,ag as P,bC as J,bM as le,y as X,B as Y,bN as pe,bO as se}from"./index-CuLyKa_Q.js";import"./mui-AVGOiy8R.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-BFSR8IP5.js";import re from"./NotFoundScreen-ByEXcHxY.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]="c13bf017-c9d7-4ee5-9182-d9a8860ba617",e._sentryDebugIdIdentifier="sentry-dbid-c13bf017-c9d7-4ee5-9182-d9a8860ba617")}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(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(M(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]),O.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(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(M(le)),de=()=>{const e=y((o=>V(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=J(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]),O.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=P(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(H(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(G(!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=P(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(H(!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}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(u(!0),p(G(!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
+ import{j as c}from"./liveblocks-B6veqs_8.js";import{a as v}from"./sentry-BW637Fua.js";import{h as U,g as B,u as j,j as y,N as $,n as k,i as W,o as te,p as D}from"./core-D-w0syUt.js";import{eZ as O,Qs as A,Q8 as h,zO as E,zG as Q,zK as R,zz as q,Qa as K,zQ as ae,zC as G,zT as M,zP as C}from"./zeni-epic-state-DyOMcw4f.js";import{z as V,a9 as Z,bL as oe,ag as P,bC as H,bM as le,y as J,E as X,bN as pe,bO as se}from"./index-DtTeUJqK.js";import"./mui-CvZ4Namd.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-Dds_onx1.js";import re from"./NotFoundScreen-B35T6J3X.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]="ee09f181-1c05-4615-93e5-ce2229219914",e._sentryDebugIdIdentifier="sentry-dbid-ee09f181-1c05-4615-93e5-ce2229219914")}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(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(Z(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=>O(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($,{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(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(Z(le)),de=()=>{const e=y((o=>O(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(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=>O(s)));Y();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($,{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=P(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(M(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(G(!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=P(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(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function z(){const e=y((t=>O(t))),{isApprovalRulesV3Enabled:p}=H(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=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Y(),v.useEffect((()=>{l||(u(!0),p(G(!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 xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx(z,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx(z,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as Y,l as ia,o as oa,p as y}from"./core-lpqyfl_C.js";import{eW as W,PC as Ge,bs as wt,Kt as la,bq as At,bJ as pe,PD as Bt,yY as Ct,Ab as $e,zv as sa,bn as Ee,PE as ra,PF as ca,c7 as da,PG as ua,kA as xt,PH as Et,PI as Dt,AM as Me,zb as Be,PJ as pa,yM as tt,PK as ma,ER as ba,yQ as ha,yW as jt,PL as fe,PM as Oe,Ac as Ne,PN as ga,PO as Sa,Af as ze,PP as ya,As as fa,PQ as Pt,zY as at,A1 as va,PR as Ia,PS as ue,PT as Tt,PU as Ft,PV as Rt,gq as ka,zg as Le,cC as Vt,PW as wa,fy as Aa,PX as Ba,PY as Ca,fD as $t,fB as Lt,PZ as Ze,P_ as xa,P$ as Ea,Nn as Qe,Q0 as Da,No as oe,Np as We,Q1 as ja,Q2 as Pa,Q3 as Ta,A3 as nt,A0 as Fa,Q4 as Ra,Q5 as Va,Q6 as $a,zO as La,Q7 as Ua,Q8 as _a,Q9 as Ga,cq as Ut,cS as _t,kL as Ma,bP as Oa,bo as Gt,bQ as Mt,y2 as Na,Qa as za,EE as Za,EK as Qa,uo as Wa,Ad as Ha,AT as qa,kY as ye,Qb as Ka,Qc as Ot,lq as Ja,kS as Nt,lb as zt,la as it,bE as be,bO as Ya,Qd as Xa,Qe as ve,jv as en,Qf as ot,Qg as tn,jz as an,jU as nn,B5 as on,Qh as ln,lj as sn,AX as rn,Qi as lt,A$ as cn,B4 as dn,B1 as un,AV as pn,Qj as Zt,z5 as mn,Qk as bn,Ql as hn,gi as gn,gh as Sn,gg as yn,k$ as fn,lh as st,ls as vn,rQ as In,l8 as kn,AZ as wn,jF as An,lx as Bn,Qm as Cn,jx as xn,rH as En,Qn as Dn,zU as jn,bK as Pn,bt as Tn,Mb as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-D-kJk6oz.js";import{y as me,z as $,T as Ie,a0 as He,A as le,X as S,aS as Ce,B as re,o as x,_ as De,c as D,bh as Un,r as Q,a4 as qe,s as E,J as ke,bi as rt,bj as ct,bk as _n,al as Gn,F as Mn,aM as On,C as Qt,O as je,G as Ke,bl as Nn,au as Wt,bm as zn,Z as Zn,f as Ht,a9 as Qn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Jn,bs as Yn,bt as Xn,bu as ei,bv as ti,w as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-CuLyKa_Q.js";import{n as U,S as ri}from"./mui-AVGOiy8R.js";import{A as dt}from"./AddressScreen-Bwb2AT1P.js";import{g as ie,a as Pe,i as qt,V as Je,b as Ye,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-CqRrfvdB.js";import{a as f}from"./sentry-Dg7lI3nb.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-Bk_He0fB.js";import{u as Kt}from"./useInitialThreadRequest-Q2ekueW0.js";import xe from"./NotFoundScreen-ByEXcHxY.js";import{D as pi}from"./DrawerScreen-Bilbbpvv.js";import{M as Jt}from"./MobileAppDrawer-DqPaZqu1.js";import{F as Yt}from"./FeaturePreviewScreen-Bf8p9qA6.js";import{S as Te}from"./SetupPagesScreen-DGqDTbQK.js";import{B as mi}from"./BillPayApprovalRoutes-B4banQ09.js";import{FallBackRoute as bi}from"./ScreenRoutes-Bn1XDy7H.js";import"./recharts-BBgS6uq0.js";import"./analytics-BVZAGmSf.js";import"./plaid-4b1bk5sk.js";import"./dnd-xbSIuUzo.js";import"./stripe-cKAAJElX.js";import"./lottie-_pZcYgWm.js";import"./lexical-BzDpQEY5.js";import"./pdf--GzjqSbO.js";import"./utils-CXbpoo9S.js";import"./analyticsHelper-DZApVryU.js";import"./routePaths-Cu5maDQS.js";import"./BusinessVerificationPageScreen-Bsm9CkGv.js";import"./ReimbursementApprovalRuleDetailScreen-BFSR8IP5.js";import"./getLocaleForTenant-BCxMcs6_.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]="ca48deac-1c40-4791-8d1d-5fd14d0ceb75",e._sentryDebugIdIdentifier="sentry-dbid-ca48deac-1c40-4791-8d1d-5fd14d0ceb75")}catch{}})();const hi=Y((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Q(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=Ee(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}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(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(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Pe(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Q(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(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(Un);function gi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=Ie(),o=I((z=>W(z))),s=I((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,B]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:P,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=P(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=P(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=P(S.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(Ce.zeniAssistConfig),w=la(o),N=At(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=P(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=P(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,N,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(B(!0),t($e(!1,L,F,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,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(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Ue=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Qt(100,58)},pt=Y((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.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=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(On);function A({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.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:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),B=I((R=>W(R))),[C,_]=f.useState(!1),[P,G]=f.useState(!1),[L,k]=f.useState(!1),[H,O]=f.useState(),w=I((R=>Oe(R,m,g,n)));let N=w.fetchState,M=w.file,F=w.showAutofill;const q=I((R=>Ge(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{N==="Not-Started"&&(u&&P?G(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(Ct(n,h,j,!1)),P||(G(!0),t($e(!1,h,j,b,n)))),u&&!P&&(G(!0),t($e(!1,h,j,b,n)))}),[C,P,u,n,t]);const z={onOkClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Q(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(B.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,B.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:O,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Ai,{children:Ue.overwriteTitle}),descriptionComponent:a.jsx(Bi,{children:Ue.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:O,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(ki,{children:`${Ue.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-B6veqs_8.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as J,l as ia,o as oa,p as y}from"./core-D-w0syUt.js";import{eZ as W,PK as Ge,bs as wt,KB as la,bq as Bt,bJ as pe,PL as At,z4 as Ct,Aj as $e,zD as sa,bn as Ee,PM as ra,PN as ca,c7 as da,PO as ua,kG as xt,PP as Et,PQ as Dt,AU as Me,zj as Ae,PR as pa,yU as tt,PS as ma,EZ as ba,yY as ha,z2 as jt,PT as fe,PU as Oe,Ak as Ne,PV as ga,PW as Sa,An as ze,PX as ya,AA as fa,PY as Tt,A4 as at,A9 as va,PZ as ka,P_ as ue,P$ as Pt,Q0 as Ft,Q1 as Rt,gt as Ia,zo as Le,cC as Vt,Q2 as wa,fB as Ba,Q3 as Aa,Q4 as Ca,fG as $t,fE as Lt,Q5 as Qe,Q6 as xa,Q7 as Ea,Nv as Ze,Q8 as Da,Nw as oe,Nx as We,Q9 as ja,Qa as Ta,Qb as Pa,Ab as nt,A8 as Fa,Qc as Ra,Qd as Va,Qe as $a,zW as La,Qf as Ua,Qg as _a,Qh as Ga,cq as Ut,cS as _t,kR as Ma,bP as Oa,bo as Gt,bQ as Mt,ya as Na,Qi as za,EM as Qa,ES as Za,uw as Wa,Al as Ha,A$ as qa,l2 as ye,Qj as Ka,Qk as Ot,lw as Ya,kY as Nt,lh as zt,lg as it,bE as be,bO as Ja,Ql as Xa,Qm as ve,jB as en,Qn as ot,Qo as tn,jF as an,j_ as nn,Bd as on,Qp as ln,lp as sn,B3 as rn,Qq as lt,B7 as cn,Bc as dn,B9 as un,B1 as pn,Qr as Qt,zd as mn,Qs as bn,Qt as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rY as kn,le as In,B5 as wn,jL as Bn,lD as An,Qu as Cn,jD as xn,rP as En,Qv as Dn,A0 as jn,bK as Tn,bt as Pn,Mj as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-DyOMcw4f.js";import{y as me,z as $,e as ke,a0 as He,A as le,c as S,aS as Ce,E as re,o as x,F as De,f as D,bh as Un,r as Z,a4 as qe,v as E,J as Ie,bi as rt,bj as ct,bk as _n,al as Gn,K as Mn,aM as On,H as Zt,O as je,M as Ke,bl as Nn,au as Wt,bm as zn,_ as Qn,h as Ht,a9 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Yn,bs as Jn,bt as Xn,bu as ei,bv as ti,B as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-DtTeUJqK.js";import{n as U,S as ri}from"./mui-CvZ4Namd.js";import{A as dt}from"./AddressScreen-B9qIDuai.js";import{g as ie,a as Te,i as qt,V as Ye,b as Je,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-DV-LDQl5.js";import{a as f}from"./sentry-BW637Fua.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-aY04YP0S.js";import{u as Kt}from"./useInitialThreadRequest-BMYYqer4.js";import xe from"./NotFoundScreen-B35T6J3X.js";import{D as pi}from"./DrawerScreen-CLmFnWBR.js";import{M as Yt}from"./MobileAppDrawer-BSqYxsX2.js";import{F as Jt}from"./FeaturePreviewScreen-DQZK8Tkd.js";import{S as Pe}from"./SetupPagesScreen-BoNxDLXk.js";import{B as mi}from"./BillPayApprovalRoutes-pStG307K.js";import{FallBackRoute as bi}from"./ScreenRoutes-ZHVecYPB.js";import"./recharts-CCZTRBr_.js";import"./analytics-B6nQWxMm.js";import"./plaid-DOxsEQPt.js";import"./dnd-Dt7EosAi.js";import"./stripe-cKAAJElX.js";import"./lottie-HMB6u1mD.js";import"./lexical-BvIUj_Gq.js";import"./pdf-DTyc8UuT.js";import"./utils-BAwT1yty.js";import"./analyticsHelper-Og8Rmx5y.js";import"./routePaths-BXH8zPZv.js";import"./BusinessVerificationPageScreen-C7ez20uI.js";import"./ReimbursementApprovalRuleDetailScreen-Dds_onx1.js";import"./getLocaleForTenant-DXpgdwm2.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]="0be7dd32-4439-4280-981a-8fd05967fffd",e._sentryDebugIdIdentifier="sentry-dbid-0be7dd32-4439-4280-981a-8fd05967fffd")}catch{}})();const hi=J((function(e,t){const l=Ge(e,t.billId),n=$.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=Ee(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}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(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(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(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(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(Un);function gi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=k((z=>W(z))),s=k((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(Ce.zeniAssistConfig),w=la(o),N=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,N,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,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(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Ue=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=J((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.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=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(On);function B({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=me(),i=$.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:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k((R=>W(R))),[C,_]=f.useState(!1),[T,G]=f.useState(!1),[L,I]=f.useState(!1),[H,O]=f.useState(),w=k((R=>Oe(R,m,g,n)));let N=w.fetchState,M=w.file,F=w.showAutofill;const q=k((R=>Ge(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{N==="Not-Started"&&(u&&T?G(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:O,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Ue.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Ue.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:I,setPayload:O,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(Ii,{children:`${Ue.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const mt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -6,14 +6,14 @@ import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,i as a
6
6
  position: absolute;
7
7
  display: flex;
8
8
  align-items: center;
9
- `,Ii=U.div`
9
+ `,ki=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
- `,ki=U(Ke.StandardMedium)``,wi=U((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
16
+ `,Ii=U(Ke.StandardMedium)``,wi=U((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
17
17
  color: ${e=>e.theme.colors.hero};
18
18
  height: ${x.sp3};
19
19
  width: ${x.sp3};
@@ -64,20 +64,20 @@ import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,i as a
64
64
  flex-direction: column;
65
65
  width: ${e=>`${Si.containerWidth.value(e.windowSize)}%`};
66
66
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
- `,Ai=U(Ke.H6Regular)`
67
+ `,Bi=U(Ke.H6Regular)`
68
68
  margin-top: ${x.sp7};
69
69
  padding-left: ${x.sp8};
70
70
  padding-right: ${x.sp8};
71
71
  color: ${e=>e.theme.colors.primary};
72
72
  word-break: break-word;
73
- `,Bi=U(Ke.LargeRegularSp)`
73
+ `,Ai=U(Ke.LargeRegularSp)`
74
74
  color: ${e=>e.theme.colors.hero};
75
75
  padding-left: ${x.sp8};
76
76
  padding-right: ${x.sp8};
77
77
  margin-bottom: 30px;
78
78
  margin-top: ${x.sp4};
79
79
  white-space: pre-line;
80
- `,Ci=Y((function(e,t){return{billsReviewView:Pt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(Ia(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(va());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}}))(zn);function xi(){const e=K(),t=I((n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:l}=I((n=>Pt(n)));return f.useEffect((()=>{t!=="Completed"&&l.length!==0||e("./")}),[t,l.length]),a.jsx(Ci,{navigate:e,analytics:D})}const ne=Ea(),ea="bulk-operation-update",_e="bill-approval-rule-update",{spendManagement:Ei,common:ht}=je.getLocalizedStrings(),gt=Ei.billPay.bulkActions,Di=U.div`
80
+ `,Ci=J((function(e,t){return{billsReviewView:Tt(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(va());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}}))(zn);function xi(){const e=K(),t=k((n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:l}=k((n=>Tt(n)));return f.useEffect((()=>{t!=="Completed"&&l.length!==0||e("./")}),[t,l.length]),a.jsx(Ci,{navigate:e,analytics:D})}const ne=Ea(),ea="bulk-operation-update",_e="bill-approval-rule-update",{spendManagement:Ei,common:ht}=je.getLocalizedStrings(),gt=Ei.billPay.bulkActions,Di=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-DxMhjnNF.js";import{h as K,u as se,g as J,i as a
85
85
  flex-direction: column;
86
86
  align-items: center;
87
87
  background-color: ${e=>e.theme.colors.grey4};
88
- `,ji=Y((function(e,t){const l=$.getSignedInUser(),n=Ee(l),c=Rt(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=Qe(e,"common"),s=e.tenantState.currentTenantId,i=W(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,h=c.fetchState,g=Da(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState: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(Tt(o))},onSubtabChange:o=>{e(ue()),e(Ft(o))},onTransactionClick:(o,s)=>{const i=Pe(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(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(Ua(o))},onReloadTransactions:()=>{e(Le(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(La(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e($a({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(Va({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Ra(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Fa(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(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(_e)&&e(Pa(!1))},onEventReceived:o=>{o===ea&&e(ja())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(We({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}}))(Qn(Wn));function Pi(){const e=K(),t=se(),l=J(),n=ke(),c=l.state,r=Ie(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=ia("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ue())})),[]);const p=$.getSignedInUser(),m=I((T=>W(T))),{areTenantIdsInSync:h}=Zn(),[g,b]=f.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:j}=v(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:B}=v(S.isBillPayCommentingEnabled),{isFeatureEnabled:C}=v(S.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=v(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:P}=v(S.isBillPayBulkActionEnabled),{isFeatureEnabled:G}=v(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:L}=v(S.isBillPayDetectInsufficientFundsEnabled),k=I((T=>Rt(T,ne,P,p?.userId))),{isFeatureEnabled:H}=v(S.isDebitCardFeatureEnabled),O=k.fetchState,{isAiCfoAccessEnabled:w,onAskAiCfoClick:N}=Xe({mobileExploreReferrer:"Bills List"});He({isDataReady:O==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,F=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=I((T=>ka(T.companyState,m.companyId))),X=q?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!g&&F&&h&&(b(!0),t(Le(ne,!0,j,G)))}),[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const z=(T,de)=>{t(xa({uiState:{sortKey:T,sortOrder:de},period:ne}))},ee=Vt(r?.loggedInUserRoleMap),R=pe(r?.loggedInUserRoleMap),ce=T=>{o(T)},{billsProcessed:Z,billsProcessing:we}=I((T=>wa(T)));f.useEffect((()=>{Z===we&&s!=null&&(t(Aa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:Z>1?gt.bills:gt.bill},{variableName:"_has_",variableValue:Z>1?ht.texts.have:ht.texts.has},{variableName:"_action_",variableValue:Ba(s)}]})),t(Ca()),setTimeout((()=>{t(Le(ne,!0,j,!0,G))}),3e3),i(null))}),[Z,we]);const ta={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${ea}`,`private-encrypted-${m.companyId}.${_e}`]:[],eventCallback:(T,de,et)=>{T.endsWith(_e)?et.onBillPayApprovalRulesEventReceived?.(T):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(T))}},aa=$t(H,m),na=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Yt,{}):F?a.jsxs(a.Fragment,{children:[O==="Completed"?a.jsx(De,{analytics:D,onLoad:T=>(de=>de.trackPageLoaded(Ht.Event.billPayHome))(T)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Jt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new Qt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Fi,{onClick:T=>T.stopPropagation(),children:a.jsx(xi,{})})}),a.jsx(ji,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:B,isReimbursementCommentingEnabled:C,period:ne,isAdmin:!1,uiState:k.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:P,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:k.isDownloadEnabled,connectedAccountProvider:X,bulkSubmissionLimit:k.billBulkSubmissionLimit,bulkSubmissionFetchState:k.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:k.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:G,isDetectInsufficientFundsEnabled:L,isAiCfoAccessEnabled:w,onAskAiCfoClick:N,...ta})]})]}):M===!0&&R===!0?a.jsx(te,{to:"../setup"}):r!=null&&Ze(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:O}):a.jsx(xe,{})}const Ti=e=>`/${e}/bills/setup`,Fi=U(ri)`
88
+ `,ji=J((function(e,t){const l=$.getSignedInUser(),n=Ee(l),c=Rt(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=W(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,h=c.fetchState,g=Da(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState: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(Pt(o))},onSubtabChange:o=>{e(ue()),e(Ft(o))},onTransactionClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Pi(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(Ua(o))},onReloadTransactions:()=>{e(Le(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(La(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e($a({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(Va({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Ra(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Fa(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(Pa()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(_e)&&e(Ta(!1))},onEventReceived:o=>{o===ea&&e(ja())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(We({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}}))(Zn(Wn));function Ti(){const e=K(),t=se(),l=Y(),n=Ie(),c=l.state,r=ke(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=ia("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Pt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ue())})),[]);const p=$.getSignedInUser(),m=k((P=>W(P))),{areTenantIdsInSync:h}=Qn(),[g,b]=f.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:j}=v(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=v(S.isBillPayCommentingEnabled),{isFeatureEnabled:C}=v(S.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=v(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=v(S.isBillPayBulkActionEnabled),{isFeatureEnabled:G}=v(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:L}=v(S.isBillPayDetectInsufficientFundsEnabled),I=k((P=>Rt(P,ne,T,p?.userId))),{isFeatureEnabled:H}=v(S.isDebitCardFeatureEnabled),O=I.fetchState,{isAiCfoAccessEnabled:w,onAskAiCfoClick:N}=Xe({mobileExploreReferrer:"Bills List"});He({isDataReady:O==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,F=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=k((P=>Ia(P.companyState,m.companyId))),X=q?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!g&&F&&h&&(b(!0),t(Le(ne,!0,j,G)))}),[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const z=(P,de)=>{t(xa({uiState:{sortKey:P,sortOrder:de},period:ne}))},ee=Vt(r?.loggedInUserRoleMap),R=pe(r?.loggedInUserRoleMap),ce=P=>{o(P)},{billsProcessed:Q,billsProcessing:we}=k((P=>wa(P)));f.useEffect((()=>{Q===we&&s!=null&&(t(Ba({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:Q>1?gt.bills:gt.bill},{variableName:"_has_",variableValue:Q>1?ht.texts.have:ht.texts.has},{variableName:"_action_",variableValue:Aa(s)}]})),t(Ca()),setTimeout((()=>{t(Le(ne,!0,j,!0,G))}),3e3),i(null))}),[Q,we]);const ta={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${ea}`,`private-encrypted-${m.companyId}.${_e}`]:[],eventCallback:(P,de,et)=>{P.endsWith(_e)?et.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(P))}},aa=$t(H,m),na=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Jt,{}):F?a.jsxs(a.Fragment,{children:[O==="Completed"?a.jsx(De,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Ht.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Yt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Fi,{onClick:P=>P.stopPropagation(),children:a.jsx(xi,{})})}),a.jsx(ji,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:A,isReimbursementCommentingEnabled:C,period:ne,isAdmin:!1,uiState:I.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:X,bulkSubmissionLimit:I.billBulkSubmissionLimit,bulkSubmissionFetchState:I.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:I.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:G,isDetectInsufficientFundsEnabled:L,isAiCfoAccessEnabled:w,onAskAiCfoClick:N,...ta})]})]}):M===!0&&R===!0?a.jsx(te,{to:"../setup"}):r!=null&&Qe(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:O}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=U(ri)`
89
89
  display: flex;
90
90
  min-height: 100%;
91
91
  flex-direction: column;
92
- `,{common:{currency:Se},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=je.getLocalizedStrings(),$i=Y((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=Q(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Qe(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ee(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Vi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Oa(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,v=h.add(b,"month").isAfter(g),j=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Mt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),B=W(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(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:B.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:j,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(Nt(d,!1)),e(zt({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(ze(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Ne(i))},onSaveChangesToLocalStore:(i,d,p,m,h)=>{const g=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ja({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Me("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Ot("draft"))},reviewBillDetails:()=>{const i=Li(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(fe({billId:i}))},clearBillPayReviewLocalState:()=>e(Ka()),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(ye(!1,i));const d=Ui(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ye(!1,i));const d=_i(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ye(!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(fe({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(jt(l))},onAttachmentClick:(i,d)=>{const p=Pe(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=Q(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ie(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(We({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=Jn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Ha(!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(Wa("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Qa(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Za(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Na("bill_pay","bill_pay_detail")),e(za({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function St(){const e=K(),t=J(),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:v}=r(S.isOurDisabled),{isFeatureEnabled:j}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:B}=u(Ce.zeniAccountsConfig),C=_a(B),{configValue:_}=u(Ce.sameDayAchDisablementConfig),P=Ga(_),G=$.getSignedInUser(),L=I((Z=>W(Z))),k=I((Z=>Oe(Z,m,g,n))),H=Kt(L?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:O,onAskAiCfoClick:w}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:k.fetchState==="Completed"});const N=L.companyId??$.getSignedInUserTenant(c)?.companyId,M=!!L.companyZeniAccountInfo?.info?.isZeniAccountEnabled,F=Ie(),q=Ut(F?.loggedInUserRoleMap),X=_t(F?.loggedInUserRoleMap),z=pe(F?.loggedInUserRoleMap),ee=At(L.userRole);if(f.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),G==null)throw Error("Can't access address page without signing in...");const R=I((Z=>Ma(Z.accountState,Z.accountListState,"billPayAccountList"))),ce={pathname:"../",search:t.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?a.jsx(te,{to:ce}):k.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:k.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:Z=>(we=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&we.trackBillPayEditBill(n,k.isRecurring)})(Z)}),a.jsx($i,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:L,billId:n,companyId:N,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:R,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:v,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:M,hasZeniAccountsAdminAccess:q,isZeniAccountsUser:X,isBillPayAdmin:z,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:P,isAiCfoAccessEnabled:O,onAskAiCfoClick:w})]})}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},Li=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},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/ach`),n},_i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},V="paymentDetails",Gi=(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()):Gt(),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[V]?.paymentDate?be(t[V].paymentDate.toString()):void 0,paymentType:t[V]?.paymentType!=null?t[V]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[V]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[V]?.paymentType?.method!=null&&t[V].paymentType.method.includes(Ya)&&u?.vendorCurrencyCode===Se.currencyCode&&c?t[V]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[V]?.recurringPaymentType?.selectedOption===Ri.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[V]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[V]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[V]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[V]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[V]?.recurringPaymentDetails?.startDate?be(t[V]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[V]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[V]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[V]?.recurringPaymentDetails?.updateRecurringBills},h=Mi(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}},Mi=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Kn(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},Oi=U.div`
92
+ `,{common:{currency:Se},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=je.getLocalizedStrings(),$i=J((function(e,t){const l=$.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=Ee(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Vi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Oa(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,v=h.add(b,"month").isAfter(g),j=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Mt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),A=W(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(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:j,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(Nt(d,!1)),e(zt({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(ze(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Ne(i))},onSaveChangesToLocalStore:(i,d,p,m,h)=>{const g=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ya({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Me("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Ot("draft"))},reviewBillDetails:()=>{const i=Li(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(fe({billId:i}))},clearBillPayReviewLocalState:()=>e(Ka()),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(ye(!1,i));const d=Ui(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ye(!1,i));const d=_i(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(ye(!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(fe({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(jt(l))},onAttachmentClick:(i,d)=>{const p=Te(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(We({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=Yn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Ha(!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(Wa("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Qa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Na("bill_pay","bill_pay_detail")),e(za({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Hn);function St(){const e=K(),t=Y(),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:v}=r(S.isOurDisabled),{isFeatureEnabled:j}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(Ce.zeniAccountsConfig),C=_a(A),{configValue:_}=u(Ce.sameDayAchDisablementConfig),T=Ga(_),G=$.getSignedInUser(),L=k((Q=>W(Q))),I=k((Q=>Oe(Q,m,g,n))),H=Kt(L?.companyId,{clearParams:I.fetchState==="Completed"}),{isAiCfoAccessEnabled:O,onAskAiCfoClick:w}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:I.fetchState==="Completed"});const N=L.companyId??$.getSignedInUserTenant(c)?.companyId,M=!!L.companyZeniAccountInfo?.info?.isZeniAccountEnabled,F=ke(),q=Ut(F?.loggedInUserRoleMap),X=_t(F?.loggedInUserRoleMap),z=pe(F?.loggedInUserRoleMap),ee=Bt(L.userRole);if(f.useEffect((()=>{n!=null&&l(At(n))}),[n]),G==null)throw Error("Can't access address page without signing in...");const R=k((Q=>Ma(Q.accountState,Q.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(De,{analytics:D,onLoad:Q=>(we=>{n!=null&&I.deleteStatus.fetchState!=="Completed"&&we.trackBillPayEditBill(n,I.isRecurring)})(Q)}),a.jsx($i,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:L,billId:n,companyId:N,billDetailsView:I,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:R,isInternationalPaymentShaVsOurEnabled:i,vendor:I.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:v,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:M,hasZeniAccountsAdminAccess:q,isZeniAccountsUser:X,isBillPayAdmin:z,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:O,onAskAiCfoClick:w})]})}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},Li=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},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/ach`),n},_i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},V="paymentDetails",Gi=(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()):Gt(),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[V]?.paymentDate?be(t[V].paymentDate.toString()):void 0,paymentType:t[V]?.paymentType!=null?t[V]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[V]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[V]?.paymentType?.method!=null&&t[V].paymentType.method.includes(Ja)&&u?.vendorCurrencyCode===Se.currencyCode&&c?t[V]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[V]?.recurringPaymentType?.selectedOption===Ri.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[V]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[V]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[V]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[V]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[V]?.recurringPaymentDetails?.startDate?be(t[V]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[V]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[V]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[V]?.recurringPaymentDetails?.updateRecurringBills},h=Mi(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}},Mi=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Kn(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},Oi=U.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,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
- `,Ni=Y((function(e,t){const{vendorId:l,billId:n}=t,c=ve(e,l),r=Oe(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(nn(s))},onSaveHandler:()=>{e(an(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(tn({data:i}))},onCancel:()=>{(()=>{const s=Q(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Ye(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(en({fetchState:"Not-Started"}));const s=Q(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Yn);function zi(){const e=K(),t=J(),l=ke(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=$.getSignedInUser(),s=I((g=>W(g))),i=Q(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=I((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(Oi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Ni,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Zi=U.div`
101
+ `,Ni=J((function(e,t){const{vendorId:l,billId:n}=t,c=ve(e,l),r=Oe(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(nn(s))},onSaveHandler:()=>{e(an(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(tn({data:i}))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Je(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(en({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Jn);function zi(){const e=K(),t=Y(),l=Ie(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=$.getSignedInUser(),s=k((g=>W(g))),i=Z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k((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(Oi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(Ni,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Qi=U.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,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
- `,Qi=Y((function(e,t){const{vendorId:l}=t,n=ve(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=ln(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[sn(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(pn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(dn(s)),p&&e(un(i,d))},onCurrencyUpdated:(s,i,d)=>{e(cn(s,i,d,!1))},onCancel:()=>{(()=>{const s=Q(c.state?.pathnameStackToGoBack),i=s.poppedPathname??vt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Ye(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(rn({fetchState:"Not-Started"}));const s=Q(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??vt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Xn);function Wi(){const e=K(),t=J(),l=ke(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=$.getSignedInUser(),s=I((C=>W(C))),i=Q(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=I((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),h=I((C=>n!=null?C.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(ye(!1,n)),p(!0))}),[d,g,n]);const[b,v]=f.useState(!1);f.useEffect((()=>{b||g==="In-Progress"||(v(!0),r(on(c,n)))}),[b,g,r]);const j=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",B=I((C=>ve(C,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return j==="billDetail"&&B.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:B.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(Je,{vendorId:n,billId:c}),a.jsx(Qi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:j})]})}const vt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},It=U.div`
110
+ `,Zi=J((function(e,t){const{vendorId:l}=t,n=ve(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=ln(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[sn(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(pn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(dn(s)),p&&e(un(i,d))},onCurrencyUpdated:(s,i,d)=>{e(cn(s,i,d,!1))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??vt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Je(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(rn({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??vt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Xn);function Wi(){const e=K(),t=Y(),l=Ie(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=$.getSignedInUser(),s=k((C=>W(C))),i=Z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=k((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),h=k((C=>n!=null?C.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(ye(!1,n)),p(!0))}),[d,g,n]);const[b,v]=f.useState(!1);f.useEffect((()=>{b||g==="In-Progress"||(v(!0),r(on(c,n)))}),[b,g,r]);const j=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=k((C=>ve(C,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return j==="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(Qi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:j})]})}const vt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},kt=U.div`
111
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-DxMhjnNF.js";import{h as K,u as se,g as J,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
- `,Hi=Y((function(e,t){const l=$.getSignedInUser(),n=Zt(e,t.billId),c=bn(e),r=Ee(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Mt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics: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(fe({}))},saveBillDetails:(o,s)=>{o&&e(Dt({billId:n,data:s})),e(Me(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Et({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Ot("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Pe(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}}))(ti);function kt(){const e=K(),t=se(),l=J(),{billId:n}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(S.isBillPayDetectInsufficientFundsEnabled),o=ke(),s=$.getSignedInUser(),{isFeatureEnabled:i}=c(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(S.isBillPayCommentingEnabled),m=Q(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(S.isRecurringBillsFeatureEnabled),b=I((B=>W(B))),v=I((B=>Zt(B,n))),j=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 B=v.vendor?.name,C=v.vendor?.id,_=v.totalAmount.amount,P=v.recipientTotalAmount.amount,G=v.invoiceNumber;B&&C&&t(mn(B,C,_,P,G,n))}),[]),h==null)return a.jsx(te,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return j==="In-Progress"?a.jsx(It,{windowSize:o,children:a.jsx(ei,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Hi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=Y((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Qe(e,"common"),r=l!=null?"edit":"create",u=W(e),o=$.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Wt.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(xn(u??void 0,t.billId)),i!=null&&e(En(i))},saveVendorDetailLocalData:i=>{e(zt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Cn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:i=>{e(Bn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):ui(s,t.billId,u):p=di(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?wn(i,"vendor",u):An(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ye(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(In(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(vn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(fn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(We({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const i=Q(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ci(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(yn(i,"BillPayVendor"))},onResendOtp:i=>{e(Sn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(gn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(hn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Nt(i,!1))}}}))(oi),Ae=()=>{const e=K(),t=se(),l=ai(),n=J(),{billId:c,vendorId:r}=ae(),u=I((b=>W(b))),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=I((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=I((b=>ve(b,r))),h=I((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(ye(!1,r)),d(!0))}),[i,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ni,{}):g==="Error"?a.jsx(ii,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ki=Y((function(e,t){const{companyId:l}=t;return{billPaySetupView:Dn(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(jn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(li),Ji=()=>{const e=K(),t=J(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=I((h=>W(h))),o=u.companyId??$.getSignedInUserTenant(l)?.companyId,s=$.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(De,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Ht.Event.billPayPromoPage))(h)}),a.jsx(Jt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ki,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function jo(){const e=I((F=>W(F))),t=Ie(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Wi:zi,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=$t(o,e),i=Lt(e),d=J(),p=e?.userRole!=null&&wt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Vt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Pn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,v=b&&Ut(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(S.isChargeCardFeatureEnabled),B=si(e,j,o)&&!p,C=B&&Tn(t?.loggedInUserRoleMap),_=Fn(t?.loggedInUserRoleMap),P=_t(t?.loggedInUserRoleMap),G=Rn(t?.loggedInUserRoleMap),L=b&&P,k=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&G,H=Vn(t?.loggedInUserRoleMap),O=$n(t?.loggedInUserRoleMap),w=Ln(t?.loggedInUserRoleMap),N=B&&H,{tenantEmailDomain:M}=ae();return a.jsxs(oa,{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:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ji,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:L,isUserHasBillPayAccess:O,isUserHasReimbursementAccess:w,showTreasuryRoute:k,isTenantBankingOnly:s,showChargeCardRoute:N,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Te,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,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(Yt,{})}),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(A,{appContent:a.jsx(St,{})})}),a.jsx(y,{path:":billId",element:a.jsx(A,{appContent:a.jsx(gi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(A,{appContent:a.jsx(St,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(A,{appContent:a.jsx(kt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(A,{appContent:a.jsx(kt,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(A,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(A,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(xe,{})})]}):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(xe,{})})]})}export{jo as default};
119
+ `,Hi=J((function(e,t){const l=$.getSignedInUser(),n=Qt(e,t.billId),c=bn(e),r=Ee(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Mt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics: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(fe({}))},saveBillDetails:(o,s)=>{o&&e(Dt({billId:n,data:s})),e(Me(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Et({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Ot("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ae(t.billId,"retry"))}}}))(ti);function It(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(S.isBillPayDetectInsufficientFundsEnabled),o=Ie(),s=$.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=k((A=>W(A))),v=k((A=>Qt(A,n))),j=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,C=v.vendor?.id,_=v.totalAmount.amount,T=v.recipientTotalAmount.amount,G=v.invoiceNumber;A&&C&&t(mn(A,C,_,T,G,n))}),[]),h==null)return a.jsx(te,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return j==="In-Progress"?a.jsx(kt,{windowSize:o,children:a.jsx(ei,{})}):a.jsx(kt,{windowSize:o,children:a.jsx(Hi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=J((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=W(e),o=$.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Wt.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(xn(u??void 0,t.billId)),i!=null&&e(En(i))},saveVendorDetailLocalData:i=>{e(zt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Cn({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):ui(s,t.billId,u):p=di(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?wn(i,"vendor",u):Bn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Je(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(In({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(vn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(fn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(We({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??ci(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(yn(i,"BillPayVendor"))},onResendOtp:i=>{e(Sn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(gn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(hn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Nt(i,!1))}}}))(oi),Be=()=>{const e=K(),t=se(),l=ai(),n=Y(),{billId:c,vendorId:r}=ae(),u=k((b=>W(b))),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=k((b=>ve(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(ye(!1,r)),d(!0))}),[i,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ni,{}):g==="Error"?a.jsx(ii,{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})]})},Ki=J((function(e,t){const{companyId:l}=t;return{billPaySetupView:Dn(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(jn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(li),Yi=()=>{const e=K(),t=Y(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=k((h=>W(h))),o=u.companyId??$.getSignedInUserTenant(l)?.companyId,s=$.getSignedInUser(),i=ke(),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&&Qe(u,i.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Ht.Event.billPayPromoPage))(h)}),a.jsx(Yt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ki,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function jo(){const e=k((F=>W(F))),t=ke(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Wi:zi,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=$t(o,e),i=Lt(e),d=Y(),p=e?.userRole!=null&&wt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Vt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Tn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,v=b&&Ut(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(S.isChargeCardFeatureEnabled),A=si(e,j,o)&&!p,C=A&&Pn(t?.loggedInUserRoleMap),_=Fn(t?.loggedInUserRoleMap),T=_t(t?.loggedInUserRoleMap),G=Rn(t?.loggedInUserRoleMap),L=b&&T,I=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&G,H=Vn(t?.loggedInUserRoleMap),O=$n(t?.loggedInUserRoleMap),w=Ln(t?.loggedInUserRoleMap),N=A&&H,{tenantEmailDomain:M}=ae();return a.jsxs(oa,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Yi,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:L,isUserHasBillPayAccess:O,isUserHasReimbursementAccess:w,showTreasuryRoute:I,isTenantBankingOnly:s,showChargeCardRoute:N,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:_,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Jt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&Qe(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(B,{appContent:a.jsx(St,{})})}),a.jsx(y,{path:":billId",element:a.jsx(B,{appContent:a.jsx(gi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(B,{appContent:a.jsx(St,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(B,{appContent:a.jsx(It,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(B,{appContent:a.jsx(It,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(B,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(B,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(B,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(B,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(B,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(B,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(B,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(B,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(B,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(B,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(B,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(B,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(B,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(B,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(B,{appContent:a.jsx(Be,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(B,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(B,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(B,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(B,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(B,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(B,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(xe,{})})]}):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(xe,{})})]})}export{jo as default};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-DxMhjnNF.js";import{a as V}from"./sentry-Dg7lI3nb.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-lpqyfl_C.js";import{T as ce,A as ue,aS as de,z,_ as pe,c as B,ag as E,f as x,bH as le,au as me,s as P,av as R}from"./index-CuLyKa_Q.js";import{Q8 as fe,eW as Q,tP as ye,Kw as Se,zO as ge,Dd as Ie,F_ as he,GD as Te,HD as be,Qv as De,Qw as Oe,Qx as Ce,Qy as ke,Qz as Ve,MZ as Ae,PA as we,Nc as Ne,Eh as _e,Nd as Fe,El as ve,lg as Ee,gi as xe,gh as ze,gg as Be,rQ as Pe,rH as Re,rE as Ue,l8 as Me,tY as Le,tW as U,bE as M,u8 as L,cA as je}from"./zeni-epic-state-D-kJk6oz.js";import{n as Qe}from"./mui-AVGOiy8R.js";import{d as j}from"./routePaths-Cu5maDQS.js";import{M as Ge}from"./MobileAppDrawer-DqPaZqu1.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="6cec028b-1c40-4ed1-952c-944462c21fb0",t._sentryDebugIdIdentifier="sentry-dbid-6cec028b-1c40-4ed1-952c-944462c21fb0")}catch{}})();const He=Qe.div`
1
+ import{j as C}from"./liveblocks-B6veqs_8.js";import{a as V}from"./sentry-BW637Fua.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-D-w0syUt.js";import{e as ce,A as ue,aS as de,z,F as le,f as B,ag as E,h as x,bH as pe,au as me,v as P,av as L}from"./index-DtTeUJqK.js";import{Qg as fe,eZ as G,tX as ye,KE as Se,zW as ge,Dl as Ie,G6 as he,GL as Te,HL as be,QD as De,QE as Oe,QF as Ce,QG as ke,QH as Ve,N5 as Ae,PI as Ne,Nk as we,Ep as Fe,Nl as _e,Et as ve,lm as Ee,gl as xe,gk as ze,gj as Be,rY as Pe,rP as Le,rM as Re,le as Ue,u4 as Me,u2 as R,bE as U,ug as M,cA as je}from"./zeni-epic-state-DyOMcw4f.js";import{n as Ge}from"./mui-CvZ4Namd.js";import{d as j}from"./routePaths-BXH8zPZv.js";import{M as Qe}from"./MobileAppDrawer-BSqYxsX2.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="3953b828-776a-4a17-9a36-3d31085e2a41",t._sentryDebugIdIdentifier="sentry-dbid-3953b828-776a-4a17-9a36-3d31085e2a41")}catch{}})();const He=Ge.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as C}from"./liveblocks-DxMhjnNF.js";import{a as V}from"./sentry-Dg7lI3n
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${t=>t.theme.colors.grey4};
9
- `,We=re((function(t,u){const{businessVerificationDetails:n}=u,i=Q(t),y=z.getSignedInUser(),S=i.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},T=Ae(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=we(t.companyConfigState),s=Ne(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:l}=u,{tenantEmailDomain:T}=y;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:d,companyIndustryType:D,companyLegalName:O,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:r,primaryContactName:o,primaryContactUserId:c,primaryContactSyncToken:b,syncToken:f,fileIds:a,incDate:p,typeOfIncorporation:A,stateOfIncorporation:w,sourceOfFunds:N,companySubIndustry:_,countriesOfOperations:h,companySourceOfFunds:G,companySourceOfFundsDescription:H,transactionVolume:W,transactionVolumeDescription:Z,purposeOfAccount:q,purposeOfAccountDescription:$,regulatedStatus:K,regulatedStatusDescription:Y,usNexus:J,usNexusTypes:X}=e,F=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?je(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:p!=null?M(p?.toString()):p,typeOfIncorporation:A?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:_?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:R(v)))??[],companySourceOfFunds:G?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:W?.selectedOption??"",transactionVolumeDescription:Z,purposeOfAccount:q?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:K??"",regulatedStatusDescription:Y,usNexus:J,usNexusTypes:X?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:b};t(L({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:e=>{const s=e.map((d=>{const{officerType:D,userId:O,name:g,email:m,nationalityCountryCode:I,ssn:r,dob:o,phone:c,syncToken:b,selectDocument:f,role:a,ownership:p,isSelectedForVerification:A,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:_}=d;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:D,userId:O,firstName:g.firstName,lastName:g.lastName,email:m,ssn:r,nationalityCountryCode:I?.selectedOption!=null?R(I.selectedOption):void 0,phone:c,birthday:o!=null?M(o?.toString()):o,syncToken:b,titleAtCompany:a.selectedOption,ownershipInCompany:p,documentTypeSelectedForVerification:h,isSelectedForVerification:A,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:_,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(L({officers:s}))},onSaveDetailsClick:e=>{t(U(n,e,i))},onSendForVerificationClick:e=>{t(U(n,e,i,!0))},onAddressClick:e=>{const s=j(T,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=j(T,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Le({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(Me({files:e}))},onDeleteFile:e=>{t(Ue(e))},onDeleteFileList:e=>{t(Re(e))},onEditFileName:(e,s)=>{t(Pe(e,s.split(".")[0]))},onGetOtp:e=>{t(Be(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ze(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(xe(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ee({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Fe(e.documentType);s!=null&&t(ve({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(_e({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(le),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[l,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=ce(),{useDynamicConfig:d}=ue(),{configValue:D}=d(de.zeniAccountsConfig),O=fe(D),g=k((a=>{switch(t){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=k((a=>a.companyConfigState.fetchState)),I=k((a=>a.userRoleConfigState.fetchState)),r=k((a=>Q(a))),o=r.companyId??z.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{m==="Not-Started"&&i(ye()),I==="Not-Started"&&i(Se(!0))}),[m,I,i]),V.useEffect((()=>{if(!y&&g==="Not-Started"&&o!=null)switch(S(!0),t){case"zeni_accounts":i(be(o,!0));break;case"zeni_treasury":i(Te(o,!0));break;case"reimbursement":i(he(o,!0));break;case"charge_cards":i(Ie(o,!0));break;default:i(ge(o,!0))}}),[y,g,o,i]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(t){case"zeni_accounts":c=r.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=r.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=r.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||r.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=r.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=r.companyBillPayInfo?.info?.isBillPayTOSAccepted}const b=a=>{T(a)},f=k((a=>{switch(t){case"zeni_accounts":return Ve(a,o);case"zeni_treasury":return ke(a,o);case"charge_cards":return Ce(a,o);case"reimbursement":return Oe(a,o);default:return De(a,o)}}));return c===!1?C.jsx(ie,{to:"../promo"}):C.jsxs(He,{children:[C.jsx(pe,{analytics:B,onLoad:a=>(p=>{switch(t){case"zeni_accounts":return p.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return p.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return p.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?C.jsx(Ge,{isAppContentDrawerOpen:l,handleDrawerToggle:b}):null,C.jsx(We,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{b(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};
9
+ `,Ze=re((function(t,u){const{businessVerificationDetails:n}=u,i=G(t),y=z.getSignedInUser(),S=i.tenantId,p={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},T=Ae(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Ne(t.companyConfigState),s=we(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:p,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:p}=u,{tenantEmailDomain:T}=y;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:d,companyIndustryType:D,companyLegalName:O,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:r,primaryContactName:o,primaryContactUserId:c,primaryContactSyncToken:b,syncToken:f,fileIds:a,incDate:l,typeOfIncorporation:A,stateOfIncorporation:N,sourceOfFunds:w,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:H,transactionVolume:Z,transactionVolumeDescription:q,purposeOfAccount:W,purposeOfAccountDescription:$,regulatedStatus:K,regulatedStatusDescription:X,usNexus:Y,usNexusTypes:J}=e,_=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?je(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:l!=null?U(l?.toString()):l,typeOfIncorporation:A?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:w?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:L(v)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:Z?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:K??"",regulatedStatusDescription:X,usNexus:Y,usNexusTypes:J?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:b};t(M({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:e=>{const s=e.map((d=>{const{officerType:D,userId:O,name:g,email:m,nationalityCountryCode:I,ssn:r,dob:o,phone:c,syncToken:b,selectDocument:f,role:a,ownership:l,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:F}=d;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:D,userId:O,firstName:g.firstName,lastName:g.lastName,email:m,ssn:r,nationalityCountryCode:I?.selectedOption!=null?L(I.selectedOption):void 0,phone:c,birthday:o!=null?U(o?.toString()):o,syncToken:b,titleAtCompany:a.selectedOption,ownershipInCompany:l,documentTypeSelectedForVerification:h,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(M({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=j(T,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=j(T,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Me({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(Ue({files:e}))},onDeleteFile:e=>{t(Re(e))},onDeleteFileList:e=>{t(Le(e))},onEditFileName:(e,s)=>{t(Pe(e,s.split(".")[0]))},onGetOtp:e=>{t(Be(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ze(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(xe(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ee({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=_e(e.documentType);s!=null&&t(ve({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(Fe({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(pe),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[p,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=ce(),{useDynamicConfig:d}=ue(),{configValue:D}=d(de.zeniAccountsConfig),O=fe(D),g=k((a=>{switch(t){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=k((a=>a.companyConfigState.fetchState)),I=k((a=>a.userRoleConfigState.fetchState)),r=k((a=>G(a))),o=r.companyId??z.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{m==="Not-Started"&&i(ye()),I==="Not-Started"&&i(Se(!0))}),[m,I,i]),V.useEffect((()=>{if(!y&&g==="Not-Started"&&o!=null)switch(S(!0),t){case"zeni_accounts":i(be(o,!0));break;case"zeni_treasury":i(Te(o,!0));break;case"reimbursement":i(he(o,!0));break;case"charge_cards":i(Ie(o,!0));break;default:i(ge(o,!0))}}),[y,g,o,i]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(t){case"zeni_accounts":c=r.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=r.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=r.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||r.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=r.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=r.companyBillPayInfo?.info?.isBillPayTOSAccepted}const b=a=>{T(a)},f=k((a=>{switch(t){case"zeni_accounts":return Ve(a,o);case"zeni_treasury":return ke(a,o);case"charge_cards":return Ce(a,o);case"reimbursement":return Oe(a,o);default:return De(a,o)}}));return c===!1?C.jsx(ie,{to:"../promo"}):C.jsxs(He,{children:[C.jsx(le,{analytics:B,onLoad:a=>(l=>{switch(t){case"zeni_accounts":return l.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return l.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return l.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?C.jsx(Qe,{isAppContentDrawerOpen:p,handleDrawerToggle:b}):null,C.jsx(Ze,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{b(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};