@zeniai/web-app-ui 5.2.19-qa → 5.2.20-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 (143) hide show
  1. package/dist/assets/AddressRoutes-EXo_W2G8.js +1 -0
  2. package/dist/assets/AddressScreen-2BaT3oA-.js +9 -0
  3. package/dist/assets/AiCfoScreen-D51UIBd5.js +22 -0
  4. package/dist/assets/{BillPayApprovalRoutes-DNMaV2B3.js → BillPayApprovalRoutes-DmH2FpGv.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-nY9e-Ucu.js → BillPayRoutes-DfJ2aUyG.js} +12 -12
  6. package/dist/assets/{BusinessVerificationPageScreen-D2eu1jQC.js → BusinessVerificationPageScreen-Bj1xk_4H.js} +2 -2
  7. package/dist/assets/{CardsAiCfoScreen-B5bn7At3.js → CardsAiCfoScreen-BgnMfnsv.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-DY752I-e.js → ChargeCardRoutes-OCtj3EGu.js} +10 -10
  9. package/dist/assets/{CompanyPassportScreen-XItKjSib.js → CompanyPassportScreen-DZx6t9Ym.js} +1 -1
  10. package/dist/assets/ConnectionAuthScreen-MT-IQAtA.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-LgV5vbRx.js +1 -0
  12. package/dist/assets/CustomerOnboardingRoutes-wfQZLitF.js +30 -0
  13. package/dist/assets/{DashboardRoutes-X4CuSvKN.js → DashboardRoutes-DZ3q6bkK.js} +4 -4
  14. package/dist/assets/{DefaultTenantHome-3tZYTtZs.js → DefaultTenantHome-p5Sm1nZ3.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-CkUpa35c.js +18 -0
  16. package/dist/assets/DrawerScreen-C0UDia2K.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-CVYJbbdy.js +1 -0
  18. package/dist/assets/ExpenseAutomationRoutes-DlWNUUJC.js +25 -0
  19. package/dist/assets/FeaturePreviewScreen-BnJlO_wg.js +1 -0
  20. package/dist/assets/HubSpotOAuthCallbackScreen-CSIQ97oS.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-BjPIElfX.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-91bKq8wl.js +12 -0
  23. package/dist/assets/MobileAppDrawer-CinzTjr5.js +1 -0
  24. package/dist/assets/NotFoundScreen-0K6cd0N1.js +1 -0
  25. package/dist/assets/{NotificationRoutes-CUhoGF8j.js → NotificationRoutes-D6XmhJmY.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-BoXeHjzR.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-CSWL87A6.js +1 -0
  28. package/dist/assets/PeopleRoutes-DYYpRS5n.js +22 -0
  29. package/dist/assets/PerformanceRoutes-D39M8yO2.js +1 -0
  30. package/dist/assets/{Preview-N8JE4dsu.js → Preview-K7kVfJNZ.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-B7QYuZy-.js → QBOConnectionScreen-OLT5sXwr.js} +1 -1
  32. package/dist/assets/ReimbursementApprovalRoutes-DBKdGYm6.js +1 -0
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js → ReimbursementApprovalRuleDetailScreen-DwTxQqE3.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-D12Jt1bi.js → ReimbursementRoutes-BGm8wHdZ.js} +8 -8
  35. package/dist/assets/{ReportsRoutes-BxecWoyx.js → ReportsRoutes-NgI0ftPw.js} +1 -1
  36. package/dist/assets/RewardsRoutes-BR5NZ2Mx.js +1 -0
  37. package/dist/assets/ScreenRoutes-CXSdkcuS.js +2 -0
  38. package/dist/assets/SettingsRoutes-BaPhIBve.js +57 -0
  39. package/dist/assets/{SetupPagesScreen-CiLpjjGD.js → SetupPagesScreen-Cvdlisb9.js} +5 -5
  40. package/dist/assets/SignInScreen-D4Abp5hF.js +1 -0
  41. package/dist/assets/SignOutScreen-iBWPMOhx.js +9 -0
  42. package/dist/assets/TaskListScreen-C2zap0Rn.js +9 -0
  43. package/dist/assets/TaskRoutes-CZVLK5dG.js +9 -0
  44. package/dist/assets/{TransactionDetailRoutes-zN1P9Vz7.js → TransactionDetailRoutes-Dxvv503N.js} +1 -1
  45. package/dist/assets/TransactionDetailScreen-4CysuAHi.js +5 -0
  46. package/dist/assets/{TransactionListRoutes-D_krEmlB.js → TransactionListRoutes-DNSGDUp4.js} +1 -1
  47. package/dist/assets/TreasuryRoutes-CVqgaqHD.js +37 -0
  48. package/dist/assets/{VendorsRoutes-DkWJ1EKQ.js → VendorsRoutes-DVTbhmec.js} +15 -15
  49. package/dist/assets/WiseConfirmationScreen-TxMYz6AU.js +12 -0
  50. package/dist/assets/{ZeniAccountRoutes-VA9YYfkO.js → ZeniAccountRoutes-BvMIfD-Y.js} +11 -11
  51. package/dist/assets/ZeniAccountStatementScreen-D9RVH8zp.js +9 -0
  52. package/dist/assets/{accountMappingHelper-NsHFWNkE.js → accountMappingHelper-gMZWceAt.js} +1 -1
  53. package/dist/assets/{analytics-C1xZTLEH.js → analytics-BP5D4JyB.js} +1 -1
  54. package/dist/assets/{analyticsHelper-C5WvAo12.js → analyticsHelper-BgeHTAVC.js} +1 -1
  55. package/dist/assets/{core-u1EteL-v.js → core-BfWJ7zKT.js} +1 -1
  56. package/dist/assets/{decodeURIComponentSafe-CjfYiJlM.js → decodeURIComponentSafe-D2jiQ7Do.js} +1 -1
  57. package/dist/assets/{dnd-CIbUDnZz.js → dnd-tQgCG5z3.js} +1 -1
  58. package/dist/assets/{empty-C5PjC6g0.js → empty-0zu7mfa-.js} +1 -1
  59. package/dist/assets/{empty-Bplt_RAY.js → empty-D4KL-CgN.js} +1 -1
  60. package/dist/assets/{emptyVideoElement-CZ_82B6H.js → emptyVideoElement-D2WpBqYb.js} +1 -1
  61. package/dist/assets/epic-_aUX4Son.js +2 -0
  62. package/dist/assets/getLocaleForTenant-BJ1a_Zja.js +1 -0
  63. package/dist/assets/{index-CQm_vnbZ.js → index-BtVRjclm.js} +1 -1
  64. package/dist/assets/{index-29ukruDR.js → index-C2k_pBZi.js} +1 -1
  65. package/dist/assets/{index-Df8xDBDT.js → index-CiS2dMrM.js} +1 -1
  66. package/dist/assets/index-Cx4f0JbF.css +1 -0
  67. package/dist/assets/{index-tOfK8iY_.js → index-DWJVmwhz.js} +35734 -34803
  68. package/dist/assets/{index-DFSTqcuc.js → index-DpTDwQon.js} +1 -1
  69. package/dist/assets/{index-B35sRjQe.js → index-edb9TugW.js} +1 -1
  70. package/dist/assets/{index-D5nyNcPu.js → index-oBgu7-MV.js} +2 -2
  71. package/dist/assets/{index-pof_GVZP.js → index-zYcXrqlT.js} +1 -1
  72. package/dist/assets/{lexical-BuHlG7c0.js → lexical-Bg8ldM3i.js} +1 -1
  73. package/dist/assets/liveblocks-DJbBe3tc.js +54 -0
  74. package/dist/assets/{lottie-DvAqKpNG.js → lottie-BaCgeYyk.js} +1 -1
  75. package/dist/assets/{mui-DMXXvJHn.js → mui-ts7KHm6i.js} +1 -1
  76. package/dist/assets/{pathToGoBack-Ch1k07_O.js → pathToGoBack-DG10zCZ4.js} +1 -1
  77. package/dist/assets/{pdf-Wf7vPJje.js → pdf-C9HGpLCu.js} +4 -4
  78. package/dist/assets/{pdf-lib-Cw5xvhae.js → pdf-lib-DX6kz8a9.js} +1 -1
  79. package/dist/assets/{plaid-BGfWuOr6.js → plaid-Cv0mPYlm.js} +1 -1
  80. package/dist/assets/{pusher-D19Erbfh.js → pusher-CgG6vGRj.js} +1 -1
  81. package/dist/assets/{react-Ee9ncfbZ.js → react-Bu9a3mw7.js} +1 -1
  82. package/dist/assets/{react-C2iLidGy.js → react-CdB2kFeI.js} +1 -1
  83. package/dist/assets/{react-B7zdDwoo.js → react-Dp-aIPjg.js} +1 -1
  84. package/dist/assets/{react-C9GijZet.js → react-LH5dN4Ph.js} +1 -1
  85. package/dist/assets/{react-CYyUBnNb.js → react-r7Nkvi02.js} +1 -1
  86. package/dist/assets/{react-C3pQy8tf.js → react-tqWON72J.js} +1 -1
  87. package/dist/assets/{recharts-REl-3xYX.js → recharts-DNnhB5R_.js} +1 -1
  88. package/dist/assets/routePaths-DqVKIcAE.js +1 -0
  89. package/dist/assets/{sentry-B7X8e_7J.js → sentry-C6T1HHHS.js} +1 -1
  90. package/dist/assets/{url-DyzfdPsq.js → url-CJ3E3PSB.js} +1 -1
  91. package/dist/assets/{url-CUjb-zqA.js → url-Xy6MI2YY.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Drsr1_x0.js → useAiCfoDashboardSuggestedQuestionsChips-BH6Wd98D.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-DJm2npkG.js +1 -0
  94. package/dist/assets/useCashManagementBanner-Bjdnpen4.js +1 -0
  95. package/dist/assets/{useChargeCardPusherEvents-HnTE12S3.js → useChargeCardPusherEvents-Bfrohee4.js} +1 -1
  96. package/dist/assets/{useDeviceId-CPotDJHg.js → useDeviceId-DNuYTM17.js} +1 -1
  97. package/dist/assets/{useEmailConnectResultRefresh-Csv2ipfu.js → useEmailConnectResultRefresh-DFbMcoeq.js} +1 -1
  98. package/dist/assets/{useInitialThreadRequest-B6H0CI2K.js → useInitialThreadRequest-D3K2ol9C.js} +1 -1
  99. package/dist/assets/{utils-ChVfPml3.js → utils-xWcqC4Wl.js} +1 -1
  100. package/dist/assets/withTransactionSidePanel-BMpiKSmG.js +21 -0
  101. package/dist/assets/{zeni-epic-state-DiB-ZYnx.js → zeni-epic-state-kow6PLud.js} +6 -6
  102. package/dist/index.html +1 -1
  103. package/package.json +7 -4
  104. package/dist/assets/AddressRoutes-4d0GG7rG.js +0 -1
  105. package/dist/assets/AddressScreen-C1-59DB9.js +0 -9
  106. package/dist/assets/AiCfoScreen-BDXW1pEG.js +0 -22
  107. package/dist/assets/ConnectionAuthScreen-tEXIUU8s.js +0 -11
  108. package/dist/assets/CustomerOnboardingAuthScreen-WJgYXVGO.js +0 -1
  109. package/dist/assets/CustomerOnboardingRoutes-DXg0Kf-I.js +0 -30
  110. package/dist/assets/DomesticWireDetailScreen-KZF7LYi4.js +0 -18
  111. package/dist/assets/DrawerScreen-C8ShIsGs.js +0 -1
  112. package/dist/assets/EntityDetailRoutes-CaaXRLoy.js +0 -1
  113. package/dist/assets/ExpenseAutomationRoutes-B9Ri_GEg.js +0 -25
  114. package/dist/assets/FeaturePreviewScreen-Df-HjHKO.js +0 -1
  115. package/dist/assets/HubSpotOAuthCallbackScreen-C_AMn_zI.js +0 -1
  116. package/dist/assets/MagicLinkRoutes-BTE6ILsC.js +0 -72
  117. package/dist/assets/MagicLinkSignInScreen-BoZkLiIF.js +0 -12
  118. package/dist/assets/MobileAppDrawer-DKR412hC.js +0 -1
  119. package/dist/assets/NotFoundScreen-DVitp65R.js +0 -1
  120. package/dist/assets/OAuthConsentScreen-CKk9r_kv.js +0 -1
  121. package/dist/assets/PandLWithForecastRoutes-DDCfsce9.js +0 -1
  122. package/dist/assets/PeopleRoutes-D8NzEF0b.js +0 -22
  123. package/dist/assets/PerformanceRoutes-D6q2fbPJ.js +0 -1
  124. package/dist/assets/ReimbursementApprovalRoutes-CuqLUiW5.js +0 -1
  125. package/dist/assets/RewardsRoutes-C4bn-KvF.js +0 -1
  126. package/dist/assets/ScreenRoutes-BNvEvG7L.js +0 -2
  127. package/dist/assets/SettingsRoutes-CN172aq_.js +0 -57
  128. package/dist/assets/SignInScreen-BQwWdLEK.js +0 -1
  129. package/dist/assets/SignOutScreen-DHYljL7t.js +0 -9
  130. package/dist/assets/TaskListScreen-B5yPteB2.js +0 -9
  131. package/dist/assets/TaskRoutes-I9rTbqEa.js +0 -9
  132. package/dist/assets/TransactionDetailScreen-oIg47Woo.js +0 -5
  133. package/dist/assets/TreasuryRoutes-B0g2RVn5.js +0 -37
  134. package/dist/assets/WiseConfirmationScreen-DQmSckNf.js +0 -12
  135. package/dist/assets/ZeniAccountStatementScreen-Cr2gc08z.js +0 -9
  136. package/dist/assets/epic-uTwIf-FI.js +0 -2
  137. package/dist/assets/getLocaleForTenant-BFNl-yVT.js +0 -1
  138. package/dist/assets/index-Czu7h9lW.css +0 -1
  139. package/dist/assets/liveblocks-B_acMj2M.js +0 -54
  140. package/dist/assets/routePaths-FKPzluZv.js +0 -1
  141. package/dist/assets/useAskAiCfoHostNavButtonProps-D-klSIXS.js +0 -1
  142. package/dist/assets/useCashManagementBanner-D-KRAuwc.js +0 -1
  143. package/dist/assets/withTransactionSidePanel-DKYByGkd.js +0 -21
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DJbBe3tc.js";import{A as d}from"./AddressScreen-2BaT3oA-.js";import i from"./NotFoundScreen-0K6cd0N1.js";import"./sentry-C6T1HHHS.js";import{o as s,p as r}from"./core-BfWJ7zKT.js";import"./zeni-epic-state-kow6PLud.js";import"./recharts-DNnhB5R_.js";import"./index-DWJVmwhz.js";import"./mui-ts7KHm6i.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.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-DJbBe3tc.js";import{a as S}from"./sentry-C6T1HHHS.js";import{h as T,u as _,g as E,i as j,j as B,n as D}from"./core-BfWJ7zKT.js";import{J as $,E as M,z as L,D as N,B as K,A as z,f as C,h as m,r as F,m as h,s as R}from"./index-DWJVmwhz.js";import{Nf as w,i1 as U,e$ as G,Ng as O,c7 as V,Nh as q,lr as H}from"./zeni-epic-state-kow6PLud.js";import{n as J}from"./mui-ts7KHm6i.js";import Q from"./NotFoundScreen-0K6cd0N1.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]="d812e280-bb87-44eb-a92b-180bac80a8d0",e._sentryDebugIdIdentifier="sentry-dbid-d812e280-bb87-44eb-a92b-180bac80a8d0")}catch{}})();const W=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
+ `,X=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:h.googleMapsAPIKey,isDisabled:r,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=w(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:h.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 g=new URLSearchParams(u).toString();g&&(s=`${s}?${g}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const r=Y(a);e(H({addressType:c,addressToCreate:r})),C?.trackSaveAddressClicked(m.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}}))(F);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(),g=$(),k=M(),v=L.getSignedInUser(),[f,x]=S.useState(s==null),p=B((b=>s!=null?w(b,s).fetchState:"Not-Started")),A=N();if(v==null)throw Error("Can't access address page without signing in...");const P=b=>b.trackPageLoaded(s!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return S.useEffect((()=>{f||s==null||(x(!0),r(U(s,!1)))}),[f,s,r]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!f&&p==="Not-Started"||f&&p==="In-Progress"?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(z,{analytics:C,onLoad:P}),d.jsx(W,{windowSize:g,children:d.jsx(X,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):d.jsx(Q,{})}const I=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},Y=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{de as A,Y as t};
@@ -0,0 +1,22 @@
1
+ import{j as u}from"./liveblocks-DJbBe3tc.js";import{a as l}from"./sentry-C6T1HHHS.js";import{u as we,h as Pe,g as ye,j as X,i as Ee,n as Te}from"./core-BfWJ7zKT.js";import{W as ve,de as Ae,z as Qe,J as _e,df as Ue,dg as Oe,bb as Z,dh as ae,di as je,ba as oe,s as V,A 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 We,b6 as ze,ds as He}from"./index-DWJVmwhz.js";import{gr as Je,e_ as ne,e$ as Ye,iJ as Ke,Uw as Xe,fu as Ze,iT as et,iP as tt,f0 as M,fB as st,ga as at,gb as ot,g3 as nt,j7 as ee,g7 as te,gc as it,gd as rt,ge as lt,gf as dt,gg as ct,gh as ut}from"./zeni-epic-state-kow6PLud.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-ts7KHm6i.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-BH6Wd98D.js";import{p as gt}from"./pathToGoBack-DG10zCZ4.js";import"./recharts-DNnhB5R_.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.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]="545de085-684d-4056-bc08-738731441871",e._sentryDebugIdIdentifier="sentry-dbid-545de085-684d-4056-bc08-738731441871")}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,He(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&&ze(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=We(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(Je())}),[a]);const h=X((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=X((r=>Ye(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:re}=Ue({isFileUploadEnabled:e,tenantEmailDomain:w}),Q=Oe({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?.[Z]!==!0)return;d(!0);const f={...r};delete f[Z],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,U]=l.useState(!1),[me,O]=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),U($),O(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),U(!1),O(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,W=l.useRef(!1);l.useEffect((()=>{W.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Ke("controller",s.userId,F,"MONTH_END_EMAIL")),W.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),U(!0),O(void 0),j(void 0),a(Xe()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:z}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,H=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",J=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),Y=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(Y,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(Ze({sessionId:t,agentId:"controller"}))}),[]);const be=l.useMemo((()=>({events:z.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[z]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&H!=="In-Progress"&&J&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[H,J,i,s,a]);const K=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:K}),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:K}):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:Y,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-B_acMj2M.js";import{a as v}from"./sentry-B7X8e_7J.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-u1EteL-v.js";import{eZ as O,Qq as A,Q6 as h,zM as E,zE as q,zI as R,zx as Q,Q8 as K,zO as ae,zA as M,zR as Z,zN as C}from"./zeni-epic-state-DiB-ZYnx.js";import{z as V,a9 as G,bL as oe,ag as P,bC as H,bM as le,y as J,B as X,bN as pe,bO as se}from"./index-tOfK8iY_.js";import"./mui-DMXXvJHn.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js";import re from"./NotFoundScreen-DVitp65R.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]="a0f6bebc-bcb3-45d1-9448-b86302e63208",e._sentryDebugIdIdentifier="sentry-dbid-a0f6bebc-bcb3-45d1-9448-b86302e63208")}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"))}}}))(G(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(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))}}}))(G(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(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(Z(!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(M(!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(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){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(M(!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($,{})}),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-DJbBe3tc.js";import{a as v}from"./sentry-C6T1HHHS.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-BfWJ7zKT.js";import{e$ as V,QG as A,Qm as h,zR as E,zJ as q,zN as R,zC as Q,Qo as K,zT as ae,zF as G,zW as J,zS as C}from"./zeni-epic-state-kow6PLud.js";import{z as O,a9 as M,bL as oe,ag as T,bC as H,bM as le,E as X,B as Y,bN as pe,bO as se}from"./index-DWJVmwhz.js";import"./mui-ts7KHm6i.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DwTxQqE3.js";import re from"./NotFoundScreen-0K6cd0N1.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]="2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02",e._sentryDebugIdIdentifier="sentry-dbid-2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02")}catch{}})();const P="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(P)&&e(K(!1))},onBackClick:()=>{T(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}.${P}`]:[],eventCallback:(s,w,S)=>{s.endsWith(P)&&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:()=>{T(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}=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=>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=T(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(J(!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=T(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(J(!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}=H(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,19 +1,19 @@
1
- import{j as a}from"./liveblocks-B_acMj2M.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as ia,o as oa,p as y}from"./core-u1EteL-v.js";import{eZ as W,PI as Ge,bs as wt,Kz as la,bq as Bt,bJ as pe,PJ as At,z2 as Ct,Ah as $e,zB as sa,bn as Ee,PK as ra,PL as ca,c7 as da,PM as ua,kG as xt,PN as Et,PO as Dt,AS as Me,zh as Ae,PP as pa,yS as tt,PQ as ma,EX as ba,yW as ha,z0 as jt,PR as fe,PS as Ne,Ai as Oe,PT as ga,PU as Sa,Al as ze,PV as ya,Ay as fa,PW as Tt,A2 as at,A7 as va,PX as Ia,PY as ue,PZ as Pt,P_ as Ft,P$ as Rt,gw as ka,zm as Le,cC as Vt,Q0 as wa,fB as Ba,Q1 as Aa,Q2 as Ca,fG as $t,fE as Lt,Q3 as Qe,Q4 as xa,Q5 as Ea,Nt as Ze,Q6 as Da,Nu as oe,Nv as We,Q7 as ja,Q8 as Ta,Q9 as Pa,A9 as nt,A6 as Fa,Qa as Ra,Qb as Va,Qc as $a,zU as La,Qd as _a,Qe as Ua,Qf as Ga,cq as _t,cS as Ut,kR as Ma,bP as Na,bo as Gt,bQ as Mt,y8 as Oa,Qg as za,EK as Qa,EQ as Za,uu as Wa,Aj as Ha,AZ as qa,l2 as ye,Qh as Ka,Qi as Nt,lw as Ja,kY as Ot,lh as zt,lg as it,bE as be,bO as Xa,Qj as Ya,Qk as ve,jB as en,Ql as ot,Qm as tn,jF as an,j_ as nn,Bb as on,Qn as ln,lp as sn,B1 as rn,Qo as lt,B5 as cn,Ba as dn,B7 as un,A$ as pn,Qp as Qt,zb as mn,Qq as bn,Qr as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rW as In,le as kn,B3 as wn,jL as Bn,lD as An,Qs as Cn,jD as xn,rN as En,Qt as Dn,z_ as jn,bK as Tn,bt as Pn,Mh as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-DiB-ZYnx.js";import{y as me,z as $,e as Ie,a0 as He,A as le,d as S,aS as Ce,B as re,o as x,C as De,f as D,bh as _n,p as Z,a4 as qe,r as E,K as ke,bi as rt,bj as ct,bk as Un,al as Gn,I as Mn,aM as Nn,F as Zt,O as je,J as Ke,bl as On,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 Jn,bs as Xn,bt as Yn,bu as ei,bv as ti,v as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-tOfK8iY_.js";import{n as _,S as ri}from"./mui-DMXXvJHn.js";import{A as dt}from"./AddressScreen-C1-59DB9.js";import{g as ie,a as Te,i as qt,V as Je,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-KZF7LYi4.js";import{a as f}from"./sentry-B7X8e_7J.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-D-klSIXS.js";import{u as Kt}from"./useInitialThreadRequest-B6H0CI2K.js";import xe from"./NotFoundScreen-DVitp65R.js";import{D as pi}from"./DrawerScreen-C8ShIsGs.js";import{M as Jt}from"./MobileAppDrawer-DKR412hC.js";import{F as Xt}from"./FeaturePreviewScreen-Df-HjHKO.js";import{S as Pe}from"./SetupPagesScreen-CiLpjjGD.js";import{B as mi}from"./BillPayApprovalRoutes-DNMaV2B3.js";import{FallBackRoute as bi}from"./ScreenRoutes-BNvEvG7L.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./analyticsHelper-C5WvAo12.js";import"./routePaths-FKPzluZv.js";import"./BusinessVerificationPageScreen-D2eu1jQC.js";import"./ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js";import"./getLocaleForTenant-BFNl-yVT.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]="977ff043-7d50-44d8-957f-8cc99bc33595",e._sentryDebugIdIdentifier="sentry-dbid-977ff043-7d50-44d8-957f-8cc99bc33595")}catch{}})();const hi=X((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}))}}}))(_n);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}=Ye({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,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||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,O,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,Y,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 _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((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(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({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),A=I((R=>W(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[H,N]=f.useState(),w=I((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=I((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(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(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",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(Y??"",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(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="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:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const 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:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.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:N,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{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:`${_e.recurringBill.recurringCycle}
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=_.div`
1
+ import{j as a}from"./liveblocks-DJbBe3tc.js";import{h as J,u as se,g as K,i as ae,j as v,N as te,n as X,l as ia,o as oa,p as y}from"./core-BfWJ7zKT.js";import{e$ as H,PY as Ge,bs as wt,KM as la,bq as Bt,bJ as pe,PZ as At,z7 as Ct,Am as $e,zG as sa,bn as Ee,P_ as ra,P$ as ca,c7 as da,Q0 as ua,kL as xt,Q1 as Et,Q2 as Dt,AX as Me,zm as Ae,Q3 as pa,yX as tt,Q4 as ma,F0 as ba,y$ as ha,z5 as jt,Q5 as fe,Q6 as Ne,An as Oe,Q7 as ga,Q8 as Sa,Aq as ze,Q9 as ya,AD as fa,Qa as Tt,A7 as at,Ac as Ia,Qb as va,Qc as ue,Qd as Pt,Qe as Ft,Qf as Rt,gy as ka,zr as Le,cD as Vt,Qg as wa,fD as Ba,Qh as Aa,Qi as Ca,fI as $t,fG as Lt,Qj as Qe,Qk as xa,Ql as Ea,NG as Ze,Qm as Da,NH as oe,NI as He,Qn as ja,Qo as Ta,Qp as Pa,Ae as nt,Ab as Fa,Qq as Ra,Qr as Va,Qs as $a,zZ as La,Qt as _a,Qu as Ua,Qv as Ga,cr as _t,cT as Ut,kW as Ma,bP as Na,bo as Gt,bQ as Mt,yd as Oa,Qw as za,EP as Qa,EV as Za,uz as Ha,Ao as Wa,B2 as qa,l7 as ye,Qx as Ja,Qy as Nt,lB as Ka,l1 as Ot,lm as zt,ll as it,bE as be,bO as Xa,Qz as Ya,QA as Ie,jG as en,QB as ot,QC as tn,jK as an,k3 as nn,Bg as on,QD as ln,lu as sn,B6 as rn,QE as lt,Ba as cn,Bf as dn,Bc as un,B4 as pn,QF as Qt,zg as mn,QG as bn,QH as hn,gn,gm as Sn,gl as yn,la as fn,ls as st,lD as In,r$ as vn,lj as kn,B8 as wn,jQ as Bn,lI as An,QI as Cn,jI as xn,rS as En,QJ as Dn,A3 as jn,bK as Tn,bt as Pn,Mu as Fn,cW as Rn,cV as Vn,cC as $n,cJ as Ln}from"./zeni-epic-state-kow6PLud.js";import{E as me,z as $,D as ve,a0 as We,w as le,i as S,aS as Ce,B as re,o as x,A as De,f as D,bh as _n,s as Z,a4 as qe,v as E,J as ke,bi as rt,bj as ct,bk as Un,al as Gn,H as Mn,aM as Nn,F as Zt,a as je,I as Je,bl as On,au as Ht,bm as zn,X as Qn,h as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Jn,br as Kn,bs as Xn,bt as Yn,bu as ei,bv as ti,x as ai,bw as ni,be as ii,bx as oi,by as li,d as si}from"./index-DWJVmwhz.js";import{n as _,S as ri}from"./mui-ts7KHm6i.js";import{A as dt}from"./AddressScreen-2BaT3oA-.js";import{g as ie,a as Te,i as qt,V as Ke,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-CkUpa35c.js";import{a as f}from"./sentry-C6T1HHHS.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-DJm2npkG.js";import{u as Jt}from"./useInitialThreadRequest-D3K2ol9C.js";import xe from"./NotFoundScreen-0K6cd0N1.js";import{D as pi}from"./DrawerScreen-C0UDia2K.js";import{M as Kt}from"./MobileAppDrawer-CinzTjr5.js";import{F as Xt}from"./FeaturePreviewScreen-BnJlO_wg.js";import{S as Pe}from"./SetupPagesScreen-Cvdlisb9.js";import{B as mi}from"./BillPayApprovalRoutes-DmH2FpGv.js";import{FallBackRoute as bi}from"./ScreenRoutes-CXSdkcuS.js";import"./recharts-DNnhB5R_.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.js";import"./analyticsHelper-BgeHTAVC.js";import"./routePaths-DqVKIcAE.js";import"./BusinessVerificationPageScreen-Bj1xk_4H.js";import"./ReimbursementApprovalRuleDetailScreen-DwTxQqE3.js";import"./getLocaleForTenant-BJ1a_Zja.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]="bf0a92c8-b4c7-4145-a809-ba88596f9369",e._sentryDebugIdIdentifier="sentry-dbid-bf0a92c8-b4c7-4145-a809-ba88596f9369")}catch{}})();const hi=X((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}))}}}))(_n);function gi(){const e=J(),t=se(),l=K(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ve(),o=v((z=>H(z))),s=v((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,I]=f.useState(!1),[j,A]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:W}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||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,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!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,Y,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:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((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:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.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(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({appContent:e}){const t=se(),l=J(),{billId:n}=ae(),c=K(),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:I}=p(Ce.zeniAssistConfig),j=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),A=v((R=>H(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[W,N]=f.useState(),w=v((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=v((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(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(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(W,m,n))},onCancelClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ga({file:W,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(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="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:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const 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:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.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:N,showActionButtons:Ii(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${_e.recurringBill.recurringCycle}
2
+ ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const mt=_.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
5
5
  margin-left: ${x.sp5};
6
6
  position: absolute;
7
7
  display: flex;
8
8
  align-items: center;
9
- `,Ii=_.div`
9
+ `,vi=_.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=_(Ke.StandardMedium)``,wi=_((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
16
+ `,ki=_(Je.StandardMedium)``,wi=_((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
17
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-B_acMj2M.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
- `,Bi=_(Ke.H6Regular)`
67
+ `,Bi=_(Je.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
- `,Ai=_(Ke.LargeRegularSp)`
73
+ `,Ai=_(Je.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=X((function(e,t){return{billsReviewView:Tt(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=>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",Ue="bill-approval-rule-update",{spendManagement:Ei,common:ht}=je.getLocalizedStrings(),gt=Ei.billPay.bulkActions,Di=_.div`
80
+ `,Ci=X((function(e,t){return{billsReviewView:Tt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(va(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(Ia());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}}))(zn);function xi(){const e=J(),t=v((n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:l}=v((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",Ue="bill-approval-rule-update",{spendManagement:Ei,common:ht}=je.getLocalizedStrings(),gt=Ei.billPay.bulkActions,Di=_.div`
81
81
  display: flex;
82
82
  min-height: 100%;
83
83
  width: 100%;
@@ -85,11 +85,11 @@ import{j as a}from"./liveblocks-B_acMj2M.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=X((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(_a(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(Ue)&&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=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(Pt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ue())})),[]);const p=$.getSignedInUser(),m=I((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:U}=v(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=v(S.isBillPayBulkActionEnabled),{isFeatureEnabled:G}=v(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:L}=v(S.isBillPayDetectInsufficientFundsEnabled),k=I((P=>Rt(P,ne,T,p?.userId))),{isFeatureEnabled:H}=v(S.isDebitCardFeatureEnabled),N=k.fetchState,{isAiCfoAccessEnabled:w,onAskAiCfoClick:O}=Ye({mobileExploreReferrer:"Bills List"});He({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,F=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=I((P=>ka(P.companyState,m.companyId))),Y=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}=I((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}.${Ue}`]:[],eventCallback:(P,de,et)=>{P.endsWith(Ue)?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(Xt,{}):F?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(De,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Ht.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Jt,{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:k.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:U,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:k.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:k.billBulkSubmissionLimit,bulkSubmissionFetchState:k.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:k.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:G,isDetectInsufficientFundsEnabled:L,isAiCfoAccessEnabled:w,onAskAiCfoClick:O,...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:N}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=_(ri)`
88
+ `,ji=X((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=H(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(_a(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(Ue)&&e(Ta(!1))},onEventReceived:o=>{o===ea&&e(ja())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}}))(Zn(Hn));function Ti(){const e=J(),t=se(),l=K(),n=ke(),c=l.state,r=ve(),[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=v((P=>H(P))),{areTenantIdsInSync:h}=Qn(),[g,b]=f.useState(!1),{useFeatureGate:I}=le(),{isFeatureEnabled:j}=I(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=I(S.isBillPayCommentingEnabled),{isFeatureEnabled:C}=I(S.isReimbursementCommentingEnabled),{isFeatureEnabled:U}=I(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=I(S.isBillPayBulkActionEnabled),{isFeatureEnabled:G}=I(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:L}=I(S.isBillPayDetectInsufficientFundsEnabled),k=v((P=>Rt(P,ne,T,p?.userId))),{isFeatureEnabled:W}=I(S.isDebitCardFeatureEnabled),N=k.fetchState,{isAiCfoAccessEnabled:w,onAskAiCfoClick:O}=Ye({mobileExploreReferrer:"Bills List"});We({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,F=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=v((P=>ka(P.companyState,m.companyId))),Y=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}=v((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}.${Ue}`]:[],eventCallback:(P,de,et)=>{P.endsWith(Ue)?et.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(P))}},aa=$t(W,m),na=Lt(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Xt,{}):F?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(De,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Kt,{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:k.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:U,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:k.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:k.billBulkSubmissionLimit,bulkSubmissionFetchState:k.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:k.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:G,isDetectInsufficientFundsEnabled:L,isAiCfoAccessEnabled:w,onAskAiCfoClick:O,...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:N}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=_(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=X((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=Na(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(Ot(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(Oe(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(Nt("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=_i(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ye(!1,i));const d=Ui(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=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(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Qa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("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:A}=u(Ce.zeniAccountsConfig),C=Ua(A),{configValue:U}=u(Ce.sameDayAchDisablementConfig),T=Ga(U),G=$.getSignedInUser(),L=I((Q=>W(Q))),k=I((Q=>Ne(Q,m,g,n))),H=Kt(L?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:N,onAskAiCfoClick:w}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:k.fetchState==="Completed"});const O=L.companyId??$.getSignedInUserTenant(c)?.companyId,M=!!L.companyZeniAccountInfo?.info?.isZeniAccountEnabled,F=Ie(),q=_t(F?.loggedInUserRoleMap),Y=Ut(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=I((Q=>Ma(Q.accountState,Q.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:Q=>(we=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&we.trackBillPayEditBill(n,k.isRecurring)})(Q)}),a.jsx($i,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:L,billId:n,companyId:O,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:Y,isBillPayAdmin:z,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:N,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},_i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},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(Xa)&&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:Ya(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},Ni=_.div`
92
+ `,{common:{currency:Se},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=je.getLocalizedStrings(),$i=X((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=Na(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,I=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=H(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:I,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(it(i));const d=yt(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ot(d,!1)),e(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(Oe(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(Ka({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Me("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Nt("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(Ja()),onClickDismiss:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(ye(!1,i));const d=_i(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(ye(!1,i));const d=Ui(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(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(i,d){e(qa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Kn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Wa(!0,i,l))},onSignUpAccountClick:()=>{t.hasZeniAccountsAdminAccess?window.open(`/${s}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{t.isZeniAccountsUser?window.open(`/${s}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ha("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Qa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("bill_pay","bill_pay_detail")),e(za({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Wn);function St(){const e=J(),t=K(),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:I}=r(S.isOurDisabled),{isFeatureEnabled:j}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(Ce.zeniAccountsConfig),C=Ua(A),{configValue:U}=u(Ce.sameDayAchDisablementConfig),T=Ga(U),G=$.getSignedInUser(),L=v((Q=>H(Q))),k=v((Q=>Ne(Q,m,g,n))),W=Jt(L?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:N,onAskAiCfoClick:w}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:k.fetchState==="Completed"});const O=L.companyId??$.getSignedInUserTenant(c)?.companyId,M=!!L.companyZeniAccountInfo?.info?.isZeniAccountEnabled,F=ve(),q=_t(F?.loggedInUserRoleMap),Y=Ut(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=v((Q=>Ma(Q.accountState,Q.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:Q=>(we=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&we.trackBillPayEditBill(n,k.isRecurring)})(Q)}),a.jsx($i,{initialOpenThreadRequest:W??void 0,location:t,navigate:e,currentTenant:L,billId:n,companyId:O,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:R,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:I,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:M,hasZeniAccountsAdminAccess:q,isZeniAccountsUser:Y,isBillPayAdmin:z,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:N,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},_i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},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(Xa)&&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:Ya(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=Jn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??Se.currencyCode,currencySymbol:o.currency?.currencySymbol??Se.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??Se.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??Se.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},Ni=_.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-B_acMj2M.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
- `,Oi=X((function(e,t){const{vendorId:l,billId:n}=t,c=ve(e,l),r=Ne(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=Xe(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())}}}))(Xn);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=Z(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(Ni,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Oi,{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=_.div`
101
+ `,Oi=X((function(e,t){const{vendorId:l,billId:n}=t,c=Ie(e,l),r=Ne(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=Xe(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())}}}))(Xn);function zi(){const e=J(),t=K(),l=ke(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=$.getSignedInUser(),s=v((g=>H(g))),i=Z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v((g=>Ie(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(Ni,{windowSize:l,children:[a.jsx(Ke,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Qi=_.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-B_acMj2M.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
- `,Zi=X((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=Xe(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())}}}))(Yn);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=Z(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",A=I((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(Je,{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},It=_.div`
110
+ `,Zi=X((function(e,t){const{vendorId:l}=t,n=Ie(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??It();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Xe(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??It(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Yn);function Hi(){const e=J(),t=K(),l=ke(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=$.getSignedInUser(),s=v((C=>H(C))),i=Z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=v((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),h=v((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,I]=f.useState(!1);f.useEffect((()=>{b||g==="In-Progress"||(I(!0),r(on(c,n)))}),[b,g,r]);const j=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=v((C=>Ie(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(Ke,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:j})]})}const It=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},vt=_.div`
111
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-B_acMj2M.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=X((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(Nt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ae(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=Z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(S.isRecurringBillsFeatureEnabled),b=I((A=>W(A))),v=I((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,U=v.totalAmount.amount,T=v.recipientTotalAmount.amount,G=v.invoiceNumber;A&&C&&t(mn(A,C,U,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(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=X((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=Xe(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=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(Ot(i,!1))}}}))(oi),Be=()=>{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=X((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&&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(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)&&Tn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,v=b&&_t(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(S.isChargeCardFeatureEnabled),A=si(e,j,o)&&!p,C=A&&Pn(t?.loggedInUserRoleMap),U=Fn(t?.loggedInUserRoleMap),T=Ut(t?.loggedInUserRoleMap),G=Rn(t?.loggedInUserRoleMap),L=b&&T,k=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&G,H=Vn(t?.loggedInUserRoleMap),N=$n(t?.loggedInUserRoleMap),w=Ln(t?.loggedInUserRoleMap),O=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:U,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:U,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ji,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:L,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:w,showTreasuryRoute:k,isTenantBankingOnly:s,showChargeCardRoute:O,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Xt,{})}),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(kt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(B,{appContent:a.jsx(kt,{})})}),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};
119
+ `,Wi=X((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(Nt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Ae(t.billId,"retry"))}}}))(ti);function kt(){const e=J(),t=se(),l=K(),{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=Z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(S.isRecurringBillsFeatureEnabled),b=v((A=>H(A))),I=v((A=>Qt(A,n))),j=I.fetchState??"Not-Started";if(f.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),f.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),f.useEffect((()=>{const A=I.vendor?.name,C=I.vendor?.id,U=I.totalAmount.amount,T=I.recipientTotalAmount.amount,G=I.invoiceNumber;A&&C&&t(mn(A,C,U,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(vt,{windowSize:o,children:a.jsx(ei,{})}):a.jsx(vt,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=X((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=H(e),o=$.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Ht.fileMicroServiceBaseUrl}`,authParams:i,analytics:D,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(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=Xe(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(kn({files:i}))},onEditFileName:(i,d)=>{e(vn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(In("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(fn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const i=Z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??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(Ot(i,!1))}}}))(oi),Be=()=>{const e=J(),t=se(),l=ai(),n=K(),{billId:c,vendorId:r}=ae(),u=v((b=>H(b))),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=v((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=v((b=>Ie(b,r))),h=v((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),g=r!==void 0?h:p;return f.useEffect((()=>{i===!1&&g==="Not-Started"&&r!=null&&(t(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(Ke,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=X((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),Ki=()=>{const e=J(),t=K(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=v((h=>H(h))),o=u.companyId??$.getSignedInUserTenant(l)?.companyId,s=$.getSignedInUser(),i=ve(),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(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ji,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function jo(){const e=v((F=>H(F))),t=ve(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:zi,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=$t(o,e),i=Lt(e),d=K(),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,I=b&&_t(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(S.isChargeCardFeatureEnabled),A=si(e,j,o)&&!p,C=A&&Pn(t?.loggedInUserRoleMap),U=Fn(t?.loggedInUserRoleMap),T=Ut(t?.loggedInUserRoleMap),G=Rn(t?.loggedInUserRoleMap),L=b&&T,k=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&G,W=Vn(t?.loggedInUserRoleMap),N=$n(t?.loggedInUserRoleMap),w=Ln(t?.loggedInUserRoleMap),O=A&&W,{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:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:L,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:w,showTreasuryRoute:k,isTenantBankingOnly:s,showChargeCardRoute:O,tenantEmailDomain:M??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:I,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Xt,{})}),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(kt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(B,{appContent:a.jsx(kt,{})})}),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-B_acMj2M.js";import{a as V}from"./sentry-B7X8e_7J.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-u1EteL-v.js";import{e as ce,A as ue,aS as de,z,C as pe,f as B,ag as E,h as x,bH as le,au as me,r as P,av as U}from"./index-tOfK8iY_.js";import{Qe as fe,eZ as G,tV as ye,KC as Se,zU as ge,Dj as Ie,G4 as he,GJ as be,HJ as Te,QB as De,QC as Oe,QD as Ce,QE as ke,QF as Ve,N3 as Ae,PG as Ne,Ni as we,En as Fe,Nj as _e,Er as ve,lm as Ee,gl as xe,gk as ze,gj as Be,rW as Pe,rN as Ue,rK as Re,le as je,u2 as Le,u0 as R,bE as j,ue as L,cA as Me}from"./zeni-epic-state-DiB-ZYnx.js";import{n as Ge}from"./mui-DMXXvJHn.js";import{d as M}from"./routePaths-FKPzluZv.js";import{M as Qe}from"./MobileAppDrawer-DKR412hC.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]="24243581-4d35-42a1-b9f0-b80525723bec",t._sentryDebugIdIdentifier="sentry-dbid-24243581-4d35-42a1-b9f0-b80525723bec")}catch{}})();const Ze=Ge.div`
1
+ import{j as C}from"./liveblocks-DJbBe3tc.js";import{a as V}from"./sentry-C6T1HHHS.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-BfWJ7zKT.js";import{D as ce,w as ue,aS as de,z,A as pe,f as B,ag as x,h as E,bH as le,au as me,v as P,av as R}from"./index-DWJVmwhz.js";import{Qu as fe,e$ as G,t_ as ye,KP as Se,zZ as ge,Do as Ie,G9 as he,GO as Te,HO as be,QR as De,QS as Oe,QT as Ce,QU as ke,QV as Ve,Ng as we,PW as Ae,Nv as Ne,Es as _e,Nw as ve,Ew as Fe,lr as xe,gn as Ee,gm as ze,gl as Be,r$ as Pe,rS as Re,rP as Ue,lj as je,u7 as Le,u5 as U,bE as j,uj as L,cB as Me}from"./zeni-epic-state-kow6PLud.js";import{n as Ge}from"./mui-ts7KHm6i.js";import{d as M}from"./routePaths-DqVKIcAE.js";import{M as Qe}from"./MobileAppDrawer-CinzTjr5.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]="3718da47-8feb-4225-9861-4a01ac92e6d8",t._sentryDebugIdIdentifier="sentry-dbid-3718da47-8feb-4225-9861-4a01ac92e6d8")}catch{}})();const $e=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-B_acMj2M.js";import{a as V}from"./sentry-B7X8e_7
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${t=>t.theme.colors.grey4};
9
- `,qe=re((function(t,u){const{businessVerificationDetails:n}=u,i=G(t),y=z.getSignedInUser(),S=i.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=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:l,isDisabled:b,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:l}=u,{tenantEmailDomain:b}=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:T,syncToken:f,fileIds:a,incDate:p,typeOfIncorporation:A,stateOfIncorporation:N,sourceOfFunds:w,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:Z,transactionVolume:q,transactionVolumeDescription:H,purposeOfAccount:J,purposeOfAccountDescription:K,regulatedStatus:W,regulatedStatusDescription:$,usNexus:X,usNexusTypes:Y}=e,_=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?Me(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:p!=null?j(p?.toString()):p,typeOfIncorporation:A?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:w?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:U(v)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:q?.selectedOption??"",transactionVolumeDescription:H,purposeOfAccount:J?.selectedOption??"",purposeOfAccountDescription:K,regulatedStatus:W??"",regulatedStatusDescription:$,usNexus:X,usNexusTypes:Y?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:T};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:T,selectDocument:f,role:a,ownership:p,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?U(I.selectedOption):void 0,phone:c,birthday:o!=null?j(o?.toString()):o,syncToken:T,titleAtCompany:a.selectedOption,ownershipInCompany:p,documentTypeSelectedForVerification:h,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(L({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=M(b,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=M(b,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Le({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(je({files:e}))},onDeleteFile:e=>{t(Re(e))},onDeleteFileList:e=>{t(Ue(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}))}}}))(le),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[l,b]=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(Te(o,!0));break;case"zeni_treasury":i(be(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 T=a=>{b(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(Ze,{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(Qe,{isAppContentDrawerOpen:l,handleDrawerToggle:T}):null,C.jsx(qe,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{T(!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,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},T=we(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Ae(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:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:_,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:$,transactionVolume:Z,transactionVolumeDescription:q,purposeOfAccount:H,purposeOfAccountDescription:W,regulatedStatus:K,regulatedStatusDescription:J,usNexus:X,usNexusTypes:Y}=e,v=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?Me(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:p!=null?j(p?.toString()):p,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:_?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((F=>F.length===2?F:R(F)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:$,transactionVolume:Z?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:W,regulatedStatus:K??"",regulatedStatusDescription:J,usNexus:X,usNexusTypes:Y?.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:w,userVerificationStatus:A,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?j(o?.toString()):o,syncToken:b,titleAtCompany:a.selectedOption,ownershipInCompany:p,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,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=M(T,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=M(T,e),d=P(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Le({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(je({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(Ee(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(xe({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=ve(e.documentType);s!=null&&t(Fe({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=>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($e,{children:[C.jsx(pe,{analytics:B,onLoad:a=>(p=>{switch(t){case"zeni_accounts":return p.trackPageLoaded(E.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return p.trackPageLoaded(E.Event.reimbursementBusinessVerification);default:return p.trackPageLoaded(E.Event.billPayBusinessVerification,x(n)?"Settings":void 0)}})(a)}),x(n)?C.jsx(Qe,{isAppContentDrawerOpen:l,handleDrawerToggle:b}):null,C.jsx(Ze,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:x(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{b(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-B_acMj2M.js";import{a as l}from"./sentry-B7X8e_7J.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-u1EteL-v.js";import{Z as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,C as we,f as $,dj as H,dt as Ee,O as ke,h as Ae,a9 as Te,dm as xe,dn as Ue,a4 as _e,dr as Oe,b6 as ve,ds as Qe}from"./index-tOfK8iY_.js";import{gp as Fe,eY as G,eZ as $e,fs as De,iR as Le,iN as Ve,e_ as N,g9 as je,g1 as Re,g5 as B,ga as qe,gc as Me,gd as He,ge as Ne,gf as Be}from"./zeni-epic-state-DiB-ZYnx.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-DMXXvJHn.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="221b025b-0d33-4c5e-9e01-ffe0a9d682c1",e._sentryDebugIdIdentifier="sentry-dbid-221b025b-0d33-4c5e-9e01-ffe0a9d682c1")}catch{}})();const Y="chat-response-generated",Z="cards/ask",X="card_policy_hero";function D(e){return`/${e}/cards`}function J(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===X?J(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Be({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(B(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(B(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${Z}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:K,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=K.pageTitle,Ze=ee.pageTitle,Xe=K.chatHeaderSubtitle,Je=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(Fe())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===X,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ze:A,subtitle:I?Je:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${Z}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?J(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(N(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Ke,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(N(n.userRoleId)),h(!1)}})})})]})},Ke=L(Ge)`
1
+ import{j as g}from"./liveblocks-DJbBe3tc.js";import{a as l}from"./sentry-C6T1HHHS.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-BfWJ7zKT.js";import{W as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,A as we,f as $,dj as H,dt as Ee,a as Ae,h as Te,a9 as ke,dm as xe,dn as Ue,a4 as _e,dr as Oe,b6 as ve,ds as Qe}from"./index-DWJVmwhz.js";import{gr as Fe,e_ as G,e$ as $e,fu as De,iT as Le,iP as Ve,f0 as B,gb as je,g3 as Re,g7 as N,gc as qe,ge as Me,gf as He,gg as Be,gh as Ne}from"./zeni-epic-state-kow6PLud.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-ts7KHm6i.js";import"./recharts-DNnhB5R_.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="1df07971-366d-4056-91f9-756ad9301ecb",e._sentryDebugIdIdentifier="sentry-dbid-1df07971-366d-4056-91f9-756ad9301ecb")}catch{}})();const Y="chat-response-generated",Z="cards/ask",J="card_policy_hero";function D(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${Z}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:k,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(ke(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=Ae.getLocalizedStrings(),T=X.pageTitle,Ze=ee.pageTitle,Je=X.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(Fe())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ze:T,subtitle:I?Ke:Je})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,A=l.useRef(null);l.useEffect((()=>{if(S&&A.current!=null){const{question:r,shouldSubmit:w}=A.current;A.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${Z}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Te.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:T,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>{c(I?K(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(A.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Xe,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Xe=L(Ge)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;