@zeniai/web-app-ui 5.1.44-qa → 5.1.45-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 (118) hide show
  1. package/dist/assets/AddressRoutes-CMaX3PoD.js +1 -0
  2. package/dist/assets/AddressScreen-C3jTD0QX.js +9 -0
  3. package/dist/assets/{AiCfoScreen-BPdC66wo.js → AiCfoScreen-BtMMWn6B.js} +5 -5
  4. package/dist/assets/{BillPayApprovalRoutes-QJ1EpW6M.js → BillPayApprovalRoutes-DU855VPd.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-Bna0uGqV.js → BillPayRoutes-DzxfBsX4.js} +8 -8
  6. package/dist/assets/{BusinessVerificationPageScreen-0dmMGz8A.js → BusinessVerificationPageScreen-BiME3gzl.js} +2 -2
  7. package/dist/assets/{CardsAiCfoScreen-BtSV6YdK.js → CardsAiCfoScreen-Dk4_VP17.js} +3 -3
  8. package/dist/assets/{ChargeCardRoutes-DKr2nu1e.js → ChargeCardRoutes-BozcfSlm.js} +1 -1
  9. package/dist/assets/CompanyPassportScreen-DNxF2lkY.js +1 -0
  10. package/dist/assets/{ConnectionAuthScreen-BYP_nDK9.js → ConnectionAuthScreen-DXqmojb9.js} +1 -1
  11. package/dist/assets/CustomerOnboardingAuthScreen-B-ksGe-B.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-CxS9lLTl.js → CustomerOnboardingRoutes-_VvrC-ga.js} +3 -3
  13. package/dist/assets/{DashboardRoutes-D2v4ZF_E.js → DashboardRoutes-Dovp7HGT.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-Dbi3Jzbe.js → DefaultTenantHome-D8-0czPn.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-D62ComgW.js +18 -0
  16. package/dist/assets/DrawerScreen-Bzib8YfV.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-BJQoxnJC.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-CUBrIS6y.js → ExpenseAutomationRoutes-BEvk-l6F.js} +4 -4
  19. package/dist/assets/{FeaturePreviewScreen-AUOPnl37.js → FeaturePreviewScreen-KfiUQgFU.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-IFaSwoId.js → HubSpotOAuthCallbackScreen-Cn6vvoeb.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-BIAaZldq.js → MagicLinkRoutes-DmvvOL_Y.js} +6 -6
  22. package/dist/assets/MagicLinkSignInScreen-BTFCnths.js +12 -0
  23. package/dist/assets/{MobileAppDrawer-CLztF99b.js → MobileAppDrawer-DY_LJNf1.js} +1 -1
  24. package/dist/assets/NotFoundScreen-98Ef_Sqs.js +1 -0
  25. package/dist/assets/{NotificationRoutes-Bt0oSYPF.js → NotificationRoutes-BkpJw4hc.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-GPiaPY5A.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-DE9xTiJG.js +1 -0
  28. package/dist/assets/{PeopleRoutes-Dj-CT0eD.js → PeopleRoutes--3fASQ5h.js} +3 -3
  29. package/dist/assets/{PerformanceRoutes-DsWM-lYk.js → PerformanceRoutes-zr7-gR8p.js} +1 -1
  30. package/dist/assets/{Preview-CFdBsxvl.js → Preview-B1kObDl3.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-eD76plFQ.js → QBOConnectionScreen-Bn0720kQ.js} +1 -1
  32. package/dist/assets/{ReferralListScreen-DxoomfXt.js → ReferralListScreen-B9-Pm2jb.js} +2 -2
  33. package/dist/assets/{ReimbursementApprovalRoutes-B7uUwiM0.js → ReimbursementApprovalRoutes-DgN-DZyX.js} +1 -1
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js → ReimbursementApprovalRuleDetailScreen-B-QO8l6D.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes-Dh1G5yct.js → ReimbursementRoutes-C_8B-Cx9.js} +4 -4
  36. package/dist/assets/{ReportsRoutes-y7MnzGll.js → ReportsRoutes-3IlP_YGU.js} +1 -1
  37. package/dist/assets/RewardsRoutes-Bn0Tad-r.js +1 -0
  38. package/dist/assets/{ScreenRoutes-B-k_ZyHL.js → ScreenRoutes-BZhSovog.js} +2 -2
  39. package/dist/assets/{SettingsRoutes-X4MKf4TH.js → SettingsRoutes-D8sH0k-9.js} +4 -4
  40. package/dist/assets/{SetupPagesScreen-Uer5YsTX.js → SetupPagesScreen-CyzzOWiJ.js} +5 -5
  41. package/dist/assets/SignInScreen-B7g5AeOc.js +1 -0
  42. package/dist/assets/SignOutScreen-Kk_O7nh6.js +9 -0
  43. package/dist/assets/{TaskListScreen-CoC_5M60.js → TaskListScreen-VdSyXs6p.js} +2 -2
  44. package/dist/assets/{TaskRoutes-DEDS1cCa.js → TaskRoutes-BEWp0wJa.js} +2 -2
  45. package/dist/assets/{TransactionDetailRoutes-BMVLeepD.js → TransactionDetailRoutes-DZjZQ9RI.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-BOsA-UF4.js → TransactionDetailScreen-idWMKJZo.js} +2 -2
  47. package/dist/assets/TransactionListRoutes-BhOdNCNy.js +1 -0
  48. package/dist/assets/{TreasuryRoutes-CzaTrrCq.js → TreasuryRoutes-BQN9aD4y.js} +5 -5
  49. package/dist/assets/{VendorsRoutes-CA2szW0j.js → VendorsRoutes-CavsRr3z.js} +10 -10
  50. package/dist/assets/WiseConfirmationScreen-Donx26qC.js +12 -0
  51. package/dist/assets/{ZeniAccountRoutes-B92jFFWR.js → ZeniAccountRoutes-CYGjvO6a.js} +9 -9
  52. package/dist/assets/{ZeniAccountStatementScreen-Czxe84tm.js → ZeniAccountStatementScreen-BBbz4J4l.js} +1 -1
  53. package/dist/assets/{accountMappingHelper-CUOH4oaZ.js → accountMappingHelper-Bg3QrS2B.js} +1 -1
  54. package/dist/assets/{analytics-CVef-z80.js → analytics-CR-Ji6KN.js} +1 -1
  55. package/dist/assets/{analyticsHelper-DO0i_Ozz.js → analyticsHelper-BkTwMm2V.js} +1 -1
  56. package/dist/assets/{core-BZimyUuM.js → core-B1V19BTM.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-CfH0YvB4.js → decodeURIComponentSafe-62zSMNJP.js} +1 -1
  58. package/dist/assets/{dnd-Ck7mLEKI.js → dnd-DY5CyMCW.js} +1 -1
  59. package/dist/assets/{empty-CDMj19T8.js → empty-BKpizSQk.js} +1 -1
  60. package/dist/assets/{empty-B1O8rDIf.js → empty-DJY9ZnQE.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-DHeCITuJ.js → emptyVideoElement-DyEXr5u4.js} +1 -1
  62. package/dist/assets/{epic-C8TvJLbh.js → epic-BoLhMkLB.js} +1 -1
  63. package/dist/assets/getLocaleForTenant-BaJta4jx.js +1 -0
  64. package/dist/assets/{index-aKhhTDIh.js → index-B1BV6O_s.js} +11648 -11648
  65. package/dist/assets/{index-DUwckqJX.js → index-B32kgZ2L.js} +1 -1
  66. package/dist/assets/{index-B4buEPtI.js → index-BWk0p_4u.js} +1 -1
  67. package/dist/assets/{index-W-rD4OTh.js → index-C1O76jd1.js} +1 -1
  68. package/dist/assets/{index-BX9FlrZ4.js → index-CUT1Jf2m.js} +2 -2
  69. package/dist/assets/{index-ky9cAsxd.js → index-Cd64f4Pj.js} +1 -1
  70. package/dist/assets/{index-CGgy5RAo.js → index-Rl-vwFod.js} +1 -1
  71. package/dist/assets/{index-BHYDqIxo.js → index-jGxvchTd.js} +1 -1
  72. package/dist/assets/{lexical-D_s6IbSB.js → lexical-DtEMPKph.js} +1 -1
  73. package/dist/assets/{liveblocks-PtDFv95_.js → liveblocks-DtJmjn-F.js} +1 -1
  74. package/dist/assets/{lottie-D7iBAvwy.js → lottie-PNrYlsmY.js} +1 -1
  75. package/dist/assets/{mui-BcLZDyi8.js → mui-D6ES9V4N.js} +1 -1
  76. package/dist/assets/{pathToGoBack-Bmk3vSys.js → pathToGoBack-BkwIN_c3.js} +1 -1
  77. package/dist/assets/{pdf-CPbk6pQ4.js → pdf-C3786_Gz.js} +4 -4
  78. package/dist/assets/{pdf-lib-DYmF-pgM.js → pdf-lib-D3JDQVpu.js} +1 -1
  79. package/dist/assets/{plaid-CooQT--5.js → plaid-Cvs9FZAe.js} +1 -1
  80. package/dist/assets/{pusher-KpZt7gt8.js → pusher-DQiFD9Ci.js} +1 -1
  81. package/dist/assets/{react-CgKzDvVo.js → react-BQWMbpQu.js} +1 -1
  82. package/dist/assets/{react-1GR8h5rv.js → react-CTxsS9D9.js} +1 -1
  83. package/dist/assets/{react-jDouMY6r.js → react-DkNWIPJu.js} +1 -1
  84. package/dist/assets/{react-xjRx_xkd.js → react-ZHmjCTUq.js} +1 -1
  85. package/dist/assets/{react-C5ff31Q5.js → react-nBgf2eOj.js} +1 -1
  86. package/dist/assets/{react-BByj9tRX.js → react-nsy5XQiM.js} +1 -1
  87. package/dist/assets/{recharts-Nefi66IQ.js → recharts-C_sYuD8f.js} +1 -1
  88. package/dist/assets/{routePaths-DQbleX1q.js → routePaths-BaN0YLzj.js} +1 -1
  89. package/dist/assets/{sentry-mCXLUbmc.js → sentry-DJoVhts9.js} +1 -1
  90. package/dist/assets/{url-V8qFg-31.js → url-CZfStJg6.js} +1 -1
  91. package/dist/assets/{url-DwL5mRAv.js → url-Dh3D7a-t.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js → useAiCfoDashboardSuggestedQuestionsChips-B-gQ2ZCu.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-B1ysHqFw.js +1 -0
  94. package/dist/assets/{useDeviceId-r7OfXqIX.js → useDeviceId-zuDOu7ni.js} +1 -1
  95. package/dist/assets/{useInitialThreadRequest-ClxKOF2S.js → useInitialThreadRequest-BrZkGF4L.js} +1 -1
  96. package/dist/assets/{utils-C9yOAUzR.js → utils-B1ItiyXC.js} +1 -1
  97. package/dist/assets/{withTransactionSidePanel-CCFVon-p.js → withTransactionSidePanel-CUAVvG-3.js} +4 -4
  98. package/dist/assets/{zeni-epic-state-D1RAQ_Ab.js → zeni-epic-state-Ct7fOB-u.js} +3 -3
  99. package/dist/index.html +1 -1
  100. package/package.json +3 -3
  101. package/dist/assets/AddressRoutes-B61fN_Ku.js +0 -1
  102. package/dist/assets/AddressScreen-BF-3RAYM.js +0 -9
  103. package/dist/assets/CompanyPassportScreen-BOxFkTz6.js +0 -1
  104. package/dist/assets/CustomerOnboardingAuthScreen-4HAF86rh.js +0 -1
  105. package/dist/assets/DomesticWireDetailScreen-BHpce-fZ.js +0 -18
  106. package/dist/assets/DrawerScreen-QceXJJGv.js +0 -1
  107. package/dist/assets/EntityDetailRoutes-cFyrvi31.js +0 -1
  108. package/dist/assets/MagicLinkSignInScreen-BVEM6zNA.js +0 -12
  109. package/dist/assets/NotFoundScreen-BVW1mHQl.js +0 -1
  110. package/dist/assets/OAuthConsentScreen-86UCYr7M.js +0 -1
  111. package/dist/assets/PandLWithForecastRoutes-DDpGKk3b.js +0 -1
  112. package/dist/assets/RewardsRoutes-Fh9U07tc.js +0 -1
  113. package/dist/assets/SignInScreen-BpX_mdSj.js +0 -1
  114. package/dist/assets/SignOutScreen-gWOZtfBm.js +0 -9
  115. package/dist/assets/TransactionListRoutes-D-o7gV2V.js +0 -1
  116. package/dist/assets/WiseConfirmationScreen-BcU-8yI5.js +0 -12
  117. package/dist/assets/getLocaleForTenant-B-mnTkE0.js +0 -1
  118. package/dist/assets/useAskAiCfoHostNavButtonProps-BY9akMo_.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DtJmjn-F.js";import{A as d}from"./AddressScreen-C3jTD0QX.js";import i from"./NotFoundScreen-98Ef_Sqs.js";import"./sentry-DJoVhts9.js";import{o as s,p as r}from"./core-B1V19BTM.js";import"./zeni-epic-state-Ct7fOB-u.js";import"./recharts-C_sYuD8f.js";import"./index-B1BV6O_s.js";import"./mui-D6ES9V4N.js";import"./analytics-CR-Ji6KN.js";import"./plaid-Cvs9FZAe.js";import"./dnd-DY5CyMCW.js";import"./stripe-DMRn4zHo.js";import"./lottie-PNrYlsmY.js";import"./lexical-DtEMPKph.js";import"./pdf-C3786_Gz.js";import"./utils-B1ItiyXC.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 r}from"./liveblocks-DtJmjn-F.js";import{a as h}from"./sentry-DJoVhts9.js";import{h as P,u as _,g as j,i as E,j as L,n as B}from"./core-B1V19BTM.js";import{J as M,m as $,z as D,A as K,B as R,w as z,e as C,g as m,S as F,i as b,p as N}from"./index-B1BV6O_s.js";import{LX as w,hM as U,eT as G,LY as O,c3 as V,LZ as q,l5 as H}from"./zeni-epic-state-Ct7fOB-u.js";import{n as J}from"./mui-D6ES9V4N.js";import X from"./NotFoundScreen-98Ef_Sqs.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]="745f5870-5fd2-4ec7-9d56-c64ecd9b94a5",e._sentryDebugIdIdentifier="sentry-dbid-745f5870-5fd2-4ec7-9d56-c64ecd9b94a5")}catch{}})();const Y=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
+ `,Z=B(function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=G(e),a=t.roleMap!=null&&O(t.roleMap),d=i||c==="user_address"||V(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=q(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=w(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}},function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,n=N(d?.pathnameStackToGoBack);let s=n.poppedPathname??I();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(s=`${s}?${g}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=Q(a);e(H({addressType:c,addressToCreate:d})),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 re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=P(),d=_(),n=j(),{addressId:s,addressType:u}=E(),g=M(),k=$(),v=D.getSignedInUser(),[f,x]=h.useState(s==null),p=L(S=>s!=null?w(S,s).fetchState:"Not-Started"),A=K();if(v==null)throw Error("Can't access address page without signing in...");const T=S=>S.trackPageLoaded(s!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return h.useEffect(()=>{f||s==null||(x(!0),d(U(s,!1)))},[f,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!f&&p==="Not-Started"||f&&p==="In-Progress"?r.jsx(R,{fetchState:p,style:{backgroundColor:k.colors.grey5}}):s!=null&&p==="Error"?(a(`${I(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(z,{analytics:C,onLoad:T}),r.jsx(Y,{windowSize:g,children:r.jsx(Z,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):r.jsx(X,{})}const I=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},Q=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,Q as t};
@@ -1,22 +1,22 @@
1
- import{j as d}from"./liveblocks-PtDFv95_.js";import{a as l}from"./sentry-mCXLUbmc.js";import{u as ge,h as Ce,g as Ie,j as Y,i as be,n as ke}from"./core-BZimyUuM.js";import{V as we,z as xe,J as Pe,d2 as ye,d3 as Ee,b6 as J,d4 as Te,b5 as K,p as D,v as L,d as I,d5 as F,d6 as ve,d7 as Qe,a1 as _e,f as Ae,a7 as Oe,d8 as Ue,a2 as je,d9 as Le,da as Fe,q as Be,b1 as De,db as Re}from"./index-aKhhTDIh.js";import{gg as Me,eS as ee,eT as Ve,is as Ge,S_ as $e,eZ as Ne,iC as qe,iy as We,eU as B,f4 as ze,fV as He,fy as Ye,fC as X,fW as Je,fX as Xe,fY as Ze,fZ as Ke,f_ as et}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as tt,n as b,S as st,P as ot}from"./mui-BcLZDyi8.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js";import{p as nt}from"./pathToGoBack-Bmk3vSys.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="acc00ddb-6492-46e1-b8f0-5a8615eb2936",t._sentryDebugIdIdentifier="sentry-dbid-acc00ddb-6492-46e1-b8f0-5a8615eb2936")}catch{}})();const te="chat-response-generated",it=ke(function(t,r){const s=ee(t),m=r.isSubmitting,n=s.uiState?.currentChatSessionId,p=n!=null?ze(t.aiCfoState,n):[];return{showSampleQuestions:r.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:m,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${je}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,syntheticAnswers:p,resolveSyntheticAnswerCardTile:Fe(t),resolveSyntheticAnswerPolicyTile:Le(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:c,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,S)=>{if(e===te&&typeof S.text=="string"&&typeof S.metadata=="object"){const a=S,u=Xe(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:k,currentQuestionAnswerSummary:E}=K(c,o);u!=="answer"?I.trackAICFOChatResponseGenerated(u,k?.question.questionText??"",a.text,o,Re(E,y),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,k?.question.questionText??"",(a.follow_up_questions?.length??0)>0,!!a.assumptions,!!a.insights,a.visualization!=null,Ze(a.visualization?.type??"")??null,o,a.summarized_title,a.metadata.message_id??null),t(Ke({chatSessionId:a.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,S,a,u)=>{e&&De(t,e,S,h,c,n,u,a)},updateCurrentInput:e=>{t(X(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Je(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??nt(1);p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(X(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&t(Ye());const e=Be(s.state?.pathnameStackToGoBack,s.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,S)=>{t(He({questionAnswerId:e,isCollapsed:S}))},onMenuClick:r.onMenuClick}})(Oe(Ue)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,h]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const c=Y(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=be(),S=Pe(),a=_e(S),u=Y(i=>Ve(i)),o=c.uiState.currentChatSessionId,y=u.tenantEmailDomain,{handleUploadPromoClose:k,isUploadPromoVisible:E}=ye({isFileUploadEnabled:t,tenantEmailDomain:y}),T=Ee({currentTenant:u,currentChatSessionId:o,aiCfoView:c}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[J]!==!0)return;h(!0);const g={...i};delete g[J],m(n,{replace:!0,state:g})},[n.pathname,n.search,n.state,m]);const[ae,v]=l.useState(null),[ne,Q]=l.useState(!1),[ie,_]=l.useState(void 0),[re,A]=l.useState(void 0),M=l.useRef(!1);l.useEffect(()=>{if(!M.current&&x!=null&&x!==""){const i=n.state;v(x),Q(R),_(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const g=i?.aiCfoSuggestionIndex;A(typeof g=="number"?g:void 0),M.current=!0}},[x,R,n.state]);const le=l.useCallback(()=>{v(null),Q(!1),_(void 0),A(void 0)},[]),V=l.useMemo(()=>new URLSearchParams(n.search),[n.search]),G=V.get("ref")??w?.aiCfoRef,O=V.get("emailRefId")??w?.aiCfoEmailRefId,$=l.useRef(!1);l.useEffect(()=>{$.current||G!=="month-end-email"||O==null||o!=null||f==null||(s(Ge("controller",f.userId,O,"MONTH_END_EMAIL")),$.current=!0)},[G,O,o,s,f]);const P=c.uiState.lastContextMessage;l.useEffect(()=>{P!=null&&P!==""&&o!=null&&(v(P),Q(!0),_(void 0),A(void 0),s($e()))},[P,o,s]);const de=u.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),U=c.fetchState,j=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=o!=null?c.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(c.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ue}=K(z,o),ce=ue.length===0;l.useEffect(()=>{C||a||m("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})},[C,a,m,n.state]);const me=l.useCallback(()=>{const i=D(n.state?.pathnameStackToGoBack),g=u.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[u.tenantEmailDomain,n.state,m]);l.useEffect(()=>{o!=null&&e!==o&&m(`../ai-cfo/${o}`,{state:{...n.state}})},[o,e]),l.useEffect(()=>{e!=null&&o==null&&e!=="new_chat"&&e!=="explore"&&s(Ne({sessionId:e,agentId:"controller"}))},[]);const pe=l.useMemo(()=>({events:N.map(i=>`private-encrypted-chat-${i}.${te}`),eventCallback:(i,g,fe)=>fe.onEventReceived(i,g)}),[N]);l.useEffect(()=>{U!=="In-Progress"&&j&&s(qe())},[U,j,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&U==="Completed"&&!j&&s(We(o,f.userId))},[q,W,o,f,s]);const H=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(f==null||e==null)throw Error("Can't access AI Controller page without signing in...");const Se=o!=null&&c.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(L,{analytics:I,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(F,{isTOSAccepted:!1,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{u.userRoleId!=null&&s(B(u.userRoleId))}})})})]});const he=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(L,{analytics:I,onLoad:H}):null,d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>h(!1):void 0,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(L,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>h(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:Se,isEmptyChatWithSession:ce,currentTenant:u,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:E,onUploadPromoClose:k,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ut,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>h(!1),children:d.jsx(Qe,{children:he})}):null]})},Z=b(st)`
1
+ import{j as c}from"./liveblocks-DtJmjn-F.js";import{a as l}from"./sentry-DJoVhts9.js";import{u as ge,h as Ce,g as Ie,j as Y,i as ke,n as be}from"./core-B1V19BTM.js";import{V as we,z as xe,J as Pe,d2 as ye,d3 as Ee,b6 as J,d4 as Te,b5 as K,p as D,w as L,e as I,d5 as F,d6 as ve,d7 as Qe,a1 as _e,g as Ae,a7 as Oe,d8 as Ue,a2 as je,d9 as Le,da as Fe,n as Be,b1 as De,db as Re}from"./index-B1BV6O_s.js";import{gg as Me,eS as ee,eT as Ve,is as Ge,S_ as $e,eZ as Ne,iC as qe,iy as We,eU as B,f4 as ze,fV as He,fy as Ye,fC as X,fW as Je,fX as Xe,fY as Ze,fZ as Ke,f_ as et}from"./zeni-epic-state-Ct7fOB-u.js";import{D as tt,n as k,S as st,P as ot}from"./mui-D6ES9V4N.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-B-gQ2ZCu.js";import{p as nt}from"./pathToGoBack-BkwIN_c3.js";import"./recharts-C_sYuD8f.js";import"./analytics-CR-Ji6KN.js";import"./plaid-Cvs9FZAe.js";import"./dnd-DY5CyMCW.js";import"./stripe-DMRn4zHo.js";import"./lottie-PNrYlsmY.js";import"./lexical-DtEMPKph.js";import"./pdf-C3786_Gz.js";import"./utils-B1ItiyXC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="4cfe2af2-c441-43c4-a87f-4dcad049dacf",t._sentryDebugIdIdentifier="sentry-dbid-4cfe2af2-c441-43c4-a87f-4dcad049dacf")}catch{}})();const te="chat-response-generated",it=be(function(t,r){const s=ee(t),m=r.isSubmitting,n=s.uiState?.currentChatSessionId,p=n!=null?ze(t.aiCfoState,n):[];return{showSampleQuestions:r.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:m,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${je}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,syntheticAnswers:p,resolveSyntheticAnswerCardTile:Fe(t),resolveSyntheticAnswerPolicyTile:Le(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:u,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,S)=>{if(e===te&&typeof S.text=="string"&&typeof S.metadata=="object"){const a=S,d=Xe(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:b,currentQuestionAnswerSummary:E}=K(u,o);d!=="answer"?I.trackAICFOChatResponseGenerated(d,b?.question.questionText??"",a.text,o,Re(E,y),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,b?.question.questionText??"",(a.follow_up_questions?.length??0)>0,!!a.assumptions,!!a.insights,a.visualization!=null,Ze(a.visualization?.type??"")??null,o,a.summarized_title,a.metadata.message_id??null),t(Ke({chatSessionId:a.metadata.chat_session_id,responseType:d,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,S,a,d)=>{e&&De(t,e,S,h,u,n,d,a)},updateCurrentInput:e=>{t(X(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Je(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??nt(1);p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(X(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&t(Ye());const e=Be(s.state?.pathnameStackToGoBack,s.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,S)=>{t(He({questionAnswerId:e,isCollapsed:S}))},onMenuClick:r.onMenuClick}})(Oe(Ue)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,h]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const u=Y(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=ke(),S=Pe(),a=_e(S),d=Y(i=>Ve(i)),o=u.uiState.currentChatSessionId,y=d.tenantEmailDomain,{handleUploadPromoClose:b,isUploadPromoVisible:E}=ye({isFileUploadEnabled:t,tenantEmailDomain:y}),T=Ee({currentTenant:d,currentChatSessionId:o,aiCfoView:u}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[J]!==!0)return;h(!0);const g={...i};delete g[J],m(n,{replace:!0,state:g})},[n.pathname,n.search,n.state,m]);const[ae,v]=l.useState(null),[ne,Q]=l.useState(!1),[ie,_]=l.useState(void 0),[re,A]=l.useState(void 0),M=l.useRef(!1);l.useEffect(()=>{if(!M.current&&x!=null&&x!==""){const i=n.state;v(x),Q(R),_(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const g=i?.aiCfoSuggestionIndex;A(typeof g=="number"?g:void 0),M.current=!0}},[x,R,n.state]);const le=l.useCallback(()=>{v(null),Q(!1),_(void 0),A(void 0)},[]),V=l.useMemo(()=>new URLSearchParams(n.search),[n.search]),G=V.get("ref")??w?.aiCfoRef,O=V.get("emailRefId")??w?.aiCfoEmailRefId,$=l.useRef(!1);l.useEffect(()=>{$.current||G!=="month-end-email"||O==null||o!=null||f==null||(s(Ge("controller",f.userId,O,"MONTH_END_EMAIL")),$.current=!0)},[G,O,o,s,f]);const P=u.uiState.lastContextMessage;l.useEffect(()=>{P!=null&&P!==""&&o!=null&&(v(P),Q(!0),_(void 0),A(void 0),s($e()))},[P,o,s]);const ce=d.masterTOSInfo,C=ce?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),U=u.fetchState,j=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,q=o!=null?u.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(u.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:de}=K(z,o),ue=de.length===0;l.useEffect(()=>{C||a||m("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})},[C,a,m,n.state]);const me=l.useCallback(()=>{const i=D(n.state?.pathnameStackToGoBack),g=d.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[d.tenantEmailDomain,n.state,m]);l.useEffect(()=>{o!=null&&e!==o&&m(`../ai-cfo/${o}`,{state:{...n.state}})},[o,e]),l.useEffect(()=>{e!=null&&o==null&&e!=="new_chat"&&e!=="explore"&&s(Ne({sessionId:e,agentId:"controller"}))},[]);const pe=l.useMemo(()=>({events:N.map(i=>`private-encrypted-chat-${i}.${te}`),eventCallback:(i,g,fe)=>fe.onEventReceived(i,g)}),[N]);l.useEffect(()=>{U!=="In-Progress"&&j&&s(qe())},[U,j,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&U==="Completed"&&!j&&s(We(o,f.userId))},[q,W,o,f,s]);const H=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(f==null||e==null)throw Error("Can't access AI Controller page without signing in...");const Se=o!=null&&u.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return c.jsxs(lt,{children:[c.jsx(L,{analytics:I,onLoad:H}),T.drawerElement,c.jsx(ct,{children:c.jsx(Z,{children:c.jsx(F,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{d.userRoleId!=null&&s(B(d.userRoleId))}})})})]});const he=c.jsxs(c.Fragment,{children:[p&&!C?c.jsx(L,{analytics:I,onLoad:H}):null,c.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>h(!1):void 0,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||d.userRoleId==null||s(B(d.userRoleId)),h(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(rt,{children:[c.jsx(L,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,c.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>h(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:Se,isEmptyChatWithSession:ue,currentTenant:d,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:E,onUploadPromoClose:b,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?c.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:dt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:c.jsx(Z,{onClick:i=>i.stopPropagation(),children:c.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||d.userRoleId==null||s(B(d.userRoleId)),h(!1)}})})}):null]}),p&&!a?c.jsx(ve,{open:p,onClose:()=>h(!1),children:c.jsx(Qe,{children:he})}):null]})},Z=k(st)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
- `,rt=b.div`
5
+ `,rt=k.div`
6
6
  height: 100vh;
7
7
  width: 100%;
8
- `,lt=b.div`
8
+ `,lt=k.div`
9
9
  height: 100vh;
10
10
  width: 100%;
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  min-height: 0;
14
- `,dt=b.div`
14
+ `,ct=k.div`
15
15
  flex: 1;
16
16
  min-height: 0;
17
17
  display: flex;
18
18
  flex-direction: column;
19
- `,ut=b(ot)`
19
+ `,dt=k(ot)`
20
20
  box-shadow: ${({theme:t})=>t.colors.elevation2};
21
21
  color: ${({theme:t})=>t.colors.grey4};
22
22
  `;export{vt as default};
@@ -1 +1 @@
1
- import{j as l}from"./liveblocks-PtDFv95_.js";import{a as f}from"./sentry-mCXLUbmc.js";import{h as U,g as B,u as T,j as v,N as O,n as j,i as $,o as z,p as h}from"./core-BZimyUuM.js";import{eT as N,Pc as A,OU as b,z7 as I,z1 as F,z5 as w,yW as L,OW as W,yZ as q,z9 as H,z8 as C}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as P,z as k,B as V,a7 as Z,bH as G,af as _,bI as J}from"./index-aKhhTDIh.js";import"./mui-BcLZDyi8.js";import{i as K}from"./ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js";import M from"./NotFoundScreen-BVW1mHQl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="51b92233-fdc1-4eee-946f-a340810774ff",e._sentryDebugIdIdentifier="sentry-dbid-51b92233-fdc1-4eee-946f-a340810774ff")}catch{}})();const R="bill-approval-rule-update",Q=j(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:t,location:p}=o;return{onApprovalRulesEventReceived:a=>{a.endsWith(R)&&e(W(!1))},onBackClick:()=>{_(p)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(L(a))},onEditRuleClick:a=>{a!=null?(e(w(a)),t(`./${a}/edit`)):(e(w()),t("./new"))}}})(Z(G)),X=()=>{const e=U(),o=B(),t=T(),[p,a]=f.useState(!1),[u,s]=f.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>N(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(f.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&t(I())},[g]),f.useEffect(()=>{p||n!=="Not-Started"||(a(!0),t(F(!0)))},[p,n,t]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");f.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),t(w())),e("./new"))},[u,r,t]);const y={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${R}`]:[],eventCallback:(i,x,m)=>{i.endsWith(R)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx(O,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...y})},Y=j(function(e,o){const t=b(e),p=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=p==="approval_create"&&t.allApprovalRules.length!==0;let u=t.allApprovalRules.length===0;return o.approvalRuleId&&(u=t.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:a,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(y=>{const i=y.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),x=y.actors.selectedNonUsers.map(S=>{const E=!!K(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(x);g.push({action:y.stepType.selectedOption,actors:m,operator:m.length>1?y.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H())},onSaveRuleSuccess:()=>{t("../")}}})(J);function D(){const e=U(),o=T(),t=B(),{approvalRuleId:p}=$(),a=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=f.useState(!1);if(f.useEffect(()=>{n||(c(!0),o(q(!0)))}),f.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Y,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:t})}function se(){return l.jsxs(z,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(M,{})})]})}export{se as B};
1
+ import{j as l}from"./liveblocks-DtJmjn-F.js";import{a as f}from"./sentry-DJoVhts9.js";import{h as U,g as B,u as T,j as v,N as O,n as j,i as $,o as z,p as h}from"./core-B1V19BTM.js";import{eT as N,Pc as A,OU as b,z7 as I,z1 as F,z5 as w,yW as L,OW as W,yZ as q,z9 as H,z8 as C}from"./zeni-epic-state-Ct7fOB-u.js";import{m as P,z as k,B as V,a7 as Z,bH as G,af as _,bI as J}from"./index-B1BV6O_s.js";import"./mui-D6ES9V4N.js";import{i as K}from"./ReimbursementApprovalRuleDetailScreen-B-QO8l6D.js";import M from"./NotFoundScreen-98Ef_Sqs.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="51b92233-fdc1-4eee-946f-a340810774ff",e._sentryDebugIdIdentifier="sentry-dbid-51b92233-fdc1-4eee-946f-a340810774ff")}catch{}})();const R="bill-approval-rule-update",Q=j(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:t,location:p}=o;return{onApprovalRulesEventReceived:a=>{a.endsWith(R)&&e(W(!1))},onBackClick:()=>{_(p)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(L(a))},onEditRuleClick:a=>{a!=null?(e(w(a)),t(`./${a}/edit`)):(e(w()),t("./new"))}}})(Z(G)),X=()=>{const e=U(),o=B(),t=T(),[p,a]=f.useState(!1),[u,s]=f.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>N(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(f.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&t(I())},[g]),f.useEffect(()=>{p||n!=="Not-Started"||(a(!0),t(F(!0)))},[p,n,t]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");f.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),t(w())),e("./new"))},[u,r,t]);const y={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${R}`]:[],eventCallback:(i,x,m)=>{i.endsWith(R)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx(O,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...y})},Y=j(function(e,o){const t=b(e),p=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=p==="approval_create"&&t.allApprovalRules.length!==0;let u=t.allApprovalRules.length===0;return o.approvalRuleId&&(u=t.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:a,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(y=>{const i=y.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),x=y.actors.selectedNonUsers.map(S=>{const E=!!K(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(x);g.push({action:y.stepType.selectedOption,actors:m,operator:m.length>1?y.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H())},onSaveRuleSuccess:()=>{t("../")}}})(J);function D(){const e=U(),o=T(),t=B(),{approvalRuleId:p}=$(),a=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=f.useState(!1);if(f.useEffect(()=>{n||(c(!0),o(q(!0)))}),f.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Y,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:t})}function se(){return l.jsxs(z,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(M,{})})]})}export{se as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-BZimyUuM.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as ya,zS as Sa,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Qa,P5 as Xa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as yn,kQ as Sn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as me,z as V,A as Ie,Y as We,a as le,x as y,aN as xe,B as re,o as x,v as je,d as D,be as Ln,p as z,a2 as qe,q as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,D as _n,aH as Gn,y as Zt,O as Je,N as Ke,bi as Mn,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Xn,br as Yn,bs as ei,I as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-aKhhTDIh.js";import{n as O,S as si}from"./mui-BcLZDyi8.js";import{A as dt}from"./AddressScreen-BF-3RAYM.js";import{g as ie,a as Te,i as qt,V as Qe,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-BHpce-fZ.js";import{a as f}from"./sentry-mCXLUbmc.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import{u as Jt}from"./useInitialThreadRequest-ClxKOF2S.js";import Ee from"./NotFoundScreen-BVW1mHQl.js";import{D as ui}from"./DrawerScreen-QceXJJGv.js";import{M as Kt}from"./MobileAppDrawer-CLztF99b.js";import{F as Qt}from"./FeaturePreviewScreen-AUOPnl37.js";import{S as Pe}from"./SetupPagesScreen-Uer5YsTX.js";import{B as pi}from"./BillPayApprovalRoutes-QJ1EpW6M.js";import{FallBackRoute as mi}from"./ScreenRoutes-B-k_ZyHL.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./analyticsHelper-DO0i_Ozz.js";import"./routePaths-DQbleX1q.js";import"./BusinessVerificationPageScreen-0dmMGz8A.js";import"./ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js";import"./getLocaleForTenant-B-mnTkE0.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]="69127630-aa3a-46ab-a5b2-488789b947ed",e._sentryDebugIdIdentifier="sentry-dbid-69127630-aa3a-46ab-a5b2-488789b947ed")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.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 n=De(i);n||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,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(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(Sa({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return i==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:M,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-DtJmjn-F.js";import{h as K,u as se,g as X,i as ae,j as v,N as te,n as Q,l as na,o as ia,p as y}from"./core-B1V19BTM.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as Sa,zS as ya,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Xa,P5 as Qa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as Sn,kQ as yn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-Ct7fOB-u.js";import{m as me,z as V,A as Ie,_ as We,a as le,d as S,aN as xe,B as re,o as x,w as je,e as D,be as Ln,p as z,a2 as qe,n as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,G as _n,aH as Gn,D as Zt,O as Je,W as Ke,bi as Mn,at as Ht,bj as Nn,X as zn,g as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Xn,bq as Qn,br as Yn,bs as ei,s as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-B1BV6O_s.js";import{n as O,S as si}from"./mui-D6ES9V4N.js";import{A as dt}from"./AddressScreen-C3jTD0QX.js";import{g as ie,a as Te,i as qt,V as Xe,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-D62ComgW.js";import{a as f}from"./sentry-DJoVhts9.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-B1ysHqFw.js";import{u as Jt}from"./useInitialThreadRequest-BrZkGF4L.js";import Ee from"./NotFoundScreen-98Ef_Sqs.js";import{D as ui}from"./DrawerScreen-Bzib8YfV.js";import{M as Kt}from"./MobileAppDrawer-DY_LJNf1.js";import{F as Xt}from"./FeaturePreviewScreen-KfiUQgFU.js";import{S as Pe}from"./SetupPagesScreen-CyzzOWiJ.js";import{B as pi}from"./BillPayApprovalRoutes-DU855VPd.js";import{FallBackRoute as mi}from"./ScreenRoutes-BZhSovog.js";import"./recharts-C_sYuD8f.js";import"./analytics-CR-Ji6KN.js";import"./plaid-Cvs9FZAe.js";import"./dnd-DY5CyMCW.js";import"./stripe-DMRn4zHo.js";import"./lottie-PNrYlsmY.js";import"./lexical-DtEMPKph.js";import"./pdf-C3786_Gz.js";import"./utils-B1ItiyXC.js";import"./analyticsHelper-BkTwMm2V.js";import"./routePaths-BaN0YLzj.js";import"./BusinessVerificationPageScreen-BiME3gzl.js";import"./ReimbursementApprovalRuleDetailScreen-B-QO8l6D.js";import"./getLocaleForTenant-BaJta4jx.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]="49944039-e4be-4e45-99ff-a72b7a80f742",e._sentryDebugIdIdentifier="sentry-dbid-49944039-e4be-4e45-99ff-a72b7a80f742")}catch{}})();const bi=Q(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.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 n=De(i);n||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=X(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,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(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Se=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(ya({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(Sa({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return i==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Qt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:Se.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Se.overwriteDescription}),primaryButtonText:Se.buttons.yes,secondaryButtonText:Se.buttons.no,action:M,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${Se.recurringBill.recurringCycle}
2
2
  ${i}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],i=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||i)}const pt=O.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -17,7 +17,7 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as a
17
17
  color: ${e=>e.theme.colors.hero};
18
18
  height: ${x.sp3};
19
19
  width: ${x.sp3};
20
- `,Xt=O(e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})))`
20
+ `,Qt=O(e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})))`
21
21
  width: ${x.sp3};
22
22
  height: ${x.sp3};
23
23
  cursor: pointer;
@@ -77,7 +77,7 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as a
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:jt(e),analytics:t.analytics}},function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(ka(l))},onProceedForBulkActionClick:(l,i)=>{switch(l){case"send_for_approval":e(fa());break;case"approve":case"review":e(at("approved",i??""));break;case"reject":e(at("rejected",i??""))}}}})(Nn);function Bi(){const e=K(),t=v(i=>i.billsBulkActionViewState.bulkSubmissionFetchState.fetchState),{billsForReview:l}=v(i=>jt(i));return f.useEffect(()=>{t!=="Completed"&&l.length!==0||e("./")},[t,l.length]),a.jsx(Ci,{navigate:e,analytics:D})}const ne=xa(),Yt="bulk-operation-update",Oe="bill-approval-rule-update",{spendManagement:xi,common:bt}=Je.getLocalizedStrings(),ht=xi.billPay.bulkActions,Ei=O.div`
80
+ `,Ci=Q(function(e,t){return{billsReviewView:jt(e),analytics:t.analytics}},function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(ka(l))},onProceedForBulkActionClick:(l,i)=>{switch(l){case"send_for_approval":e(fa());break;case"approve":case"review":e(at("approved",i??""));break;case"reject":e(at("rejected",i??""))}}}})(Nn);function Bi(){const e=K(),t=v(i=>i.billsBulkActionViewState.bulkSubmissionFetchState.fetchState),{billsForReview:l}=v(i=>jt(i));return f.useEffect(()=>{t!=="Completed"&&l.length!==0||e("./")},[t,l.length]),a.jsx(Ci,{navigate:e,analytics:D})}const ne=xa(),Yt="bulk-operation-update",Oe="bill-approval-rule-update",{spendManagement:xi,common:bt}=Je.getLocalizedStrings(),ht=xi.billPay.bulkActions,Ei=O.div`
81
81
  display: flex;
82
82
  min-height: 100%;
83
83
  width: 100%;
@@ -85,11 +85,11 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as a
85
85
  flex-direction: column;
86
86
  align-items: center;
87
87
  background-color: ${e=>e.theme.colors.grey4};
88
- `,Di=X(function(e,t){const l=V.getSignedInUser(),i=De(l),c=Ft(e,ne,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter(b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted"):t.roleMap.bill_pay_approver&&(r=r.filter(b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted"))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter(b=>b!=="deleted"));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ze(e,"common"),s=e.tenantState.currentTenantId,n=Z(e),d=n?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,h=c.fetchState,g=Ea(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter(b=>b.isDeleted===!1),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:h,analytics:D,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ne,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:i,billPayApprovalRulesAffectedEntityIds:g.affectedEntityIds}},function(e,t){const{navigate:l,currentTenant:i,location:c,period:r}=t,{tenantEmailDomain:u}=i;return{updateTabToState:o=>{e(ue()),e(Tt(o))},onSubtabChange:o=>{e(ue()),e(Pt(o))},onTransactionClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(n,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;D?.trackBillPayNewBill();const s=`/${o}/bill/new`,n=E(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:n}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e(Le(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e($a(i.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Va({filters:o})),o.categories.every(s=>s.field!=null&&s.values?.length!==0)&&D.trackSpendManagmentFilterChange("bill_pay",o.categories.map(s=>`${s.field}-${JSON.stringify(s.values)}`))},updateDownloadStateHandler:o=>{o==="In-Progress"&&D.trackSpendManagementDownloadClick("bill_pay"),e(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Pa(o,s??""));break;case"send_for_approval":e(nt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(nt("approve")),t.navigate("./bulk-review");break;case"review":e(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Oe)&&e(ja(!1))},onEventReceived:o=>{o===Yt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}})(Zn(Hn));function ji(){const e=K(),t=se(),l=Q(),i=we(),c=l.state,r=Ie(),[u,o]=f.useState(!1),[s,n]=f.useState(null),d=na("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect(()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(Pt(c?.subTab))),()=>{t(ue())}),[]);const p=V.getSignedInUser(),m=v(P=>Z(P)),{areTenantIdsInSync:h}=zn(),[g,b]=f.useState(!1),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=k(y.isBillPayCommentingEnabled),{isFeatureEnabled:C}=k(y.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=k(y.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=k(y.isBillPayBulkActionEnabled),{isFeatureEnabled:U}=k(y.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:$}=k(y.isBillPayDetectInsufficientFundsEnabled),I=v(P=>Ft(P,ne,T,p?.userId)),{isFeatureEnabled:H}=k(y.isDebitCardFeatureEnabled),G=I.fetchState,{isAiCfoAccessEnabled:B,onAskAiCfoClick:q}=Ye({mobileExploreReferrer:"Bills List"});We({isDataReady:G==="Completed"});const W=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,L=!!m.companyBillPayInfo?.info?.isBillPayEnabled,J=v(P=>va(P.companyState,m.companyId)),Y=J?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect(()=>{!g&&L&&h&&(b(!0),t(Le(ne,!0,j,U)))},[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const M=(P,de)=>{t(Ba({uiState:{sortKey:P,sortOrder:de},period:ne}))},ee=Rt(r?.loggedInUserRoleMap),F=pe(r?.loggedInUserRoleMap),ce=P=>{o(P)},{billsProcessed:N,billsProcessing:Ae}=v(P=>Ia(P));f.useEffect(()=>{N===Ae&&s!=null&&(t(wa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:N>1?ht.bills:ht.bill},{variableName:"_has_",variableValue:N>1?bt.texts.have:bt.texts.has},{variableName:"_action_",variableValue:Aa(s)}]})),t(Ca()),setTimeout(()=>{t(Le(ne,!0,j,!0,U))},3e3),n(null))},[N,Ae]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Yt}`,`private-encrypted-${m.companyId}.${Oe}`]:[],eventCallback:(P,de,et)=>{P.endsWith(Oe)?et.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(n(de.operation_type),et.onEventReceived(P))}},ta=Vt(H,m),aa=$t(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ta===!0||aa===!0?a.jsx(Qt,{}):L?a.jsxs(a.Fragment,{children:[G==="Completed"?a.jsx(je,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Ei,{windowSize:i,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Pi,{onClick:P=>P.stopPropagation(),children:a.jsx(Bi,{})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:A,isReimbursementCommentingEnabled:C,period:ne,isAdmin:!1,uiState:I.uiState,onColumnSortConfigChanged:M,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:I.billBulkSubmissionLimit,bulkSubmissionFetchState:I.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:I.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:U,isDetectInsufficientFundsEnabled:$,isAiCfoAccessEnabled:B,onAskAiCfoClick:q,...ea})]})]}):W===!0&&F===!0?a.jsx(te,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:G}):a.jsx(Ee,{})}const Ti=e=>`/${e}/bills/setup`,Pi=O(si)`
88
+ `,Di=Q(function(e,t){const l=V.getSignedInUser(),i=De(l),c=Ft(e,ne,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter(b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted"):t.roleMap.bill_pay_approver&&(r=r.filter(b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted"))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter(b=>b!=="deleted"));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ze(e,"common"),s=e.tenantState.currentTenantId,n=Z(e),d=n?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,h=c.fetchState,g=Ea(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter(b=>b.isDeleted===!1),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:h,analytics:D,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ne,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:i,billPayApprovalRulesAffectedEntityIds:g.affectedEntityIds}},function(e,t){const{navigate:l,currentTenant:i,location:c,period:r}=t,{tenantEmailDomain:u}=i;return{updateTabToState:o=>{e(ue()),e(Tt(o))},onSubtabChange:o=>{e(ue()),e(Pt(o))},onTransactionClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(n,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ti(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;D?.trackBillPayNewBill();const s=`/${o}/bill/new`,n=E(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:n}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e(Le(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e($a(i.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Va({filters:o})),o.categories.every(s=>s.field!=null&&s.values?.length!==0)&&D.trackSpendManagmentFilterChange("bill_pay",o.categories.map(s=>`${s.field}-${JSON.stringify(s.values)}`))},updateDownloadStateHandler:o=>{o==="In-Progress"&&D.trackSpendManagementDownloadClick("bill_pay"),e(Ra({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Fa(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Pa(o,s??""));break;case"send_for_approval":e(nt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(nt("approve")),t.navigate("./bulk-review");break;case"review":e(Ta()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Oe)&&e(ja(!1))},onEventReceived:o=>{o===Yt&&e(Da())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}})(Zn(Hn));function ji(){const e=K(),t=se(),l=X(),i=we(),c=l.state,r=Ie(),[u,o]=f.useState(!1),[s,n]=f.useState(null),d=na("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect(()=>(c?.tab!=null&&c?.subTab!=null&&(t(Tt(c?.tab)),t(Pt(c?.subTab))),()=>{t(ue())}),[]);const p=V.getSignedInUser(),m=v(P=>Z(P)),{areTenantIdsInSync:h}=zn(),[g,b]=f.useState(!1),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:A}=k(S.isBillPayCommentingEnabled),{isFeatureEnabled:C}=k(S.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=k(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=k(S.isBillPayBulkActionEnabled),{isFeatureEnabled:U}=k(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:$}=k(S.isBillPayDetectInsufficientFundsEnabled),I=v(P=>Ft(P,ne,T,p?.userId)),{isFeatureEnabled:H}=k(S.isDebitCardFeatureEnabled),G=I.fetchState,{isAiCfoAccessEnabled:B,onAskAiCfoClick:q}=Ye({mobileExploreReferrer:"Bills List"});We({isDataReady:G==="Completed"});const W=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,L=!!m.companyBillPayInfo?.info?.isBillPayEnabled,J=v(P=>va(P.companyState,m.companyId)),Y=J?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect(()=>{!g&&L&&h&&(b(!0),t(Le(ne,!0,j,U)))},[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const M=(P,de)=>{t(Ba({uiState:{sortKey:P,sortOrder:de},period:ne}))},ee=Rt(r?.loggedInUserRoleMap),F=pe(r?.loggedInUserRoleMap),ce=P=>{o(P)},{billsProcessed:N,billsProcessing:Ae}=v(P=>Ia(P));f.useEffect(()=>{N===Ae&&s!=null&&(t(wa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:N>1?ht.bills:ht.bill},{variableName:"_has_",variableValue:N>1?bt.texts.have:bt.texts.has},{variableName:"_action_",variableValue:Aa(s)}]})),t(Ca()),setTimeout(()=>{t(Le(ne,!0,j,!0,U))},3e3),n(null))},[N,Ae]);const ea={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${Yt}`,`private-encrypted-${m.companyId}.${Oe}`]:[],eventCallback:(P,de,et)=>{P.endsWith(Oe)?et.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(n(de.operation_type),et.onEventReceived(P))}},ta=Vt(H,m),aa=$t(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?ta===!0||aa===!0?a.jsx(Xt,{}):L?a.jsxs(a.Fragment,{children:[G==="Completed"?a.jsx(je,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Ei,{windowSize:i,children:[a.jsx(Kt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(ui,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Pi,{onClick:P=>P.stopPropagation(),children:a.jsx(Bi,{})})}),a.jsx(Di,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:A,isReimbursementCommentingEnabled:C,period:ne,isAdmin:!1,uiState:I.uiState,onColumnSortConfigChanged:M,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:I.billBulkSubmissionLimit,bulkSubmissionFetchState:I.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:I.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:U,isDetectInsufficientFundsEnabled:$,isAiCfoAccessEnabled:B,onAskAiCfoClick:q,...ea})]})]}):W===!0&&F===!0?a.jsx(te,{to:"../setup"}):r!=null&&ze(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:G}):a.jsx(Ee,{})}const Ti=e=>`/${e}/bills/setup`,Pi=O(si)`
89
89
  display: flex;
90
90
  min-height: 100%;
91
91
  flex-direction: column;
92
- `,{common:{currency:Se},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=Je.getLocalizedStrings(),Vi=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},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 n=`${l?.firstName} ${l?.lastName}`;const d=De(l);t.billId!=null&&t.billDetailsView!=null&&(n=`${t.billDetailsView.createdBy?.firstName??Ri} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(n="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ga(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Ut(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,k=h.add(b,"month").isAfter(g),j=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!_t(p,t.billDetailsView.approvalRules.allApprovalRules,l),A=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Bt(e),billId:t.billId,createdBy:n,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:k,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}},function(e,t){const{billId:l,companyId:i,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:n=>{e(it(n));const d=yt(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:n=>{const d=n??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Mt(d,!1)),e(Nt({localData:{vendorName:n??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:n=>{n!=null&&e(Ne(n,t.isVendorRecommendationEnabled))},updateShowAutofill:n=>{e(Me(n))},onSaveChangesToLocalStore:(n,d,p,m,h)=>{const g=Ui(t.billDetailsView,{...n,paymentDetails:{...n?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ka({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Gt("draft"))},reviewBillDetails:()=>{const n=$i(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:n})=>{e(ke({billId:n}))},clearBillPayReviewLocalState:()=>e(Ja()),onClickDismiss:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:n=>{if(n==="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:n=>{e(fe(!1,n));const d=Li(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:n=>{e(fe(!1,n));const d=Oi(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:n=>{e(fe(!1,n));const d=qt(s,l,n),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);e(ke({})),u(n,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(n,d)=>{const p=Te(s,n,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const n=z(t.location.state?.pathnameStackToGoBack),d=n.poppedPathname??ie(s);u(d,{state:{pathnameStackToGoBack:n.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,d)=>{n.trim().length>=2?e(He({searchString:n,entityType:d,searchOrigin:"common"})):n.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(n,d){e(qa(n,d,l))},onWiseVerifyClick:()=>{let n="";n=Kn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${n}/login`;window.open(d,"_blank")},onVendorSelected:n=>{e(Wa(!0,n,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:(n,d)=>{e(Ha("bill_pay_detail",n,d))},onEstablishConnectionClick:n=>{e(Za(n,i,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(n,d,p)=>{e(za(n,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Ma("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}})(Wn);function gt(){const e=K(),t=Q(),l=se(),{billId:i,tenantEmailDomain:c}=ae(),{useFeatureGate:r,useDynamicConfig:u}=le(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(y.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:n}=r(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(y.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.isRecurringBillsFeatureEnabled),{isFeatureEnabled:g}=r(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(y.isShaDisabled),{isFeatureEnabled:k}=r(y.isOurDisabled),{isFeatureEnabled:j}=r(y.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(xe.zeniAccountsConfig),C=Oa(A),{configValue:_}=u(xe.sameDayAchDisablementConfig),T=Ua(_),U=V.getSignedInUser(),$=v(N=>Z(N)),I=v(N=>Ge(N,m,g,i)),H=Jt($?.companyId,{clearParams:I.fetchState==="Completed"}),{isAiCfoAccessEnabled:G,onAskAiCfoClick:B}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:I.fetchState==="Completed"});const q=$.companyId??V.getSignedInUserTenant(c)?.companyId,W=!!$.companyZeniAccountInfo?.info?.isZeniAccountEnabled,L=Ie(),J=Lt(L?.loggedInUserRoleMap),Y=Ot(L?.loggedInUserRoleMap),M=pe(L?.loggedInUserRoleMap),ee=wt($.userRole);if(f.useEffect(()=>{i!=null&&l(At(i))},[i]),U==null)throw Error("Can't access address page without signing in...");const F=v(N=>_a(N.accountState,N.accountListState,"billPayAccountList")),ce={pathname:"../",search:t.search};return I.isDeleted===!0||I.billStage=="paid"||I.fetchState=="Not-Started"?a.jsx(te,{to:ce}):I.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:I.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:N=>(Ae=>{i!=null&&I.deleteStatus.fetchState!=="Completed"&&Ae.trackBillPayEditBill(i,I.isRecurring)})(N)}),a.jsx(Vi,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:$,billId:i,companyId:q,billDetailsView:I,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:F,isInternationalPaymentShaVsOurEnabled:n,vendor:I.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:k,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:W,hasZeniAccountsAdminAccess:J,isZeniAccountsUser:Y,isBillPayAdmin:M,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:G,onAskAiCfoClick:B})]})}const yt=(e,t,l)=>{let i=`/${e}/bill/`;return l==null?i=t!=null?i.concat(`new/vendor/${encodeURIComponent(t)}/edit`):i.concat("new/vendor/create"):(i=i.concat(`${encodeURIComponent(l)}/edit/vendor/`),i=t!=null?i.concat(`${encodeURIComponent(t)}/edit`):i.concat("create")),i},$i=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Li=(e,t,l)=>{let i=`/${e}/bill/`;return i=l!=null?i.concat(`${encodeURIComponent(l)}/edit/`):i.concat("new/"),i=i.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),i},Oi=(e,t,l)=>{let i=`/${e}/bill/`;return i=l!=null?i.concat(`${encodeURIComponent(l)}/edit/`):i.concat("new/"),i=i.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),i},R="paymentDetails",Ui=(e,t,l,i,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):Ut(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?be(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find(b=>b.id===t[R]?.withdrawFrom?.selectedOption),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(Qa)&&u?.vendorCurrencyCode===Se.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},n=r?.type==="Contact"?r?.email:void 0,d=!!n,p=t[R]?.recurringPaymentType?.selectedOption===Fi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?be(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},h=_i(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,i,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:n,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},_i=(e,t,l,i,c,r)=>{const u={};return i.forEach(o=>{let s,n;o.account.selectedOption!=null&&(s=e.find(p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption)),o.class?.selectedOption!=null&&(n=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:n,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},Gi=O.div`
92
+ `,{common:{currency:ye},spendManagement:{billPay:{billDetails:Fi}},appName:Ri}=Je.getLocalizedStrings(),Vi=Q(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},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 n=`${l?.firstName} ${l?.lastName}`;const d=De(l);t.billId!=null&&t.billDetailsView!=null&&(n=`${t.billDetailsView.createdBy?.firstName??Ri} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(n="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Ga(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Ut(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,k=h.add(b,"month").isAfter(g),j=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!_t(p,t.billDetailsView.approvalRules.allApprovalRules,l),A=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Bt(e),billId:t.billId,createdBy:n,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:k,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}},function(e,t){const{billId:l,companyId:i,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:n=>{e(it(n));const d=St(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:n=>{const d=n??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Mt(d,!1)),e(Nt({localData:{vendorName:n??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(it());const p=St(s,void 0,l),m=E(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:n=>{n!=null&&e(Ne(n,t.isVendorRecommendationEnabled))},updateShowAutofill:n=>{e(Me(n))},onSaveChangesToLocalStore:(n,d,p,m,h)=>{const g=Ui(t.billDetailsView,{...n,paymentDetails:{...n?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ka({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(_e("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Gt("draft"))},reviewBillDetails:()=>{const n=$i(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:n})=>{e(ke({billId:n}))},clearBillPayReviewLocalState:()=>e(Ja()),onClickDismiss:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(n,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:n=>{if(n==="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:n=>{e(fe(!1,n));const d=Li(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:n=>{e(fe(!1,n));const d=Oi(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:n=>{e(fe(!1,n));const d=qt(s,l,n),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const n=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);e(ke({})),u(n,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Dt(l))},onAttachmentClick:(n,d)=>{const p=Te(s,n,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const n=z(t.location.state?.pathnameStackToGoBack),d=n.poppedPathname??ie(s);u(d,{state:{pathnameStackToGoBack:n.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,d)=>{n.trim().length>=2?e(He({searchString:n,entityType:d,searchOrigin:"common"})):n.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(n,d){e(qa(n,d,l))},onWiseVerifyClick:()=>{let n="";n=Kn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${n}/login`;window.open(d,"_blank")},onVendorSelected:n=>{e(Wa(!0,n,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:(n,d)=>{e(Ha("bill_pay_detail",n,d))},onEstablishConnectionClick:n=>{e(Za(n,i,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(n,d,p)=>{e(za(n,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Ma("bill_pay","bill_pay_detail")),e(Na({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}})(Wn);function gt(){const e=K(),t=X(),l=se(),{billId:i,tenantEmailDomain:c}=ae(),{useFeatureGate:r,useDynamicConfig:u}=le(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(S.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:n}=r(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(S.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(S.isRecurringBillsFeatureEnabled),{isFeatureEnabled:g}=r(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(S.isShaDisabled),{isFeatureEnabled:k}=r(S.isOurDisabled),{isFeatureEnabled:j}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:A}=u(xe.zeniAccountsConfig),C=Oa(A),{configValue:_}=u(xe.sameDayAchDisablementConfig),T=Ua(_),U=V.getSignedInUser(),$=v(N=>Z(N)),I=v(N=>Ge(N,m,g,i)),H=Jt($?.companyId,{clearParams:I.fetchState==="Completed"}),{isAiCfoAccessEnabled:G,onAskAiCfoClick:B}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:I.fetchState==="Completed"});const q=$.companyId??V.getSignedInUserTenant(c)?.companyId,W=!!$.companyZeniAccountInfo?.info?.isZeniAccountEnabled,L=Ie(),J=Lt(L?.loggedInUserRoleMap),Y=Ot(L?.loggedInUserRoleMap),M=pe(L?.loggedInUserRoleMap),ee=wt($.userRole);if(f.useEffect(()=>{i!=null&&l(At(i))},[i]),U==null)throw Error("Can't access address page without signing in...");const F=v(N=>_a(N.accountState,N.accountListState,"billPayAccountList")),ce={pathname:"../",search:t.search};return I.isDeleted===!0||I.billStage=="paid"||I.fetchState=="Not-Started"?a.jsx(te,{to:ce}):I.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:I.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:N=>(Ae=>{i!=null&&I.deleteStatus.fetchState!=="Completed"&&Ae.trackBillPayEditBill(i,I.isRecurring)})(N)}),a.jsx(Vi,{initialOpenThreadRequest:H??void 0,location:t,navigate:e,currentTenant:$,billId:i,companyId:q,billDetailsView:I,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:F,isInternationalPaymentShaVsOurEnabled:n,vendor:I.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:k,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:W,hasZeniAccountsAdminAccess:J,isZeniAccountsUser:Y,isBillPayAdmin:M,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:G,onAskAiCfoClick:B})]})}const St=(e,t,l)=>{let i=`/${e}/bill/`;return l==null?i=t!=null?i.concat(`new/vendor/${encodeURIComponent(t)}/edit`):i.concat("new/vendor/create"):(i=i.concat(`${encodeURIComponent(l)}/edit/vendor/`),i=t!=null?i.concat(`${encodeURIComponent(t)}/edit`):i.concat("create")),i},$i=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Li=(e,t,l)=>{let i=`/${e}/bill/`;return i=l!=null?i.concat(`${encodeURIComponent(l)}/edit/`):i.concat("new/"),i=i.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),i},Oi=(e,t,l)=>{let i=`/${e}/bill/`;return i=l!=null?i.concat(`${encodeURIComponent(l)}/edit/`):i.concat("new/"),i=i.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),i},R="paymentDetails",Ui=(e,t,l,i,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):Ut(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?be(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find(b=>b.id===t[R]?.withdrawFrom?.selectedOption),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(Xa)&&u?.vendorCurrencyCode===ye.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},n=r?.type==="Contact"?r?.email:void 0,d=!!n,p=t[R]?.recurringPaymentType?.selectedOption===Fi.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Qa(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?be(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},h=_i(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,i,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:n,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},_i=(e,t,l,i,c,r)=>{const u={};return i.forEach(o=>{let s,n;o.account.selectedOption!=null&&(s=e.find(p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption)),o.class?.selectedOption!=null&&(n=t.find(p=>p.classId===o.class.selectedOption));const d=Jn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??ye.currencyCode,currencySymbol:o.currency?.currencySymbol??ye.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??ye.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??ye.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:n,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},Gi=O.div`
93
93
  display: flex;
94
94
  height: 100vh;
95
95
  width: 100%;
@@ -98,7 +98,7 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,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
- `,Mi=X(function(e,t){const{vendorId:l,billId:i}=t,c=ve(e,l),r=Ge(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,i);return{billId:i,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:l,navigate:i,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:n}=s;e(en({data:n}))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),n=s.poppedPathname??St();i(n,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const n=Xe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);i(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ya({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),n=s.poppedPathname??St(0);t.navigate(n,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}})(Qn);function Ni(){const e=K(),t=Q(),l=we(),{vendorId:i,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=V.getSignedInUser(),s=v(g=>Z(g)),n=z(t.state?.pathnameStackToGoBack),d=n.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v(g=>ve(g,i)),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Gi,{windowSize:l,children:[a.jsx(Qe,{vendorId:i,billId:c}),a.jsx(Mi,{location:t,navigate:e,billId:c,vendorId:i,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const St=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=O.div`
101
+ `,Mi=Q(function(e,t){const{vendorId:l,billId:i}=t,c=ve(e,l),r=Ge(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,i);return{billId:i,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:l,navigate:i,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(an(s))},onSaveHandler:()=>{e(tn(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:n}=s;e(en({data:n}))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),n=s.poppedPathname??yt();i(n,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const n=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);i(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(Ya({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),n=s.poppedPathname??yt(0);t.navigate(n,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}})(Xn);function Ni(){const e=K(),t=X(),l=we(),{vendorId:i,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=V.getSignedInUser(),s=v(g=>Z(g)),n=z(t.state?.pathnameStackToGoBack),d=n.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=v(g=>ve(g,i)),{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(Gi,{windowSize:l,children:[a.jsx(Xe,{vendorId:i,billId:c}),a.jsx(Mi,{location:t,navigate:e,billId:c,vendorId:i,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const yt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},zi=O.div`
102
102
  display: flex;
103
103
  height: 100vh;
104
104
  width: 100%;
@@ -107,7 +107,7 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,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,i=ve(e,l),c=l!=null?i.editVendorState?.vendorDetailLocalData?.vendorType:i.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=i.editVendorState??i.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:i,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:i,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,n,d,p)=>{e(cn(s)),p&&e(dn(n,d))},onCurrencyUpdated:(s,n,d)=>{e(rn(s,n,d,!1))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),n=s.poppedPathname??ft();i(n,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const n=Xe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);i(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),n=s.poppedPathname??ft(0);t.navigate(n,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}})(Xn);function Hi(){const e=K(),t=Q(),l=we(),{vendorId:i,billId:c}=ae(),r=se(),u=me(),o=V.getSignedInUser(),s=v(C=>Z(C)),n=z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=v(C=>C.vendorViewState.newVendorState.fetchStatus.fetchState),h=v(C=>i!=null?C.vendorViewState.editVendorStateById[i]?.fetchStatus.fetchState??"Not-Started":"Not-Started"),g=i!==void 0?h:m;f.useEffect(()=>{d===!1&&g==="Not-Started"&&i!=null&&(r(fe(!1,i)),p(!0))},[d,g,i]);const[b,k]=f.useState(!1);f.useEffect(()=>{b||g==="In-Progress"||(k(!0),r(nn(c,i)))},[b,g,r]);const j=n.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=v(C=>ve(C,i));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(zi,{windowSize:l,children:[a.jsx(Qe,{vendorId:i,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:i,currentTenant:s,bankAccountContext:j})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},kt=O.div`
110
+ `,Zi=Q(function(e,t){const{vendorId:l}=t,i=ve(e,l),c=l!=null?i.editVendorState?.vendorDetailLocalData?.vendorType:i.newVendorState?.vendorDetailLocalData?.vendorType,r=on(e,c||"international_business",t.billId),u=i.editVendorState??i.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[ln(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:i,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:i,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(un(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,n,d,p)=>{e(cn(s)),p&&e(dn(n,d))},onCurrencyUpdated:(s,n,d)=>{e(rn(s,n,d,!1))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),n=s.poppedPathname??ft();i(n,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const n=Qe(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);i(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(sn({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),n=s.poppedPathname??ft(0);t.navigate(n,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}})(Qn);function Hi(){const e=K(),t=X(),l=we(),{vendorId:i,billId:c}=ae(),r=se(),u=me(),o=V.getSignedInUser(),s=v(C=>Z(C)),n=z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=v(C=>C.vendorViewState.newVendorState.fetchStatus.fetchState),h=v(C=>i!=null?C.vendorViewState.editVendorStateById[i]?.fetchStatus.fetchState??"Not-Started":"Not-Started"),g=i!==void 0?h:m;f.useEffect(()=>{d===!1&&g==="Not-Started"&&i!=null&&(r(fe(!1,i)),p(!0))},[d,g,i]);const[b,k]=f.useState(!1);f.useEffect(()=>{b||g==="In-Progress"||(k(!0),r(nn(c,i)))},[b,g,r]);const j=n.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",A=v(C=>ve(C,i));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(zi,{windowSize:l,children:[a.jsx(Xe,{vendorId:i,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:i,currentTenant:s,bankAccountContext:j})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},kt=O.div`
111
111
  display: flex;
112
112
  height: 100vh;
113
113
  width: 100%;
@@ -116,4 +116,4 @@ import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as a
116
116
  align-items: center;
117
117
  background-color: ${e=>e.theme.colors.grey4};
118
118
  box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
119
- `,Wi=X(function(e,t){const l=V.getSignedInUser(),i=zt(e,t.billId),c=mn(e),r=De(l),u=i.totalAmount.amount,o=i.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!_t(u,c.allApprovalRules,l);return{billDetails:i,billId:t.billId,billpayApprovalView:c,analytics:D,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}},function(e,t){const{location:l,billId:i,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ie(c.tenantEmailDomain),s=E(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:i,data:s})),e(_e(o?"paid":"pending_approval",o,!1,i))},discardOutsideZeniPaymentData:()=>{e(xt({billId:i}))},updateBillDetailSaveBillCode:()=>{e(Gt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const n=Te(u,o,s);window.open(`${n}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}})(ei);function vt(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(y.isBillPayDetectInsufficientFundsEnabled),o=we(),s=V.getSignedInUser(),{isFeatureEnabled:n}=c(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(y.isBillPayCommentingEnabled),m=z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(y.isRecurringBillsFeatureEnabled),b=v(A=>Z(A)),k=v(A=>zt(A,i)),j=k.fetchState??"Not-Started";if(f.useEffect(()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null}),[e]),f.useEffect(()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${i}`)},[]),f.useEffect(()=>{const A=k.vendor?.name,C=k.vendor?.id,_=k.totalAmount.amount,T=k.recipientTotalAmount.amount,U=k.invoiceNumber;A&&C&&t(pn(A,C,_,T,U,i))},[]),h==null)return a.jsx(te,{to:`../${i}`});if(s==null)throw Error("Can't access address page without signing in...");return j==="In-Progress"?a.jsx(kt,{windowSize:o,children:a.jsx(Yn,{})}):a.jsx(kt,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:i,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:n,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=X(function(e,t){const{vendorId:l}=t,i=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=V.getSignedInUser(),s=u.tenantId,n={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Ht.fileMicroServiceBaseUrl}`,authParams:n,analytics:D,vendorSearchAutoCompleteData:{autoCompleteText:i,entityAutoCompleteView:c}}},function(e,t){const{billId:l,currentTenant:i,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=i;return{onSaveVendor:n=>{e(Bn(u??void 0,t.billId)),n!=null&&e(xn(n))},saveVendorDetailLocalData:n=>{e(Nt({vendorId:u,localData:n}))},saveContactsInVendorDetailLocalData:n=>{e(Cn({vendorId:u,contacts:n}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:n=>{e(An(n))},navigateToBankDetailPage:(n,d)=>{let p;n==="wire"?p=d==="international"?qt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(n,d)=>{e(d===!0?In(n,"vendor",u):wn(n,"vendor",u))},navigateToMailingAddressPage:n=>{const d=Xe(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:n=>{e(vn({files:n}))},onEditFileName:(n,d)=>{e(kn(n,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("Not-Started",u))},onVendorSelected:n=>{n!=null&&e(Sn(n,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,d)=>{n.trim().length>=2?e(He({searchString:n,entityType:d,searchOrigin:"common"})):n.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const n=z(t.location.state?.pathnameStackToGoBack),d=n.poppedPathname??ri(i.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:n.newStack}})},onGetOtp:n=>{e(yn(n,"BillPayVendor"))},onResendOtp:n=>{e(gn(n,"BillPayVendor"))},onVerifyOtp:(n,d)=>{e(hn(n,d,"BillPayVendor"))},onVerifyOtpSuccess:(n,d,p)=>{e(bn(n,d,p))},onFetchAndUpdateVendorRecommendations:n=>{e(Mt(n,!1))}}})(ii),Ce=()=>{const e=K(),t=se(),l=ti(),i=Q(),{billId:c,vendorId:r}=ae(),u=v(b=>Z(b)),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(y.isBillPayLocalCurrencyFeatureEnabled),[n,d]=f.useState(!1),p=v(b=>b.vendorViewState.newVendorState.fetchStatus.fetchState),m=v(b=>ve(b,r)),h=v(b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started"),g=r!==void 0?h:p;return f.useEffect(()=>{n===!1&&g==="Not-Started"&&r!=null&&(t(fe(!1,r)),d(!0))},[n,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):g==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Qe,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:i,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=X(function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:D,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}},function(e,t){const{companyId:l,navigate:i}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{i("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{i("../bills/setup",{relative:"path"})}}})(oi),Ki=()=>{const e=K(),t=Q(),{tenantEmailDomain:l}=ae(),[i,c]=f.useState(!1),r=me(),u=v(h=>Z(h)),o=u.companyId??V.getSignedInUserTenant(l)?.companyId,s=V.getSignedInUser(),n=Ie(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(n?.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||n!=null&&ze(u,n.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:i,handleDrawerToggle:m}),a.jsx(Ji,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function Do(){const e=v(G=>Z(G)),t=Ie(),l=pe(t?.loggedInUserRoleMap),i=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(y.isDebitCardFeatureEnabled),s=Vt(o,e),n=$t(e),d=Q(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Rt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&jn(t?.loggedInUserRoleMap),{isFeatureEnabled:b}=c(y.isDepositAccountsFeatureEnabled),k=b&&!p&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(y.isChargeCardFeatureEnabled),A=li(e,j,o)&&!p&&Tn(t?.loggedInUserRoleMap),C=Pn(t?.loggedInUserRoleMap),_=Ot(t?.loggedInUserRoleMap),T=Fn(t?.loggedInUserRoleMap),U=Rn(t?.loggedInUserRoleMap),$=Vn(t?.loggedInUserRoleMap),I=$n(t?.loggedInUserRoleMap),{tenantEmailDomain:H}=ae();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(S,{path:"setup",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"setup"})}),a.jsx(S,{path:"verification",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"verification"})}),a.jsx(S,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(S,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{isUserHasZeniAccountsAccess:_,isUserHasChargeCardAccess:U,isUserHasBillPayAccess:$,isUserHasReimbursementAccess:I,isUserHasTreasuryAccess:T,isTenantBankingOnly:s,tenantEmailDomain:H??""})}),a.jsx(S,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(S,{path:"*",element:a.jsx(ji,{})}),(s===!0||n===!0)&&a.jsx(S,{path:"/*",element:a.jsx(Qt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(S,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(S,{path:"*",element:a.jsx(te,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(S,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(S,{path:":billId",element:a.jsx(w,{appContent:a.jsx(hi,{})})}),a.jsx(S,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(S,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(S,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(S,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"*",element:a.jsx(Ee,{})})]}):a.jsx(S,{path:"*",element:a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:i.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${i.colors.dropShadowNormal}`}})}),a.jsx(S,{path:"*",element:a.jsx(Ee,{})})]})}export{Do as default};
119
+ `,Wi=Q(function(e,t){const l=V.getSignedInUser(),i=zt(e,t.billId),c=mn(e),r=De(l),u=i.totalAmount.amount,o=i.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!_t(u,c.allApprovalRules,l);return{billDetails:i,billId:t.billId,billpayApprovalView:c,analytics:D,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}},function(e,t){const{location:l,billId:i,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ie(c.tenantEmailDomain),s=E(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},saveBillDetails:(o,s)=>{o&&e(Et({billId:i,data:s})),e(_e(o?"paid":"pending_approval",o,!1,i))},discardOutsideZeniPaymentData:()=>{e(xt({billId:i}))},updateBillDetailSaveBillCode:()=>{e(Gt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const n=Te(u,o,s);window.open(`${n}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}})(ei);function vt(){const e=K(),t=se(),l=X(),{billId:i}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(S.isBillPayDetectInsufficientFundsEnabled),o=we(),s=V.getSignedInUser(),{isFeatureEnabled:n}=c(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(S.isBillPayCommentingEnabled),m=z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(S.isRecurringBillsFeatureEnabled),b=v(A=>Z(A)),k=v(A=>zt(A,i)),j=k.fetchState??"Not-Started";if(f.useEffect(()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null}),[e]),f.useEffect(()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${i}`)},[]),f.useEffect(()=>{const A=k.vendor?.name,C=k.vendor?.id,_=k.totalAmount.amount,T=k.recipientTotalAmount.amount,U=k.invoiceNumber;A&&C&&t(pn(A,C,_,T,U,i))},[]),h==null)return a.jsx(te,{to:`../${i}`});if(s==null)throw Error("Can't access address page without signing in...");return j==="In-Progress"?a.jsx(kt,{windowSize:o,children:a.jsx(Yn,{})}):a.jsx(kt,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:i,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:n,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=Q(function(e,t){const{vendorId:l}=t,i=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=V.getSignedInUser(),s=u.tenantId,n={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Ht.fileMicroServiceBaseUrl}`,authParams:n,analytics:D,vendorSearchAutoCompleteData:{autoCompleteText:i,entityAutoCompleteView:c}}},function(e,t){const{billId:l,currentTenant:i,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=i;return{onSaveVendor:n=>{e(Bn(u??void 0,t.billId)),n!=null&&e(xn(n))},saveVendorDetailLocalData:n=>{e(Nt({vendorId:u,localData:n}))},saveContactsInVendorDetailLocalData:n=>{e(Cn({vendorId:u,contacts:n}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:n=>{e(An(n))},navigateToBankDetailPage:(n,d)=>{let p;n==="wire"?p=d==="international"?qt(s,t.billId,u):di(s,t.billId,u):p=ci(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(n,d)=>{e(d===!0?In(n,"vendor",u):wn(n,"vendor",u))},navigateToMailingAddressPage:n=>{const d=Qe(s,n,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:n=>{e(vn({files:n}))},onEditFileName:(n,d)=>{e(kn(n,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(fn("Not-Started",u))},onVendorSelected:n=>{n!=null&&e(yn(n,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,d)=>{n.trim().length>=2?e(He({searchString:n,entityType:d,searchOrigin:"common"})):n.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const n=z(t.location.state?.pathnameStackToGoBack),d=n.poppedPathname??ri(i.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:n.newStack}})},onGetOtp:n=>{e(Sn(n,"BillPayVendor"))},onResendOtp:n=>{e(gn(n,"BillPayVendor"))},onVerifyOtp:(n,d)=>{e(hn(n,d,"BillPayVendor"))},onVerifyOtpSuccess:(n,d,p)=>{e(bn(n,d,p))},onFetchAndUpdateVendorRecommendations:n=>{e(Mt(n,!1))}}})(ii),Ce=()=>{const e=K(),t=se(),l=ti(),i=X(),{billId:c,vendorId:r}=ae(),u=v(b=>Z(b)),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[n,d]=f.useState(!1),p=v(b=>b.vendorViewState.newVendorState.fetchStatus.fetchState),m=v(b=>ve(b,r)),h=v(b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started"),g=r!==void 0?h:p;return f.useEffect(()=>{n===!1&&g==="Not-Started"&&r!=null&&(t(fe(!1,r)),d(!0))},[n,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ai,{}):g==="Error"?a.jsx(ni,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Xe,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:i,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ji=Q(function(e,t){const{companyId:l}=t;return{billPaySetupView:En(e,l),analytics:D,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}},function(e,t){const{companyId:l,navigate:i}=t;return{onButtonClick:()=>{e(Dn(l))},onBackClick:()=>{i("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{i("../bills/setup",{relative:"path"})}}})(oi),Ki=()=>{const e=K(),t=X(),{tenantEmailDomain:l}=ae(),[i,c]=f.useState(!1),r=me(),u=v(h=>Z(h)),o=u.companyId??V.getSignedInUserTenant(l)?.companyId,s=V.getSignedInUser(),n=Ie(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(n?.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||n!=null&&ze(u,n.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Kt,{isAppContentDrawerOpen:i,handleDrawerToggle:m}),a.jsx(Ji,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function Do(){const e=v(G=>Z(G)),t=Ie(),l=pe(t?.loggedInUserRoleMap),i=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:Ni,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=Vt(o,e),n=$t(e),d=X(),p=e?.userRole!=null&&It(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Rt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&jn(t?.loggedInUserRoleMap),{isFeatureEnabled:b}=c(S.isDepositAccountsFeatureEnabled),k=b&&!p&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(S.isChargeCardFeatureEnabled),A=li(e,j,o)&&!p&&Tn(t?.loggedInUserRoleMap),C=Pn(t?.loggedInUserRoleMap),_=Ot(t?.loggedInUserRoleMap),T=Fn(t?.loggedInUserRoleMap),U=Rn(t?.loggedInUserRoleMap),$=Vn(t?.loggedInUserRoleMap),I=$n(t?.loggedInUserRoleMap),{tenantEmailDomain:H}=ae();return a.jsxs(ia,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Ki,{})}),a.jsx(y,{path:"approval-rules/*",element:m?a.jsx(pi,{}):a.jsx(mi,{isUserHasZeniAccountsAccess:_,isUserHasChargeCardAccess:U,isUserHasBillPayAccess:$,isUserHasReimbursementAccess:I,isUserHasTreasuryAccess:T,isTenantBankingOnly:s,tenantEmailDomain:H??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:k,isChargeCardAdminLevelAccess:A,isUserHasOnlyCardAccess:C,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(ji,{})}),(s===!0||n===!0)&&a.jsx(y,{path:"/*",element:a.jsx(Xt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&ze(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(te,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:":billId",element:a.jsx(w,{appContent:a.jsx(hi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(w,{appContent:a.jsx(gt,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(w,{appContent:a.jsx(vt,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(w,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(w,{appContent:a.jsx(Ce,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(w,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(w,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(w,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(Ee,{})})]}):a.jsx(y,{path:"*",element:a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:i.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${i.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(Ee,{})})]})}export{Do as default};
@@ -1,4 +1,4 @@
1
- import{j as k}from"./liveblocks-PtDFv95_.js";import{a as V}from"./sentry-mCXLUbmc.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-BZimyUuM.js";import{A as ce,a as ue,aN as de,z as E,v as pe,d as z,af as x,f as P,bD as le,at as me,q as B,au as R}from"./index-aKhhTDIh.js";import{P0 as fe,eT as G,tm as ye,Jv as Se,zc as ge,Cn as Ie,EY as he,FB as be,GC as Oe,Pn as Te,Po as De,Pp as ke,Pq as Ce,Pr as Ve,LY as we,Op as Ae,M7 as Ne,l5 as ve,gc as _e,gb as Fe,ga as xe,rv as Pe,rm as Ee,rj as ze,kZ as Be,tv as Re,tt as L,bE as M,tH as j,cw as Le}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as Me}from"./mui-BcLZDyi8.js";import{d as U}from"./routePaths-DQbleX1q.js";import{M as je}from"./MobileAppDrawer-CLztF99b.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="4a950a91-6c5e-4ed1-9ef7-88fde851bc7a",e._sentryDebugIdIdentifier="sentry-dbid-4a950a91-6c5e-4ed1-9ef7-88fde851bc7a")}catch{}})();const Ue=Me.div`
1
+ import{j as k}from"./liveblocks-DtJmjn-F.js";import{a as V}from"./sentry-DJoVhts9.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-B1V19BTM.js";import{A as ce,a as ue,aN as de,z as E,w as pe,e as z,af as x,g as P,bD as le,at as me,n as B,au as R}from"./index-B1BV6O_s.js";import{P0 as fe,eT as G,tm as ye,Jv as Se,zc as ge,Cn as Ie,EY as be,FB as he,GC as Oe,Pn as Te,Po as De,Pp as ke,Pq as Ce,Pr as Ve,LY as we,Op as Ae,M7 as Ne,l5 as ve,gc as _e,gb as Fe,ga as xe,rv as Pe,rm as Ee,rj as ze,kZ as Be,tv as Re,tt as L,bE as M,tH as j,cw as Le}from"./zeni-epic-state-Ct7fOB-u.js";import{n as Me}from"./mui-D6ES9V4N.js";import{d as U}from"./routePaths-BaN0YLzj.js";import{M as je}from"./MobileAppDrawer-DY_LJNf1.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="055189d7-f20a-49fb-abd8-31e4352879b0",e._sentryDebugIdIdentifier="sentry-dbid-055189d7-f20a-49fb-abd8-31e4352879b0")}catch{}})();const Ue=Me.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as k}from"./liveblocks-PtDFv95_.js";import{a as V}from"./sentry-mCXLUbm
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=we(d.roleMap)&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=Ae(e.companyConfigState),s=Ne(e.userRoleConfigState);return{businessVerificationDetails:i,verficationDetailsFetchState:i.fetchState,isRefreshingViewInBackground:i.isRefreshingViewInBackground,allNationalityCountries:i.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:s.companyTitles}},function(e,d){const{companyId:i,productType:r,currentTenant:y,navigate:S,location:l}=d,{tenantEmailDomain:b}=y;return{onCompanyDetailsChanged:t=>{const{companyDescription:s,companyIndustry:p,companyIndustryType:T,companyLegalName:D,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:c,primaryContactName:n,primaryContactUserId:u,primaryContactSyncToken:O,syncToken:f,fileIds:a,incDate:o,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:v,countriesOfOperations:h,companySourceOfFunds:q,companySourceOfFundsDescription:Z,transactionVolume:Y,transactionVolumeDescription:$,purposeOfAccount:H,purposeOfAccountDescription:J,regulatedStatus:W,regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X}=t,_=T?.selectedOption,ee={companyId:i,companyDescription:s,companyIndustry:p.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:D,taxIdOrEIN:g,website:m!=""&&m!=null?Le(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:o!=null?M(o?.toString()):o,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:v?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map(F=>F.length===2?F:R(F))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:Y?.selectedOption??"",transactionVolumeDescription:$,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:W??"",regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X?.selectedOptions??[]},te={userId:u,firstName:n.firstName,lastName:n.lastName,email:c,syncToken:O};e(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:t=>{const s=t.map(p=>{const{officerType:T,userId:D,name:g,email:m,nationalityCountryCode:I,ssn:c,dob:n,phone:u,syncToken:O,selectDocument:f,role:a,ownership:o,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:v}=p;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:T,userId:D,firstName:g.firstName,lastName:g.lastName,email:m,ssn:c,nationalityCountryCode:I?.selectedOption!=null?R(I.selectedOption):void 0,phone:u,birthday:n!=null?M(n?.toString()):n,syncToken:O,titleAtCompany:a.selectedOption,ownershipInCompany:o,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:v,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}});e(j({officers:s}))},onSaveDetailsClick:t=>{e(L(i,t,r))},onSendForVerificationClick:t=>{e(L(i,t,r,!0))},onAddressClick:t=>{const s=U(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:t=>{const s=U(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onBackClick:()=>{e(Re({companyId:i})),S("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(ze(t))},onDeleteFileList:t=>{e(Ee(t))},onEditFileName:(t,s)=>{e(Pe(t,s.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Fe(t,"SpendManagementSetup"))},onVerifyOtp:(t,s)=>{e(_e(t,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,s)=>{e(ve({addressType:t,addressToCreate:s}))}}})(le),Qe=({productType:e})=>{const d=ae(),i=ne(),r=se(),[y,S]=V.useState(!1),[l,b]=V.useState(!1),{tenantEmailDomain:t}=ie(),s=ce(),{useDynamicConfig:p}=ue(),{configValue:T}=p(de.zeniAccountsConfig),D=fe(T),g=C(a=>{switch(e){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}}),m=C(a=>a.companyConfigState.fetchState),I=C(a=>a.userRoleConfigState.fetchState),c=C(a=>G(a)),n=c.companyId??E.getSignedInUserTenant(t)?.companyId;if(V.useEffect(()=>{m==="Not-Started"&&r(ye()),I==="Not-Started"&&r(Se(!0))},[m,I,r]),V.useEffect(()=>{if(!y&&g==="Not-Started"&&n!=null)switch(S(!0),e){case"zeni_accounts":r(Oe(n,!0));break;case"zeni_treasury":r(be(n,!0));break;case"reimbursement":r(he(n,!0));break;case"charge_cards":r(Ie(n,!0));break;default:r(ge(n,!0))}},[y,g,n,r]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let u;switch(e){case"zeni_accounts":u=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":u=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":u=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":u=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:u=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=a=>{b(a)},f=C(a=>{let o;switch(e){case"zeni_accounts":o=Ve(a,n);break;case"zeni_treasury":o=Ce(a,n);break;case"charge_cards":o=ke(a,n);break;case"reimbursement":o=De(a,n);break;default:o=Te(a,n)}return o});return u===!1?k.jsx(oe,{to:"../promo"}):k.jsxs(Ue,{children:[k.jsx(pe,{analytics:z,onLoad:a=>(o=>{switch(e){case"zeni_accounts":return o.trackPageLoaded(P.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return o.trackPageLoaded(P.Event.reimbursementBusinessVerification);default:return o.trackPageLoaded(P.Event.billPayBusinessVerification,x(i)?"Settings":void 0)}})(a)}),x(i)?k.jsx(je,{isAppContentDrawerOpen:l,handleDrawerToggle:O}):null,k.jsx(Ge,{businessVerificationDetails:f,navigate:d,location:i,companyId:n,analytics:z,currentTenant:c,productType:e,isSettings:x(i),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:D.maxInsuredAmount})]})};export{Qe as B};
9
+ `,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},h=we(d.roleMap)&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=Ae(e.companyConfigState),s=Ne(e.userRoleConfigState);return{businessVerificationDetails:i,verficationDetailsFetchState:i.fetchState,isRefreshingViewInBackground:i.isRefreshingViewInBackground,allNationalityCountries:i.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:h,allIndustries:t.companyIndustries??[],companyTitles:s.companyTitles}},function(e,d){const{companyId:i,productType:r,currentTenant:y,navigate:S,location:l}=d,{tenantEmailDomain:h}=y;return{onCompanyDetailsChanged:t=>{const{companyDescription:s,companyIndustry:p,companyIndustryType:T,companyLegalName:D,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:c,primaryContactName:n,primaryContactUserId:u,primaryContactSyncToken:O,syncToken:f,fileIds:a,incDate:o,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:v,countriesOfOperations:b,companySourceOfFunds:q,companySourceOfFundsDescription:Z,transactionVolume:Y,transactionVolumeDescription:$,purposeOfAccount:H,purposeOfAccountDescription:J,regulatedStatus:W,regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X}=t,_=T?.selectedOption,ee={companyId:i,companyDescription:s,companyIndustry:p.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:D,taxIdOrEIN:g,website:m!=""&&m!=null?Le(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:o!=null?M(o?.toString()):o,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:v?.selectedOption??"",countriesOfOperations:b?.selectedOptions.map(F=>F.length===2?F:R(F))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:Y?.selectedOption??"",transactionVolumeDescription:$,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:W??"",regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X?.selectedOptions??[]},te={userId:u,firstName:n.firstName,lastName:n.lastName,email:c,syncToken:O};e(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:t=>{const s=t.map(p=>{const{officerType:T,userId:D,name:g,email:m,nationalityCountryCode:I,ssn:c,dob:n,phone:u,syncToken:O,selectDocument:f,role:a,ownership:o,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:v}=p;let b;return f.selectDocumentType==="driverLicense"?b="driving_license":f.selectDocumentType==="passport"?b="passport":f.selectDocumentType==="stateId"?b="id_document":f.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:T,userId:D,firstName:g.firstName,lastName:g.lastName,email:m,ssn:c,nationalityCountryCode:I?.selectedOption!=null?R(I.selectedOption):void 0,phone:u,birthday:n!=null?M(n?.toString()):n,syncToken:O,titleAtCompany:a.selectedOption,ownershipInCompany:o,documentTypeSelectedForVerification:b,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:v,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}});e(j({officers:s}))},onSaveDetailsClick:t=>{e(L(i,t,r))},onSendForVerificationClick:t=>{e(L(i,t,r,!0))},onAddressClick:t=>{const s=U(h,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:t=>{const s=U(h,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onBackClick:()=>{e(Re({companyId:i})),S("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(ze(t))},onDeleteFileList:t=>{e(Ee(t))},onEditFileName:(t,s)=>{e(Pe(t,s.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Fe(t,"SpendManagementSetup"))},onVerifyOtp:(t,s)=>{e(_e(t,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,s)=>{e(ve({addressType:t,addressToCreate:s}))}}})(le),Qe=({productType:e})=>{const d=ae(),i=ne(),r=se(),[y,S]=V.useState(!1),[l,h]=V.useState(!1),{tenantEmailDomain:t}=ie(),s=ce(),{useDynamicConfig:p}=ue(),{configValue:T}=p(de.zeniAccountsConfig),D=fe(T),g=C(a=>{switch(e){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}}),m=C(a=>a.companyConfigState.fetchState),I=C(a=>a.userRoleConfigState.fetchState),c=C(a=>G(a)),n=c.companyId??E.getSignedInUserTenant(t)?.companyId;if(V.useEffect(()=>{m==="Not-Started"&&r(ye()),I==="Not-Started"&&r(Se(!0))},[m,I,r]),V.useEffect(()=>{if(!y&&g==="Not-Started"&&n!=null)switch(S(!0),e){case"zeni_accounts":r(Oe(n,!0));break;case"zeni_treasury":r(he(n,!0));break;case"reimbursement":r(be(n,!0));break;case"charge_cards":r(Ie(n,!0));break;default:r(ge(n,!0))}},[y,g,n,r]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let u;switch(e){case"zeni_accounts":u=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":u=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":u=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":u=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:u=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=a=>{h(a)},f=C(a=>{let o;switch(e){case"zeni_accounts":o=Ve(a,n);break;case"zeni_treasury":o=Ce(a,n);break;case"charge_cards":o=ke(a,n);break;case"reimbursement":o=De(a,n);break;default:o=Te(a,n)}return o});return u===!1?k.jsx(oe,{to:"../promo"}):k.jsxs(Ue,{children:[k.jsx(pe,{analytics:z,onLoad:a=>(o=>{switch(e){case"zeni_accounts":return o.trackPageLoaded(P.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return o.trackPageLoaded(P.Event.reimbursementBusinessVerification);default:return o.trackPageLoaded(P.Event.billPayBusinessVerification,x(i)?"Settings":void 0)}})(a)}),x(i)?k.jsx(je,{isAppContentDrawerOpen:l,handleDrawerToggle:O}):null,k.jsx(Ge,{businessVerificationDetails:f,navigate:d,location:i,companyId:n,analytics:z,currentTenant:c,productType:e,isSettings:x(i),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:D.maxInsuredAmount})]})};export{Qe as B};
@@ -1,14 +1,14 @@
1
- import{j as b}from"./liveblocks-PtDFv95_.js";import{a as i}from"./sentry-mCXLUbmc.js";import{n as z}from"./utils-C9yOAUzR.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as Ae}from"./core-BZimyUuM.js";import{V as ve,a as Te,x as W,z as Oe,d2 as Ue,d4 as xe,b5 as ee,v as Fe,d as V,d5 as G,dc as _e,O as Qe,f as De,a7 as Le,d8 as $e,a2 as Ve,dd as Re,b1 as He,db as Me}from"./index-aKhhTDIh.js";import{gg as je,g1 as Ne,g2 as Y,g3 as qe,fM as te,g4 as Be,g5 as ze,eS as se,eT as We,g6 as Ge,eZ as Ye,iC as Ze,iy as Je,eU as Z,fF as Ke,fG as Xe,fH as et,fI as tt,fJ as st,fK as at,fL as ot,fN as nt,fO as it,fP as J,bE as K,fQ as rt,fR as lt,fS as dt,fT as ct,fU as ut,fV as mt,fy as ft,fC as X,fW as pt,fX as Ct,fY as St,fZ as ht,f_ as gt,f$ as bt,g0 as yt}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as Pt,n as H,P as It,S as wt}from"./mui-BcLZDyi8.js";import{d as Et}from"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="b99f67bb-fdb2-4a54-89b9-eea816b71628",e._sentryDebugIdIdentifier="sentry-dbid-b99f67bb-fdb2-4a54-89b9-eea816b71628")}catch{}})();const kt=e=>yt(e,!1),At=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function R(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const vt=Ae(function(e,r){const s=se(e),C=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Xe(c),S=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:C,isNewChatSession:r.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,allUsers:r.allUsers,cardPolicyCategorySearchOptions:m.map(kt),cardPolicyVendorSearchOptions:d.map(At),cardPolicyIsVendorSearchLoading:S==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:C,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:S,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,cardPolicyPageContext:k}=r,f=C.tenantEmailDomain,U=s.state?.referrer,u=U===ne?ie(f):R(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=Ct(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:x,currentQuestionAnswer:A,currentQuestionAnswerSummary:P}=ee(S,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,A?.question.questionText??"",t.text,p,Me(P,x),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,A?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,St(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(ht({chatSessionId:t.metadata.chat_session_id,responseType:n,fetchState:{fetchState:"Completed",error:void 0}})),e(gt({chatSessionId:t.metadata.chat_session_id,answerPayload:t,userId:c}))}},onSubmit:(a,l,t,n)=>{a&&He(e,a,l,d,S,c,n,t,k)},updateCurrentInput:a=>{e(X(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(X(""))},togglePageView:()=>{m(u,{state:{...s.state}}),r.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{d!=null&&e(ft()),m(function(a){return`/${a}/${oe}`}(f),{state:{...s.state}})},onToggleCotCollapsed:(a,l)=>{e(mt({questionAnswerId:a,isCollapsed:l}))},onCardsCreationFormChange:E?a=>{e(ut(a))}:void 0,onCardsCreationFormSubmit:E?(a,l)=>{const t=lt(a);t.length!==0&&(e(dt(t)),e(ct({sourceChatSessionId:d??void 0})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(R(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:y?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:y?(a,l)=>{const t=Re({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:y?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:y?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),O=re.pageTitle,Tt=le.pageTitle,Ot=re.chatHeaderSubtitle,Ut=le.chatHeaderSubtitle,Yt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=ve(),s=Ie(),C=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:S}=Te(),{isFeatureEnabled:E}=S(W.isAiCardCreationEnabled),{isFeatureEnabled:y}=S(W.isCardPolicyEnabled);i.useEffect(()=>{s(je())},[s]),i.useEffect(()=>(s(Ne()),s(Y()),s(qe("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>Be(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(ze(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(Y(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const U=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Oe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>We(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:x,isUploadPromoVisible:A}=Ue({isFileUploadEnabled:e,tenantEmailDomain:p}),P=c.state,h=P?.aiCfoInitialQuestion??null,F=!!P?.aiCfoShouldSubmit,I=P?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:O,subtitle:I?Ut:Ot}),[I]),[ue,_]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||h==null||h===""||(_(h),Q(F),D.current=!0)},[h,F]);const fe=i.useCallback(()=>{_(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,v=i.useRef(null);i.useEffect(()=>{if(g&&v.current!=null){const{question:o,shouldSubmit:w}=v.current;v.current=null,_(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=xe(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,j=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",N=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),q=u.allSessionsWithOrderedQuestionAnswers,B=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,Ce=i.useMemo(()=>B.map(o=>o.user).filter(o=>o!=null),[B]),{currentSessionQuestionAnswers:Se}=ee(q,n),he=Se.length===0;i.useEffect(()=>{n!=null&&l!==n&&C(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,C,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Ye({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,Pe)=>Pe.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ze())},[L,$,s]),i.useEffect(()=>{n!=null&&j!=="In-Progress"&&N&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[j,N,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",ye=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(Ft,{children:[b.jsx(Fe,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(vt,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:q,allUsers:Ce,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:C,sessionFromUrl:be,location:c,isSubmitting:ye,isEmptyChatWithSession:he,customPageTitle:O,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:A,onUploadPromoClose:x,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>{C(I?ie(p):R(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(h!=null&&h!==""&&(v.current={question:h,shouldSubmit:F}),s(Z(t.userRoleId)))}}),b.jsx(Pt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:_t,style:{width:`${_e}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(xt,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Z(t.userRoleId)),d(!1)}})})})]})},xt=H(wt)`
1
+ import{j as b}from"./liveblocks-DtJmjn-F.js";import{a as i}from"./sentry-DJoVhts9.js";import{n as z}from"./utils-B1ItiyXC.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as ve}from"./core-B1V19BTM.js";import{V as Ae,a as Te,d as W,z as Oe,d2 as Ue,d4 as Fe,b5 as ee,w as _e,e as V,d5 as G,dc as xe,O as Qe,g as De,a7 as Le,d8 as $e,a2 as Ve,dd as Re,b1 as He,db as Me}from"./index-B1BV6O_s.js";import{gg as je,g1 as Ne,g2 as Y,g3 as qe,fM as te,g4 as Be,g5 as ze,eS as se,eT as We,g6 as Ge,eZ as Ye,iC as Ze,iy as Je,eU as Z,fF as Ke,fG as Xe,fH as et,fI as tt,fJ as st,fK as at,fL as ot,fN as nt,fO as it,fP as J,bE as K,fQ as rt,fR as lt,fS as dt,fT as ct,fU as ut,fV as mt,fy as ft,fC as X,fW as pt,fX as Ct,fY as St,fZ as ht,f_ as gt,f$ as bt,g0 as yt}from"./zeni-epic-state-Ct7fOB-u.js";import{D as Pt,n as H,P as It,S as wt}from"./mui-D6ES9V4N.js";import{d as Et}from"./recharts-C_sYuD8f.js";import"./analytics-CR-Ji6KN.js";import"./plaid-Cvs9FZAe.js";import"./dnd-DY5CyMCW.js";import"./stripe-DMRn4zHo.js";import"./lottie-PNrYlsmY.js";import"./lexical-DtEMPKph.js";import"./pdf-C3786_Gz.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="918079f1-637c-4242-8b05-bc42e87ba331",e._sentryDebugIdIdentifier="sentry-dbid-918079f1-637c-4242-8b05-bc42e87ba331")}catch{}})();const kt=e=>yt(e,!1),vt=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function R(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const At=ve(function(e,r){const s=se(e),C=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Xe(c),S=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:C,isNewChatSession:r.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,allUsers:r.allUsers,cardPolicyCategorySearchOptions:m.map(kt),cardPolicyVendorSearchOptions:d.map(vt),cardPolicyIsVendorSearchLoading:S==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:C,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:S,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,cardPolicyPageContext:k}=r,f=C.tenantEmailDomain,U=s.state?.referrer,u=U===ne?ie(f):R(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=Ct(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:F,currentQuestionAnswer:v,currentQuestionAnswerSummary:P}=ee(S,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,v?.question.questionText??"",t.text,p,Me(P,F),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,v?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,St(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(ht({chatSessionId:t.metadata.chat_session_id,responseType:n,fetchState:{fetchState:"Completed",error:void 0}})),e(gt({chatSessionId:t.metadata.chat_session_id,answerPayload:t,userId:c}))}},onSubmit:(a,l,t,n)=>{a&&He(e,a,l,d,S,c,n,t,k)},updateCurrentInput:a=>{e(X(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(X(""))},togglePageView:()=>{m(u,{state:{...s.state}}),r.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{d!=null&&e(ft()),m(function(a){return`/${a}/${oe}`}(f),{state:{...s.state}})},onToggleCotCollapsed:(a,l)=>{e(mt({questionAnswerId:a,isCollapsed:l}))},onCardsCreationFormChange:E?a=>{e(ut(a))}:void 0,onCardsCreationFormSubmit:E?(a,l)=>{const t=lt(a);t.length!==0&&(e(dt(t)),e(ct({sourceChatSessionId:d??void 0})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(R(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:y?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:y?(a,l)=>{const t=Re({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:y?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:y?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),O=re.pageTitle,Tt=le.pageTitle,Ot=re.chatHeaderSubtitle,Ut=le.chatHeaderSubtitle,Yt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=Ae(),s=Ie(),C=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:S}=Te(),{isFeatureEnabled:E}=S(W.isAiCardCreationEnabled),{isFeatureEnabled:y}=S(W.isCardPolicyEnabled);i.useEffect(()=>{s(je())},[s]),i.useEffect(()=>(s(Ne()),s(Y()),s(qe("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>Be(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(ze(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(Y(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const U=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Oe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>We(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:F,isUploadPromoVisible:v}=Ue({isFileUploadEnabled:e,tenantEmailDomain:p}),P=c.state,h=P?.aiCfoInitialQuestion??null,_=!!P?.aiCfoShouldSubmit,I=P?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:O,subtitle:I?Ut:Ot}),[I]),[ue,x]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||h==null||h===""||(x(h),Q(_),D.current=!0)},[h,_]);const fe=i.useCallback(()=>{x(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,A=i.useRef(null);i.useEffect(()=>{if(g&&A.current!=null){const{question:o,shouldSubmit:w}=A.current;A.current=null,x(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=Fe(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,j=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",N=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),q=u.allSessionsWithOrderedQuestionAnswers,B=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,Ce=i.useMemo(()=>B.map(o=>o.user).filter(o=>o!=null),[B]),{currentSessionQuestionAnswers:Se}=ee(q,n),he=Se.length===0;i.useEffect(()=>{n!=null&&l!==n&&C(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,C,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Ye({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,Pe)=>Pe.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ze())},[L,$,s]),i.useEffect(()=>{n!=null&&j!=="In-Progress"&&N&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[j,N,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",ye=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(_t,{children:[b.jsx(_e,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(At,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:q,allUsers:Ce,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:C,sessionFromUrl:be,location:c,isSubmitting:ye,isEmptyChatWithSession:he,customPageTitle:O,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:v,onUploadPromoClose:F,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>{C(I?ie(p):R(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(h!=null&&h!==""&&(A.current={question:h,shouldSubmit:_}),s(Z(t.userRoleId)))}}),b.jsx(Pt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:xt,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(Ft,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Z(t.userRoleId)),d(!1)}})})})]})},Ft=H(wt)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
- `,Ft=H.div`
5
+ `,_t=H.div`
6
6
  flex: 1 1 auto;
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
  min-height: 0;
10
10
  width: 100%;
11
- `,_t=H(It)`
11
+ `,xt=H(It)`
12
12
  box-shadow: ${({theme:e})=>e.colors.elevation2};
13
13
  color: ${({theme:e})=>e.colors.grey4};
14
14
  `;export{Yt as default};