@zeniai/web-app-ui 5.2.16-qa → 5.2.17-qa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/assets/AddressRoutes-C9ePPZTc.js +1 -0
  2. package/dist/assets/AddressScreen-Ba-VvOjK.js +9 -0
  3. package/dist/assets/{AiCfoScreen-DiSXwSAy.js → AiCfoScreen-BVHcwn1-.js} +4 -4
  4. package/dist/assets/{BillPayApprovalRoutes-Bzj_wN2N.js → BillPayApprovalRoutes-GlLqvwOB.js} +1 -1
  5. package/dist/assets/BillPayRoutes-CC8ojAoZ.js +119 -0
  6. package/dist/assets/BusinessVerificationPageScreen-BZk1AoM_.js +9 -0
  7. package/dist/assets/{CardsAiCfoScreen-CvKPSEX_.js → CardsAiCfoScreen-DdtKtE2m.js} +3 -3
  8. package/dist/assets/{ChargeCardRoutes-B_kWsesI.js → ChargeCardRoutes-CEOawkX4.js} +8 -8
  9. package/dist/assets/CompanyPassportScreen-DpwDdQJT.js +1 -0
  10. package/dist/assets/ConnectionAuthScreen-4wK0rBPz.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-C6JuurfT.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-fNU7A_X6.js → CustomerOnboardingRoutes-Dxrd_oMn.js} +6 -6
  13. package/dist/assets/{DashboardRoutes-vwFGyOnq.js → DashboardRoutes-CgelQ0B8.js} +1 -1
  14. package/dist/assets/DefaultTenantHome-D6efsYE9.js +1 -0
  15. package/dist/assets/DomesticWireDetailScreen-CQmjKCQc.js +18 -0
  16. package/dist/assets/DrawerScreen-D1JpfIY3.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-Dzsfy19y.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-Bcbqp-xi.js → ExpenseAutomationRoutes-Qm3X_H6K.js} +3 -3
  19. package/dist/assets/{FeaturePreviewScreen-CQa-Dzig.js → FeaturePreviewScreen-BKTS5XLx.js} +1 -1
  20. package/dist/assets/HubSpotOAuthCallbackScreen-BDz3Agei.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-Cn1P1SX6.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-CB996C-0.js +12 -0
  23. package/dist/assets/MobileAppDrawer-hdYoVCXp.js +1 -0
  24. package/dist/assets/NotFoundScreen-B6nbKEPc.js +1 -0
  25. package/dist/assets/NotificationRoutes-Ds6eCL2b.js +1 -0
  26. package/dist/assets/OAuthConsentScreen-Ba0wA_HU.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-BBHF28-E.js +1 -0
  28. package/dist/assets/PeopleRoutes-DXDqmyhJ.js +22 -0
  29. package/dist/assets/PerformanceRoutes-BaKOjCPx.js +1 -0
  30. package/dist/assets/{Preview-CcprGnkI.js → Preview-BD6Y1F_q.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-TnPId4Sm.js → QBOConnectionScreen-CCcDJEqP.js} +1 -1
  32. package/dist/assets/ReimbursementApprovalRoutes-62K0ZFMF.js +1 -0
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DdpFdkik.js → ReimbursementApprovalRuleDetailScreen-Dgh8Yquq.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-CEVKaVBL.js → ReimbursementRoutes-DoahH0o8.js} +10 -10
  35. package/dist/assets/{ReportsRoutes-B1TQ9Bhd.js → ReportsRoutes-BRx0lkFY.js} +1 -1
  36. package/dist/assets/RewardsRoutes-CXoqy3I2.js +1 -0
  37. package/dist/assets/ScreenRoutes-BYtpyV-M.js +2 -0
  38. package/dist/assets/{SettingsRoutes-Cwng1-zQ.js → SettingsRoutes-CmZf5R1j.js} +8 -8
  39. package/dist/assets/{SetupPagesScreen-DFoSoY9W.js → SetupPagesScreen-D2lEnwjt.js} +5 -5
  40. package/dist/assets/SignInScreen-BoIjGUSc.js +1 -0
  41. package/dist/assets/SignOutScreen-CwtCC2I_.js +9 -0
  42. package/dist/assets/TaskListScreen-B0fkcObi.js +9 -0
  43. package/dist/assets/TaskRoutes-DpRNRovH.js +9 -0
  44. package/dist/assets/{TransactionDetailRoutes-djuKroPk.js → TransactionDetailRoutes-B4V40VOl.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-D5r3-Mgi.js → TransactionDetailScreen-Dyormtjy.js} +2 -2
  46. package/dist/assets/{TransactionListRoutes-DZo7bIuR.js → TransactionListRoutes-BHh4uWIi.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-Dicm3fpM.js → TreasuryRoutes-BdMeVeBd.js} +5 -5
  48. package/dist/assets/{VendorsRoutes-CSBYzvJD.js → VendorsRoutes-xEmDK5qc.js} +14 -14
  49. package/dist/assets/WiseConfirmationScreen-CogkOQi0.js +12 -0
  50. package/dist/assets/{ZeniAccountRoutes-BZkpbBgO.js → ZeniAccountRoutes-X8MXJuIg.js} +11 -11
  51. package/dist/assets/ZeniAccountStatementScreen-rGHf8AJK.js +9 -0
  52. package/dist/assets/{accountMappingHelper-DvHt_faU.js → accountMappingHelper-Cg1rcuy8.js} +1 -1
  53. package/dist/assets/{analytics-fzE8ssbj.js → analytics-CP-wGaZJ.js} +1 -1
  54. package/dist/assets/analyticsHelper-CBp9b8VI.js +1 -0
  55. package/dist/assets/{core-Bnb5S7eF.js → core-4nWRIid2.js} +1 -1
  56. package/dist/assets/{decodeURIComponentSafe-IB5WoVjO.js → decodeURIComponentSafe-B-9vw5Be.js} +1 -1
  57. package/dist/assets/{dnd-BclBZkmc.js → dnd-DPx0nGIt.js} +1 -1
  58. package/dist/assets/{empty-CGGO74v5.js → empty-BWSUSl2t.js} +1 -1
  59. package/dist/assets/{empty-BXrJtoVu.js → empty-dwCpPdyI.js} +1 -1
  60. package/dist/assets/{emptyVideoElement-DBjMlLZt.js → emptyVideoElement-Cgz9sC1U.js} +1 -1
  61. package/dist/assets/epic-BIxKmwU7.js +2 -0
  62. package/dist/assets/getLocaleForTenant-BhD_5oG2.js +1 -0
  63. package/dist/assets/{index-D7gFR706.js → index-B89XzExo.js} +1 -1
  64. package/dist/assets/{index-BfeFOTnu.js → index-BEdY_Av6.js} +1 -1
  65. package/dist/assets/{index-BSl9hMca.js → index-C53rjstg.js} +2 -2
  66. package/dist/assets/index-Cx4f0JbF.css +1 -0
  67. package/dist/assets/{index-oAxAWZsp.js → index-D7c6Pfp9.js} +1 -1
  68. package/dist/assets/{index-B9FzYJpE.js → index-DmHtkhiK.js} +1 -1
  69. package/dist/assets/{index-DRI9BXaF.js → index-P8XH9v_Z.js} +1 -1
  70. package/dist/assets/{index-gZ-YqOdE.js → index-ot86Rern.js} +1 -1
  71. package/dist/assets/{index-DQqz4S7_.js → index-qYSCKekz.js} +33478 -32829
  72. package/dist/assets/{lexical-DbVLnI8g.js → lexical-Dce73siJ.js} +1 -1
  73. package/dist/assets/liveblocks-BqtYq8PY.js +54 -0
  74. package/dist/assets/{lottie-CosVBOrn.js → lottie-C6mBeCcV.js} +1 -1
  75. package/dist/assets/{mui-BAFflVdx.js → mui-ChRNPf14.js} +1 -1
  76. package/dist/assets/{pathToGoBack-BX0vhbVE.js → pathToGoBack-DjzKcd4A.js} +1 -1
  77. package/dist/assets/{pdf-Ba7sOjY6.js → pdf-CHegScPw.js} +3 -3
  78. package/dist/assets/{pdf-lib-Sz3Y8uGi.js → pdf-lib-xuF5byC3.js} +1 -1
  79. package/dist/assets/{plaid-Il6Pn-tK.js → plaid-j-SLH4pe.js} +1 -1
  80. package/dist/assets/{pusher-DSTN6BAp.js → pusher-BK7gFb-W.js} +1 -1
  81. package/dist/assets/{react-DjsKx-MP.js → react-Bo9yX59J.js} +1 -1
  82. package/dist/assets/{react-DF-XRbvU.js → react-CWkBMv_4.js} +1 -1
  83. package/dist/assets/{react-Ahj_9ocn.js → react-D_MXXpOM.js} +1 -1
  84. package/dist/assets/{react-BQr1_2Lm.js → react-Dy3J-4XE.js} +1 -1
  85. package/dist/assets/{react-DV1w5wyt.js → react-YqzjdluA.js} +1 -1
  86. package/dist/assets/{react-wreqxVEC.js → react-wzy7xDal.js} +1 -1
  87. package/dist/assets/{recharts-B3FaT6ex.js → recharts-UIIeT-6j.js} +1 -1
  88. package/dist/assets/routePaths-TA66BJgf.js +1 -0
  89. package/dist/assets/{sentry-Bj_fC7Ll.js → sentry-BtWdTNDK.js} +1 -1
  90. package/dist/assets/{url-CRSVA0N_.js → url-CUWwwyN4.js} +1 -1
  91. package/dist/assets/{url-Cv9qurGb.js → url-CkFCyaeM.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-C3L5nQ7N.js → useAiCfoDashboardSuggestedQuestionsChips-DqLJLw_b.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-yAJW2Zxp.js +1 -0
  94. package/dist/assets/useCashManagementBanner-Dbz53g9T.js +1 -0
  95. package/dist/assets/{useChargeCardPusherEvents-t2lV6Mj_.js → useChargeCardPusherEvents-CFucNvvU.js} +1 -1
  96. package/dist/assets/{useDeviceId-CnUmsNEA.js → useDeviceId-BVGc_c85.js} +1 -1
  97. package/dist/assets/useEmailConnectResultRefresh-DnMJ5jdi.js +1 -0
  98. package/dist/assets/{useInitialThreadRequest-DA5ML13t.js → useInitialThreadRequest-BeFUEHq1.js} +1 -1
  99. package/dist/assets/{utils-BKBg63lI.js → utils-BGj88Dzy.js} +1 -1
  100. package/dist/assets/{withTransactionSidePanel-ZD8SIzTb.js → withTransactionSidePanel-DIWgh7V_.js} +2 -2
  101. package/dist/assets/{zeni-epic-state-GXytJkko.js → zeni-epic-state-Brhydpej.js} +6 -6
  102. package/dist/index.html +1 -1
  103. package/package.json +8 -5
  104. package/dist/assets/AddressRoutes-CvVopZml.js +0 -1
  105. package/dist/assets/AddressScreen-DWZ3m1W6.js +0 -9
  106. package/dist/assets/BillPayRoutes-Bf6AaWgJ.js +0 -119
  107. package/dist/assets/BusinessVerificationPageScreen-DFVMEcvH.js +0 -9
  108. package/dist/assets/CompanyPassportScreen-D3CNonob.js +0 -1
  109. package/dist/assets/ConnectionAuthScreen-BN3ff9tH.js +0 -11
  110. package/dist/assets/CustomerOnboardingAuthScreen-DlKfeAMx.js +0 -1
  111. package/dist/assets/DefaultTenantHome-COmsVe67.js +0 -1
  112. package/dist/assets/DomesticWireDetailScreen-Bmq0Ta-G.js +0 -18
  113. package/dist/assets/DrawerScreen-CFNs8DOc.js +0 -1
  114. package/dist/assets/EntityDetailRoutes-BhHCRnyf.js +0 -1
  115. package/dist/assets/HubSpotOAuthCallbackScreen-yv2-7Ea8.js +0 -1
  116. package/dist/assets/MagicLinkRoutes-DSjPLdSb.js +0 -72
  117. package/dist/assets/MagicLinkSignInScreen-D_r-xHBU.js +0 -12
  118. package/dist/assets/MobileAppDrawer-CcKlE5IP.js +0 -1
  119. package/dist/assets/NotFoundScreen-DlOrYovK.js +0 -1
  120. package/dist/assets/NotificationRoutes-gyrenPAq.js +0 -1
  121. package/dist/assets/OAuthConsentScreen-1d0A0tZs.js +0 -1
  122. package/dist/assets/PandLWithForecastRoutes-DjhLwT7A.js +0 -1
  123. package/dist/assets/PeopleRoutes-B4_xTiyk.js +0 -22
  124. package/dist/assets/PerformanceRoutes-DylBZUt_.js +0 -1
  125. package/dist/assets/ReimbursementApprovalRoutes-POVUD6sL.js +0 -1
  126. package/dist/assets/RewardsRoutes-DfP429d0.js +0 -1
  127. package/dist/assets/ScreenRoutes-B4XnnElP.js +0 -2
  128. package/dist/assets/SignInScreen-e-dzxuhM.js +0 -1
  129. package/dist/assets/SignOutScreen-zX0f3nhU.js +0 -9
  130. package/dist/assets/TaskListScreen-DDBul9iH.js +0 -9
  131. package/dist/assets/TaskRoutes-8qo7Ls7z.js +0 -9
  132. package/dist/assets/WiseConfirmationScreen-Cq4Two3C.js +0 -12
  133. package/dist/assets/ZeniAccountStatementScreen-CrIZG1fJ.js +0 -9
  134. package/dist/assets/analyticsHelper-H9dml3jr.js +0 -1
  135. package/dist/assets/epic-Bq9rvz3h.js +0 -2
  136. package/dist/assets/getLocaleForTenant-CqG7z-4D.js +0 -1
  137. package/dist/assets/index-Czu7h9lW.css +0 -1
  138. package/dist/assets/liveblocks-bqFl_SVp.js +0 -54
  139. package/dist/assets/routePaths-BU7xzRci.js +0 -1
  140. package/dist/assets/useAskAiCfoHostNavButtonProps-C8xAByz8.js +0 -1
  141. package/dist/assets/useCashManagementBanner-7vax8nj5.js +0 -1
  142. package/dist/assets/useEmailConnectResultRefresh-GsUIcf-d.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BqtYq8PY.js";import{A as d}from"./AddressScreen-Ba-VvOjK.js";import i from"./NotFoundScreen-B6nbKEPc.js";import"./sentry-BtWdTNDK.js";import{o as s,p as r}from"./core-4nWRIid2.js";import"./zeni-epic-state-Brhydpej.js";import"./recharts-UIIeT-6j.js";import"./index-qYSCKekz.js";import"./mui-ChRNPf14.js";import"./analytics-CP-wGaZJ.js";import"./plaid-j-SLH4pe.js";import"./dnd-DPx0nGIt.js";import"./stripe-cKAAJElX.js";import"./lottie-C6mBeCcV.js";import"./lexical-Dce73siJ.js";import"./pdf-CHegScPw.js";import"./utils-BGj88Dzy.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-BqtYq8PY.js";import{a as h}from"./sentry-BtWdTNDK.js";import{h as T,u as _,g as E,i as j,j as $,n as D}from"./core-4nWRIid2.js";import{J as B,E as M,z as L,D as N,C as K,Z as z,e as C,h as S,s as F,m as b,v as R}from"./index-qYSCKekz.js";import{Ne as w,h_ as U,e$ as G,Nf as O,c7 as V,Ng as q,lo as H}from"./zeni-epic-state-Brhydpej.js";import{n as J}from"./mui-ChRNPf14.js";import Z from"./NotFoundScreen-B6nbKEPc.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]="84506e28-cda8-49e5-adbd-c1b9298ef761",e._sentryDebugIdIdentifier="sentry-dbid-84506e28-cda8-49e5-adbd-c1b9298ef761")}catch{}})();const Q=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
+ `,W=D((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=R(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=X(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}}))(F);function re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=_(),n=E(),{addressId:s,addressType:u}=j(),g=B(),k=M(),v=L.getSignedInUser(),[f,x]=h.useState(s==null),p=$((m=>s!=null?w(m,s).fetchState:"Not-Started")),A=N();if(v==null)throw Error("Can't access address page without signing in...");const P=m=>m.trackPageLoaded(s!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{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(K,{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:P}),r.jsx(Q,{windowSize:g,children:r.jsx(W,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):r.jsx(Z,{})}const I=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},X=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,X as t};
@@ -1,17 +1,17 @@
1
- import{j as u}from"./liveblocks-bqFl_SVp.js";import{a as l}from"./sentry-Bj_fC7Ll.js";import{u as we,h as Pe,g as ye,j as J,i as Ee,n as Te}from"./core-Bnb5S7eF.js";import{Z as ve,de as Ae,z as Qe,p as _e,df as Oe,dg as Ue,bb as X,dh as ae,di as je,ba as oe,v as V,D as B,g as b,dj as R,dk as Fe,dl as Le,a3 as De,j as Be,a9 as Re,dm as Me,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,w as ze,b6 as He,ds as We}from"./index-DQqz4S7_.js";import{gp as Ye,eY as ne,eZ as Ze,iE as Ke,Um as Je,fs as Xe,iO as et,iK as tt,e_ as M,fz as st,g8 as at,g9 as ot,g1 as nt,j2 as ee,g5 as te,ga as it,gb as rt,gc as lt,gd as dt,ge as ct,gf as ut}from"./zeni-epic-state-GXytJkko.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-BAFflVdx.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-C3L5nQ7N.js";import{p as gt}from"./pathToGoBack-BX0vhbVE.js";import"./recharts-B3FaT6ex.js";import"./analytics-fzE8ssbj.js";import"./plaid-Il6Pn-tK.js";import"./dnd-BclBZkmc.js";import"./stripe-cKAAJElX.js";import"./lottie-CosVBOrn.js";import"./lexical-DbVLnI8g.js";import"./pdf-Ba7sOjY6.js";import"./utils-BKBg63lI.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="22cc0c8e-7671-4082-9ac6-d0932932daa5",e._sentryDebugIdIdentifier="sentry-dbid-22cc0c8e-7671-4082-9ac6-d0932932daa5")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:I}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:A}=oe(x,m);g!=="answer"?b.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,We(A,i),c.metadata.message_id??null):b.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&He(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),I(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=ze(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{I(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{I(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Re(Me)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=ye(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:I}=Ae();l.useEffect((()=>{a(Ye())}),[a]);const h=J((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=J((r=>Ze(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:re}=Oe({isFileUploadEnabled:e,tenantEmailDomain:w}),Q=Ue({currentTenant:m,currentChatSessionId:i,aiCfoView:h}),{isSuggestedQuestionsLoading:le,suggestedPromptQuestions:de}=St(),P=o.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;l.useEffect((()=>{const r=o.state;if(r?.[X]!==!0)return;d(!0);const f={...r};delete f[X],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,O]=l.useState(!1),[me,U]=l.useState(void 0),[pe,j]=l.useState(void 0),G=l.useRef(!1);l.useEffect((()=>{if(!G.current&&y!=null&&y!==""){const r=o.state;_(y),O($),U(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[y,$,o.state]);const he=l.useCallback((()=>{_(null),O(!1),U(void 0),j(void 0),p(o.pathname,{replace:!0,state:ae(o.state)})}),[o.pathname,o.state,p]),q=l.useMemo((()=>new URLSearchParams(o.search)),[o.search]),N=q.get("ref")??P?.aiCfoRef,F=q.get("emailRefId")??P?.aiCfoEmailRefId,z=l.useRef(!1);l.useEffect((()=>{z.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Ke("controller",s.userId,F,"MONTH_END_EMAIL")),z.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),O(!0),U(void 0),j(void 0),a(Je()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:H}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,W=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",Y=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),Z=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(Z,i),fe=ge.length===0;l.useEffect((()=>{C||g||p("../dashboard",{state:{...o.state,message:"open_ai_cfo_drawer"}})}),[C,g,p,o.state]);const Ce=l.useCallback((()=>{const r=V(o.state?.pathnameStackToGoBack),f=m.tenantEmailDomain;p(r.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...o.state,pathnameStackToGoBack:r.newStack}})}),[m.tenantEmailDomain,o.state,p]);l.useEffect((()=>{i!=null&&t!==i&&p(`../ai-cfo/${i}`,{state:{...o.state}})}),[i,t]),l.useEffect((()=>{t!=null&&i==null&&t!=="new_chat"&&t!=="explore"&&a(Xe({sessionId:t,agentId:"controller"}))}),[]);const Ie=l.useMemo((()=>({events:H.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[H]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&W!=="In-Progress"&&Y&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[W,Y,i,s,a]);const K=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const be=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(It,{children:[u.jsx(B,{analytics:b,onLoad:K}),Q.drawerElement,u.jsx(bt,{children:u.jsx(se,{children:u.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(M(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:b,onLoad:K}):null,u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:b,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&Q.drawerElement,u.jsx(ft,{...Ie,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:Z,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>d(!0),userId:s.userId,setIsAiCfoOpen:n,navigate:p,sessionFromUrl:t,location:o,isSubmitting:be,isEmptyChatWithSession:fe,currentTenant:m,emailLinkQuestion:ce??void 0,autoSubmitEmailLinkQuestion:ue,onEmailLinkQuestionProcessed:he,routedInitialQuestionSource:me,routedInitialQuestionSuggestionIndex:pe,onCardPolicyVendorSearchTextChange:I,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:re,onUploadPromoClose:A,exploreSuggestedPromptQuestions:de,exploreSuggestedPromptQuestionsLoading:le}),S&&g?u.jsx(mt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:kt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:u.jsx(se,{onClick:r=>r.stopPropagation(),children:u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})})}):null]}),S&&!g?u.jsx(Fe,{open:S,onClose:()=>d(!1),children:u.jsx(Le,{children:ke})}):null]})},se=k(pt)`
1
+ import{j as u}from"./liveblocks-BqtYq8PY.js";import{a as l}from"./sentry-BtWdTNDK.js";import{u as we,h as Pe,g as ye,j as K,i as Ee,n as Te}from"./core-4nWRIid2.js";import{Y as ve,de as Qe,z as Ae,J as _e,df as Ue,dg as Oe,bb as X,dh as ae,di as je,ba as oe,v as V,Z as B,e as I,dj as M,dk as Fe,dl as Le,a3 as De,h as Be,a9 as Me,dm as Re,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,x as ze,b6 as He,ds as We}from"./index-qYSCKekz.js";import{gr as Ye,e_ as ne,e$ as Je,iG as Ze,Uw as Ke,fu as Xe,iQ as et,iM as tt,f0 as R,fB as st,ga as at,gb as ot,g3 as nt,j4 as ee,g7 as te,gc as it,gd as rt,ge as lt,gf as dt,gg as ct,gh as ut}from"./zeni-epic-state-Brhydpej.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-ChRNPf14.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-DqLJLw_b.js";import{p as gt}from"./pathToGoBack-DjzKcd4A.js";import"./recharts-UIIeT-6j.js";import"./analytics-CP-wGaZJ.js";import"./plaid-j-SLH4pe.js";import"./dnd-DPx0nGIt.js";import"./stripe-cKAAJElX.js";import"./lottie-C6mBeCcV.js";import"./lexical-Dce73siJ.js";import"./pdf-CHegScPw.js";import"./utils-BGj88Dzy.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd7260d9-1f82-4087-bede-d4e3cd5733af",e._sentryDebugIdIdentifier="sentry-dbid-bd7260d9-1f82-4087-bede-d4e3cd5733af")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:Q}=oe(x,m);g!=="answer"?I.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,We(Q,i),c.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&He(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=ze(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{b(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{b(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Me(Re)),Mt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=ye(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=Qe();l.useEffect((()=>{a(Ye())}),[a]);const h=K((r=>ne(r))),s=Ae.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=K((r=>Je(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:Q,isUploadPromoVisible:re}=Ue({isFileUploadEnabled:e,tenantEmailDomain:w}),A=Oe({currentTenant:m,currentChatSessionId:i,aiCfoView:h}),{isSuggestedQuestionsLoading:le,suggestedPromptQuestions:de}=St(),P=o.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;l.useEffect((()=>{const r=o.state;if(r?.[X]!==!0)return;d(!0);const f={...r};delete f[X],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,U]=l.useState(!1),[me,O]=l.useState(void 0),[pe,j]=l.useState(void 0),G=l.useRef(!1);l.useEffect((()=>{if(!G.current&&y!=null&&y!==""){const r=o.state;_(y),U($),O(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[y,$,o.state]);const he=l.useCallback((()=>{_(null),U(!1),O(void 0),j(void 0),p(o.pathname,{replace:!0,state:ae(o.state)})}),[o.pathname,o.state,p]),q=l.useMemo((()=>new URLSearchParams(o.search)),[o.search]),N=q.get("ref")??P?.aiCfoRef,F=q.get("emailRefId")??P?.aiCfoEmailRefId,z=l.useRef(!1);l.useEffect((()=>{z.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Ze("controller",s.userId,F,"MONTH_END_EMAIL")),z.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),U(!0),O(void 0),j(void 0),a(Ke()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:H}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,W=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",Y=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),J=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(J,i),fe=ge.length===0;l.useEffect((()=>{C||g||p("../dashboard",{state:{...o.state,message:"open_ai_cfo_drawer"}})}),[C,g,p,o.state]);const Ce=l.useCallback((()=>{const r=V(o.state?.pathnameStackToGoBack),f=m.tenantEmailDomain;p(r.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...o.state,pathnameStackToGoBack:r.newStack}})}),[m.tenantEmailDomain,o.state,p]);l.useEffect((()=>{i!=null&&t!==i&&p(`../ai-cfo/${i}`,{state:{...o.state}})}),[i,t]),l.useEffect((()=>{t!=null&&i==null&&t!=="new_chat"&&t!=="explore"&&a(Xe({sessionId:t,agentId:"controller"}))}),[]);const be=l.useMemo((()=>({events:H.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[H]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&W!=="In-Progress"&&Y&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[W,Y,i,s,a]);const Z=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const Ie=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(bt,{children:[u.jsx(B,{analytics:I,onLoad:Z}),A.drawerElement,u.jsx(It,{children:u.jsx(se,{children:u.jsx(M,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(R(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:I,onLoad:Z}):null,u.jsx(M,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(R(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:I,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&A.drawerElement,u.jsx(ft,{...be,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>d(!0),userId:s.userId,setIsAiCfoOpen:n,navigate:p,sessionFromUrl:t,location:o,isSubmitting:Ie,isEmptyChatWithSession:fe,currentTenant:m,emailLinkQuestion:ce??void 0,autoSubmitEmailLinkQuestion:ue,onEmailLinkQuestionProcessed:he,routedInitialQuestionSource:me,routedInitialQuestionSuggestionIndex:pe,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?A.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:re,onUploadPromoClose:Q,exploreSuggestedPromptQuestions:de,exploreSuggestedPromptQuestionsLoading:le}),S&&g?u.jsx(mt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:kt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:u.jsx(se,{onClick:r=>r.stopPropagation(),children:u.jsx(M,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(R(m.userRoleId)),d(!1)}})})}):null]}),S&&!g?u.jsx(Fe,{open:S,onClose:()=>d(!1),children:u.jsx(Le,{children:ke})}):null]})},se=k(pt)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
5
  `,Ct=k.div`
6
6
  height: 100vh;
7
7
  width: 100%;
8
- `,It=k.div`
8
+ `,bt=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
- `,bt=k.div`
14
+ `,It=k.div`
15
15
  flex: 1;
16
16
  min-height: 0;
17
17
  display: flex;
@@ -19,4 +19,4 @@ import{j as u}from"./liveblocks-bqFl_SVp.js";import{a as l}from"./sentry-Bj_fC7L
19
19
  `,kt=k(ht)`
20
20
  box-shadow: ${({theme:e})=>e.colors.elevation2};
21
21
  color: ${({theme:e})=>e.colors.grey4};
22
- `;export{Rt as default};
22
+ `;export{Mt as default};
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-bqFl_SVp.js";import{a as v}from"./sentry-Bj_fC7Ll.js";import{h as U,g as B,u as j,j as y,N as $,n as k,i as W,o as te,p as D}from"./core-Bnb5S7eF.js";import{eZ as O,Qv as A,Qb as h,zO as E,zG as Q,zK as R,zz as q,Qd as K,zQ as ae,zC as G,zT as M,zP as C}from"./zeni-epic-state-GXytJkko.js";import{z as V,a9 as Z,bL as oe,ag as P,bC as H,bM as le,E as J,B as X,bN as pe,bO as se}from"./index-DQqz4S7_.js";import"./mui-BAFflVdx.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DdpFdkik.js";import re from"./NotFoundScreen-DlOrYovK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="3836f334-146b-4d0e-9b14-37f3fb0acb37",e._sentryDebugIdIdentifier="sentry-dbid-3836f334-146b-4d0e-9b14-37f3fb0acb37")}catch{}})();const T="bill-approval-rule-update",ie=k((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(Z(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(s))),i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(Q(!0,!0,!1)))}),[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx($,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(Z(le)),de=()=>{const e=y((o=>O(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(s)));Y();const i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(Q(!0,!0,!0)))}),[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx($,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function z(){const e=y((t=>O(t))),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Y(),v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx(z,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx(z,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
1
+ import{j as c}from"./liveblocks-BqtYq8PY.js";import{a as v}from"./sentry-BtWdTNDK.js";import{h as U,g as B,u as j,j as y,N as z,n as V,i as W,o as te,p as D}from"./core-4nWRIid2.js";import{e$ as k,QF as A,Ql as h,zQ as E,zI as Q,zM as R,zB as q,Qn as K,zS as ae,zE as M,zV as G,zR as C}from"./zeni-epic-state-Brhydpej.js";import{z as O,a9 as H,bL as oe,ag as P,bC as J,bM as le,E as X,C as Y,bN as pe,bO as se}from"./index-qYSCKekz.js";import"./mui-ChRNPf14.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-Dgh8Yquq.js";import re from"./NotFoundScreen-B6nbKEPc.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="3c4746e5-58dc-47f1-aeb3-8d34c619cfc0",e._sentryDebugIdIdentifier="sentry-dbid-3c4746e5-58dc-47f1-aeb3-8d34c619cfc0")}catch{}})();const T="bill-approval-rule-update",ie=V((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>k(s))),i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(Q(!0,!0,!1)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=V((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(H(le)),de=()=>{const e=y((o=>k(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>k(s)));Z();const i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(Q(!0,!0,!0)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=V((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=V((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>k(t))),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
@@ -0,0 +1,119 @@
1
+ import{j as a}from"./liveblocks-BqtYq8PY.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as Y,l as ia,o as oa,p as S}from"./core-4nWRIid2.js";import{e$ as H,PX as Ge,bs as wt,KL as la,bq as At,bJ as pe,PY as Bt,z6 as Ct,Al as $e,zF as sa,bn as Ee,PZ as ra,P_ as ca,c7 as da,P$ as ua,kI as xt,Q0 as Et,Q1 as Dt,AW as Me,zl as Be,Q2 as pa,yW as tt,Q3 as ma,E$ as ba,y_ as ha,z4 as jt,Q4 as fe,Q5 as Ne,Am as Oe,Q6 as ga,Q7 as ya,Ap as ze,Q8 as Sa,AC as fa,Q9 as Tt,A6 as at,Ab as va,Qa as Ia,Qb as ue,Qc as Pt,Qd as Ft,Qe as Rt,gv as ka,zq as _e,cD as Vt,Qf as wa,fD as Aa,Qg as Ba,Qh as Ca,fI as $t,fG as _t,Qi as Qe,Qj as xa,Qk as Ea,NF as Ze,Ql as Da,NG as oe,NH as He,Qm as ja,Qn as Ta,Qo as Pa,Ad as nt,Aa as Fa,Qp as Ra,Qq as Va,Qr as $a,zY as _a,Qs as La,Qt as Ua,Qu as Ga,cr as Lt,cT as Ut,kT as Ma,bP as Na,bo as Gt,bQ as Mt,yc as Oa,Qv as za,EO as Qa,EU as Za,uy as Ha,An as Wa,B1 as qa,l4 as Se,Qw as Ka,Qx as Nt,ly as Ja,k_ as Ot,lj as zt,li as it,bE as be,bO as Ya,Qy as Xa,Qz as ve,jD as en,QA as ot,QB as tn,jH as an,k0 as nn,Bf as on,QC as ln,lr as sn,B5 as rn,QD as lt,B9 as cn,Be as dn,Bb as un,B3 as pn,QE as Qt,zf as mn,QF as bn,QG as hn,gn,gm as yn,gl as Sn,l7 as fn,lp as st,lA as vn,r_ as In,lg as kn,B7 as wn,jN as An,lF as Bn,QH as Cn,jF as xn,rR as En,QI as Dn,A2 as jn,bK as Tn,bt as Pn,Mt as Fn,cW as Rn,cV as Vn,cC as $n,cJ as _n}from"./zeni-epic-state-Brhydpej.js";import{E as me,z as $,D as Ie,a0 as We,w as le,i as y,aS as Ce,C as re,o as x,Z as De,e as D,bh as Ln,v as Z,a4 as qe,x as E,J as ke,bi as rt,bj as ct,bk as Un,al as Gn,I as Mn,aM as Nn,G as Zt,a as je,K as Ke,bl as On,au as Ht,bm as zn,_ as Qn,h as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Kn,br as Jn,bs as Yn,bt as Xn,bu as ei,bv as ti,A as ai,bw as ni,be as ii,bx as oi,by as li,d as si}from"./index-qYSCKekz.js";import{n as L,S as ri}from"./mui-ChRNPf14.js";import{A as dt}from"./AddressScreen-Ba-VvOjK.js";import{g as ie,a as Te,i as qt,V as Je,b as Ye,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-CQmjKCQc.js";import{a as f}from"./sentry-BtWdTNDK.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-yAJW2Zxp.js";import{u as Kt}from"./useInitialThreadRequest-BeFUEHq1.js";import xe from"./NotFoundScreen-B6nbKEPc.js";import{D as pi}from"./DrawerScreen-D1JpfIY3.js";import{M as Jt}from"./MobileAppDrawer-hdYoVCXp.js";import{F as Yt}from"./FeaturePreviewScreen-BKTS5XLx.js";import{S as Pe}from"./SetupPagesScreen-D2lEnwjt.js";import{B as mi}from"./BillPayApprovalRoutes-GlLqvwOB.js";import{FallBackRoute as bi}from"./ScreenRoutes-BYtpyV-M.js";import"./recharts-UIIeT-6j.js";import"./analytics-CP-wGaZJ.js";import"./plaid-j-SLH4pe.js";import"./dnd-DPx0nGIt.js";import"./stripe-cKAAJElX.js";import"./lottie-C6mBeCcV.js";import"./lexical-Dce73siJ.js";import"./pdf-CHegScPw.js";import"./utils-BGj88Dzy.js";import"./analyticsHelper-CBp9b8VI.js";import"./routePaths-TA66BJgf.js";import"./BusinessVerificationPageScreen-BZk1AoM_.js";import"./ReimbursementApprovalRuleDetailScreen-Dgh8Yquq.js";import"./getLocaleForTenant-BhD_5oG2.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]="83e5a04a-ee4f-4a51-85ab-2becf4d57581",e._sentryDebugIdIdentifier="sentry-dbid-83e5a04a-ee4f-4a51-85ab-2becf4d57581")}catch{}})();const hi=Y((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(Ln);function gi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=Ie(),o=I((z=>H(z))),s=I((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,B]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:_}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:W}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=At(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{_&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",_,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(B(!0),t($e(!1,_,F,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:_,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,yi={containerWidth:new Zt(100,58)},pt=Y((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function A({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),B=I((R=>H(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[_,k]=f.useState(!1),[W,N]=f.useState(),w=I((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=I((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","yes"),t(ya({replaceBillData:!0,billId:n})),t(ze(W,m,n))},onCancelClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","no"),t(ga({file:W,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(B.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,B.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,_?a.jsx(Gn,{titleComponent:a.jsx(Ai,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Bi,{children:Le.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=On();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
2
+ ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const mt=L.div`
3
+ margin-bottom: 20px;
4
+ margin-top: 20px;
5
+ margin-left: ${x.sp5};
6
+ position: absolute;
7
+ display: flex;
8
+ align-items: center;
9
+ `,Ii=L.div`
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ padding-top: 9px;
14
+ gap: ${x.sp2};
15
+ margin-bottom: -${x.sp2};
16
+ `,ki=L(Ke.StandardMedium)``,wi=L((e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))))`
17
+ color: ${e=>e.theme.colors.hero};
18
+ height: ${x.sp3};
19
+ width: ${x.sp3};
20
+ `,Xt=L((e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))))`
21
+ width: ${x.sp3};
22
+ height: ${x.sp3};
23
+ cursor: pointer;
24
+ color: ${e=>e.theme.colors.champion};
25
+ &:hover {
26
+ color: ${e=>e.theme.colors.primary};
27
+ }
28
+ `,Fe=L.div`
29
+ display: flex;
30
+ height: 100vh;
31
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
32
+ background-color: ${e=>e.theme.colors.grey4};
33
+ position: relative;
34
+ &::after {
35
+ content: "";
36
+ position: absolute;
37
+ top: 57px;
38
+ left: 42%;
39
+ width: 1px;
40
+ height: calc(100% - 57px);
41
+ background-color: ${e=>e.theme.colors.grey2};
42
+ pointer-events: none;
43
+ z-index: 3;
44
+ display: ${e=>e.windowSize==="small"?"none":"block"};
45
+ }
46
+ `,Re=L.div`
47
+ position: absolute;
48
+ top: 56px;
49
+ left: 0;
50
+ width: 42%;
51
+ height: 1px;
52
+ background-color: ${e=>e.theme.colors.grey2};
53
+ z-index: 3;
54
+ `,bt=L.div`
55
+ position: fixed;
56
+ top: 0;
57
+ left: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ background-color: ${Mn.overlayBackgroundBlack};
61
+ z-index: 5;
62
+ `,Ve=L.div`
63
+ display: flex;
64
+ flex-direction: column;
65
+ width: ${e=>`${yi.containerWidth.value(e.windowSize)}%`};
66
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
+ `,Ai=L(Ke.H6Regular)`
68
+ margin-top: ${x.sp7};
69
+ padding-left: ${x.sp8};
70
+ padding-right: ${x.sp8};
71
+ color: ${e=>e.theme.colors.primary};
72
+ word-break: break-word;
73
+ `,Bi=L(Ke.LargeRegularSp)`
74
+ color: ${e=>e.theme.colors.hero};
75
+ padding-left: ${x.sp8};
76
+ padding-right: ${x.sp8};
77
+ margin-bottom: 30px;
78
+ margin-top: ${x.sp4};
79
+ white-space: pre-line;
80
+ `,Ci=Y((function(e,t){return{billsReviewView:Tt(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(Ia(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(va());break;case"approve":case"review":e(at("approved",n??""));break;case"reject":e(at("rejected",n??""))}}}}))(zn);function xi(){const e=K(),t=I((n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState)),{billsForReview:l}=I((n=>Tt(n)));return f.useEffect((()=>{t!=="Completed"&&l.length!==0||e("./")}),[t,l.length]),a.jsx(Ci,{navigate:e,analytics:D})}const ne=Ea(),ea="bulk-operation-update",Ue="bill-approval-rule-update",{spendManagement:Ei,common:ht}=je.getLocalizedStrings(),gt=Ei.billPay.bulkActions,Di=L.div`
81
+ display: flex;
82
+ min-height: 100%;
83
+ width: 100%;
84
+ flex: 1 1 auto;
85
+ flex-direction: column;
86
+ align-items: center;
87
+ background-color: ${e=>e.theme.colors.grey4};
88
+ `,ji=Y((function(e,t){const l=$.getSignedInUser(),n=Ee(l),c=Rt(e,ne,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter((b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted")):t.roleMap.bill_pay_approver&&(r=r.filter((b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted")))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter((b=>b!=="deleted")));const u=e.entityAutoCompleteState.autoCompleteText.common,o=Ze(e,"common"),s=e.tenantState.currentTenantId,i=H(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},m=e.billListState.downloadUIState.downloadState,h=c.fetchState,g=Da(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter((b=>b.isDeleted===!1)),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:h,analytics:D,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ne,spendManagementEndPoint:`${qe}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:m,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:g.affectedEntityIds}}),(function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ue()),e(Pt(o))},onSubtabChange:o=>{e(ue()),e(Ft(o))},onTransactionClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Pi(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;D?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=E(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(La(o))},onReloadTransactions:()=>{e(_e(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(_a(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e($a({filters:o})),o.categories.every((s=>s.field!=null&&s.values?.length!==0))&&D.trackSpendManagmentFilterChange("bill_pay",o.categories.map((s=>`${s.field}-${JSON.stringify(s.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&D.trackSpendManagementDownloadClick("bill_pay"),e(Va({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Ra(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(Fa(o,s??""));break;case"send_for_approval":e(nt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(nt("approve")),t.navigate("./bulk-review");break;case"review":e(Pa()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(Ue)&&e(Ta(!1))},onEventReceived:o=>{o===ea&&e(ja())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(He({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}}}}))(Zn(Hn));function Ti(){const e=K(),t=se(),l=J(),n=ke(),c=l.state,r=Ie(),[u,o]=f.useState(!1),[s,i]=f.useState(null),d=ia("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect((()=>(c?.tab!=null&&c?.subTab!=null&&(t(Pt(c?.tab)),t(Ft(c?.subTab))),()=>{t(ue())})),[]);const p=$.getSignedInUser(),m=I((P=>H(P))),{areTenantIdsInSync:h}=Qn(),[g,b]=f.useState(!1),{useFeatureGate:v}=le(),{isFeatureEnabled:j}=v(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:B}=v(y.isBillPayCommentingEnabled),{isFeatureEnabled:C}=v(y.isReimbursementCommentingEnabled),{isFeatureEnabled:U}=v(y.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:T}=v(y.isBillPayBulkActionEnabled),{isFeatureEnabled:G}=v(y.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:_}=v(y.isBillPayDetectInsufficientFundsEnabled),k=I((P=>Rt(P,ne,T,p?.userId))),{isFeatureEnabled:W}=v(y.isDebitCardFeatureEnabled),N=k.fetchState,{isAiCfoAccessEnabled:w,onAskAiCfoClick:O}=Xe({mobileExploreReferrer:"Bills List"});We({isDataReady:N==="Completed"});const M=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,F=!!m.companyBillPayInfo?.info?.isBillPayEnabled,q=I((P=>ka(P.companyState,m.companyId))),X=q?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect((()=>{!g&&F&&h&&(b(!0),t(_e(ne,!0,j,G)))}),[g,ne,h,t]),p==null)throw Error("Can't access address page without signing in...");const z=(P,de)=>{t(xa({uiState:{sortKey:P,sortOrder:de},period:ne}))},ee=Vt(r?.loggedInUserRoleMap),R=pe(r?.loggedInUserRoleMap),ce=P=>{o(P)},{billsProcessed:Q,billsProcessing:we}=I((P=>wa(P)));f.useEffect((()=>{Q===we&&s!=null&&(t(Aa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:Q>1?gt.bills:gt.bill},{variableName:"_has_",variableValue:Q>1?ht.texts.have:ht.texts.has},{variableName:"_action_",variableValue:Ba(s)}]})),t(Ca()),setTimeout((()=>{t(_e(ne,!0,j,!0,G))}),3e3),i(null))}),[Q,we]);const ta={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${ea}`,`private-encrypted-${m.companyId}.${Ue}`]:[],eventCallback:(P,de,et)=>{P.endsWith(Ue)?et.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(i(de.operation_type),et.onEventReceived(P))}},aa=$t(W,m),na=_t(m);return l.pathname.endsWith("/bills/")||l.pathname.endsWith("/bills")||l.pathname.endsWith("/bills/bulk-review")?aa===!0||na===!0?a.jsx(Yt,{}):F?a.jsxs(a.Fragment,{children:[N==="Completed"?a.jsx(De,{analytics:D,onLoad:P=>(de=>de.trackPageLoaded(Wt.Event.billPayHome))(P)}):null,a.jsxs(Di,{windowSize:n,children:[a.jsx(Jt,{isAppContentDrawerOpen:u,handleDrawerToggle:ce}),a.jsx(pi,{isOpen:d,drawerLeftMargin:new Zt(0,0,300,600),onClose:()=>{e("./"),t(ue())},children:a.jsx(Fi,{onClick:P=>P.stopPropagation(),children:a.jsx(xi,{})})}),a.jsx(ji,{location:l,navigate:e,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:B,isReimbursementCommentingEnabled:C,period:ne,isAdmin:!1,uiState:k.uiState,onColumnSortConfigChanged:z,isUserHasOnlyBillpayAccess:ee,isShowDeletedBillsEnabled:j,isShowDeletedReimbursementEnabled:U,isBulkActionEnabled:T,roleMap:r?.loggedInUserRoleMap,onClickMenuIcon:()=>{ce(!0)},isDownloadEnabled:k.isDownloadEnabled,connectedAccountProvider:X,bulkSubmissionLimit:k.billBulkSubmissionLimit,bulkSubmissionFetchState:k.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:k.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:G,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:w,onAskAiCfoClick:O,...ta})]})]}):M===!0&&R===!0?a.jsx(te,{to:"../setup"}):r!=null&&Qe(m,r.loggedInUserRoleMap)?a.jsx(te,{to:"../promo"}):a.jsx(re,{fetchState:N}):a.jsx(xe,{})}const Pi=e=>`/${e}/bills/setup`,Fi=L(ri)`
89
+ display: flex;
90
+ min-height: 100%;
91
+ flex-direction: column;
92
+ `,{common:{currency:ye},spendManagement:{billPay:{billDetails:Ri}},appName:Vi}=je.getLocalizedStrings(),$i=Y((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=Z(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=Ze(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=Ee(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??Vi} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,m=Na(t.billDetailsView.paymentDetailsSection?.paymentType?.method),h=t.currentTenant.createTime,g=Gt(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,v=h.add(b,"month").isAfter(g),j=!!(t.billDetailsView.billStage==="draft"&&m&&p!=null&&p>0)&&!Mt(p,t.billDetailsView.approvalRules.allApprovalRules,l,t.billDetailsView.vendor?.id,t.billDetailsView.classId),B=H(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:xt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,analytics:D,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:B.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:j,isZeniUser:d,isNewUser:v,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}}),(function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(it(i));const d=St(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Ot(d,!1)),e(zt({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(it());const p=St(s,void 0,l),m=E(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:m}})},onInvoiceUpload:i=>{i!=null&&e(ze(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(Oe(i))},onSaveChangesToLocalStore:(i,d,p,m,h)=>{const g=Gi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:h}},p,d,t.isInternationalPaymentShaVsOurEnabled,m,t.vendor);e(Ja({billDetailLocalData:g,billId:l}))},saveBillDetails:()=>{e(Me("draft",!1,!1,l)),e(oe("common"))},updateBillDetailSaveBillCode:()=>{e(Nt("draft"))},reviewBillDetails:()=>{const i=_i(s,l),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(fe({billId:i}))},clearBillPayReviewLocalState:()=>e(Ka()),onClickDismiss:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(Se(!1,i));const d=Li(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(Se(!1,i));const d=Ui(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(Se(!1,i));const d=qt(s,l,i),p=E(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ie(s),d=E(r.state?.pathnameStackToGoBack,r.pathname);e(fe({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(jt(l))},onAttachmentClick:(i,d)=>{const p=Te(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=Z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ie(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},addVendorContactEmail(i,d){e(qa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Jn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Wa(!0,i,l))},onSignUpAccountClick:()=>{t.hasZeniAccountsAdminAccess?window.open(`/${s}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{t.isZeniAccountsUser?window.open(`/${s}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ha("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(Za(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Qa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Oa("bill_pay","bill_pay_detail")),e(za({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}}))(Wn);function yt(){const e=K(),t=J(),l=se(),{billId:n,tenantEmailDomain:c}=ae(),{useFeatureGate:r,useDynamicConfig:u}=le(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(y.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(y.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.isRecurringBillsFeatureEnabled),{isFeatureEnabled:g}=r(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(y.isShaDisabled),{isFeatureEnabled:v}=r(y.isOurDisabled),{isFeatureEnabled:j}=r(y.isBillPayDetectInsufficientFundsEnabled),{configValue:B}=u(Ce.zeniAccountsConfig),C=Ua(B),{configValue:U}=u(Ce.sameDayAchDisablementConfig),T=Ga(U),G=$.getSignedInUser(),_=I((Q=>H(Q))),k=I((Q=>Ne(Q,m,g,n))),W=Kt(_?.companyId,{clearParams:k.fetchState==="Completed"}),{isAiCfoAccessEnabled:N,onAskAiCfoClick:w}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:k.fetchState==="Completed"});const O=_.companyId??$.getSignedInUserTenant(c)?.companyId,M=!!_.companyZeniAccountInfo?.info?.isZeniAccountEnabled,F=Ie(),q=Lt(F?.loggedInUserRoleMap),X=Ut(F?.loggedInUserRoleMap),z=pe(F?.loggedInUserRoleMap),ee=At(_.userRole);if(f.useEffect((()=>{n!=null&&l(Bt(n))}),[n]),G==null)throw Error("Can't access address page without signing in...");const R=I((Q=>Ma(Q.accountState,Q.accountListState,"billPayAccountList"))),ce={pathname:"../",search:t.search};return k.isDeleted===!0||k.billStage=="paid"||k.fetchState=="Not-Started"?a.jsx(te,{to:ce}):k.deleteStatus.fetchState==="In-Progress"||s?a.jsx(re,{fetchState:k.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:Q=>(we=>{n!=null&&k.deleteStatus.fetchState!=="Completed"&&we.trackBillPayEditBill(n,k.isRecurring)})(Q)}),a.jsx($i,{initialOpenThreadRequest:W??void 0,location:t,navigate:e,currentTenant:_,billId:n,companyId:O,billDetailsView:k,isMagicLinkEnabled:o,isVendorRecommendationEnabled:m,isLocalCurrencyEnabled:p,uncategorizedAccounts:R,isInternationalPaymentShaVsOurEnabled:i,vendor:k.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:v,isRecurringBillsFeatureEnabled:h,isAccountsEnabled:M,hasZeniAccountsAdminAccess:q,isZeniAccountsUser:X,isBillPayAdmin:z,isSuperAdmin:ee,accountsPromoConfig:C,isDetectInsufficientFundsEnabled:j,sameDayAchDisablementConfig:T,isAiCfoAccessEnabled:N,onAskAiCfoClick:w})]})}const St=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},_i=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},Li=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Ui=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},V="paymentDetails",Gi=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):Gt(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[V]?.paymentDate?be(t[V].paymentDate.toString()):void 0,paymentType:t[V]?.paymentType!=null?t[V]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find((b=>b.id===t[V]?.withdrawFrom?.selectedOption)),internationalTransferFeeBearerPaymentMethod:t[V]?.paymentType?.method!=null&&t[V].paymentType.method.includes(Ya)&&u?.vendorCurrencyCode===ye.currencyCode&&c?t[V]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[V]?.recurringPaymentType?.selectedOption===Ri.recurringBill.paymentTypeOptions[1],m={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[V]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:Xa(t[V]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[V]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[V]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[V]?.recurringPaymentDetails?.startDate?be(t[V]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[V]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[V]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[V]?.recurringPaymentDetails?.updateRecurringBills},h=Mi(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),g=Object.keys(h).length>0?qn(h):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:g,recipientTotalAmount:g,file:e.file,updatesByLineId:h,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:m}},Mi=(e,t,l,n,c,r)=>{const u={};return n.forEach((o=>{let s,i;o.account.selectedOption!=null&&(s=e.find((p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption))),o.class?.selectedOption!=null&&(i=t.find((p=>p.classId===o.class.selectedOption)));const d=Kn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??ye.currencyCode,currencySymbol:o.currency?.currencySymbol??ye.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??ye.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??ye.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}})),u},Ni=L.div`
93
+ display: flex;
94
+ height: 100vh;
95
+ width: 100%;
96
+ flex: 1 1 auto;
97
+ flex-direction: column;
98
+ align-items: center;
99
+ background-color: ${e=>e.theme.colors.grey4};
100
+ box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
101
+ `,Oi=Y((function(e,t){const{vendorId:l,billId:n}=t,c=ve(e,l),r=Ne(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(nn(s))},onSaveHandler:()=>{e(an(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(tn({data:i}))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??ft();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ot())},onAddressClick:s=>{const i=Ye(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(en({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??ft(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ot())}}}))(Yn);function zi(){const e=K(),t=J(),l=ke(),{vendorId:n,billId:c}=ae(),{useFeatureGate:r}=le(),u=me(),o=$.getSignedInUser(),s=I((g=>H(g))),i=Z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=I((g=>ve(g,n))),{isFeatureEnabled:m}=r(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=r(y.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Ni,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Oi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:m,isZeniAccountsFeatureEnabled:h})]})}const ft=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Qi=L.div`
102
+ display: flex;
103
+ height: 100vh;
104
+ width: 100%;
105
+ flex: 1 1 auto;
106
+ flex-direction: column;
107
+ align-items: center;
108
+ background-color: ${e=>e.theme.colors.grey4};
109
+ box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
110
+ `,Zi=Y((function(e,t){const{vendorId:l}=t,n=ve(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=ln(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[sn(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}}),(function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(pn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(dn(s)),p&&e(un(i,d))},onCurrencyUpdated:(s,i,d)=>{e(cn(s,i,d,!1))},onCancel:()=>{(()=>{const s=Z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??vt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(lt())},onAddressClick:s=>{const i=Ye(o,s,l),d=E(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(rn({fetchState:"Not-Started"}));const s=Z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??vt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(lt())}}}))(Xn);function Hi(){const e=K(),t=J(),l=ke(),{vendorId:n,billId:c}=ae(),r=se(),u=me(),o=$.getSignedInUser(),s=I((C=>H(C))),i=Z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),m=I((C=>C.vendorViewState.newVendorState.fetchStatus.fetchState)),h=I((C=>n!=null?C.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started")),g=n!==void 0?h:m;f.useEffect((()=>{d===!1&&g==="Not-Started"&&n!=null&&(r(Se(!1,n)),p(!0))}),[d,g,n]);const[b,v]=f.useState(!1);f.useEffect((()=>{b||g==="In-Progress"||(v(!0),r(on(c,n)))}),[b,g,r]);const j=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",B=I((C=>ve(C,n)));if(o==null)throw Error("Can't access international wire page without signing in...");return j==="billDetail"&&B.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:B.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Qi,{windowSize:l,children:[a.jsx(Je,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:j})]})}const vt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},It=L.div`
111
+ display: flex;
112
+ height: 100vh;
113
+ width: 100%;
114
+ flex: 1 1 auto;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ background-color: ${e=>e.theme.colors.grey4};
118
+ box-shadow: ${e=>`0px 2px ${x.sp1} ${e.theme.colors.dropShadowNormal}`};
119
+ `,Wi=Y((function(e,t){const l=$.getSignedInUser(),n=Qt(e,t.billId),c=bn(e),r=Ee(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Mt(u,c.allApprovalRules,l,n.vendor?.id,n.classId);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:D,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}}),(function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ie(c.tenantEmailDomain),s=E(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},saveBillDetails:(o,s)=>{o&&e(Dt({billId:n,data:s})),e(Me(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(Et({billId:n}))},updateBillDetailSaveBillCode:()=>{e(Nt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Te(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}}))(ti);function kt(){const e=K(),t=se(),l=J(),{billId:n}=ae(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(y.isBillPayDetectInsufficientFundsEnabled),o=ke(),s=$.getSignedInUser(),{isFeatureEnabled:i}=c(y.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(y.isBillPayCommentingEnabled),m=Z(l.state?.pathnameStackToGoBack),{poppedPathname:h}=m,{isFeatureEnabled:g}=c(y.isRecurringBillsFeatureEnabled),b=I((B=>H(B))),v=I((B=>Qt(B,n))),j=v.fetchState??"Not-Started";if(f.useEffect((()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null})),[e]),f.useEffect((()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)}),[]),f.useEffect((()=>{const B=v.vendor?.name,C=v.vendor?.id,U=v.totalAmount.amount,T=v.recipientTotalAmount.amount,G=v.invoiceNumber;B&&C&&t(mn(B,C,U,T,G,n))}),[]),h==null)return a.jsx(te,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return j==="In-Progress"?a.jsx(It,{windowSize:o,children:a.jsx(ei,{})}):a.jsx(It,{windowSize:o,children:a.jsx(Wi,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:g,isDetectInsufficientFundsEnabled:u})})}const qi=Y((function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=Ze(e,"common"),r=l!=null?"edit":"create",u=H(e),o=$.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Ht.fileMicroServiceBaseUrl}`,authParams:i,analytics:D,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}}),(function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(xn(u??void 0,t.billId)),i!=null&&e(En(i))},saveVendorDetailLocalData:i=>{e(zt({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(Cn({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(st(u))},updateSelectedVendorForCreate:i=>{e(Bn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?qt(s,t.billId,u):ui(s,t.billId,u):p=di(s,t.billId,u);const m=E(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:m}})},onRemoveBankAccount:(i,d)=>{e(d===!0?wn(i,"vendor",u):An(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=Ye(s,i,l),p=E(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(kn({files:i}))},onEditFileName:(i,d)=>{e(In(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(st(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(vn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(fn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(He({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(oe("common"))},onCancelAutoComplete:()=>{e(oe("common"))}},onBackClick:()=>{e(oe("common"));const i=Z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ci(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(Sn(i,"BillPayVendor"))},onResendOtp:i=>{e(yn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(gn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(hn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Ot(i,!1))}}}))(oi),Ae=()=>{const e=K(),t=se(),l=ai(),n=J(),{billId:c,vendorId:r}=ae(),u=I((b=>H(b))),{useFeatureGate:o}=le(),{isFeatureEnabled:s}=o(y.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=I((b=>b.vendorViewState.newVendorState.fetchStatus.fetchState)),m=I((b=>ve(b,r))),h=I((b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started")),g=r!==void 0?h:p;return f.useEffect((()=>{i===!1&&g==="Not-Started"&&r!=null&&(t(Se(!1,r)),d(!0))}),[i,g,r]),m.fetchState==="Not-Started"||m.fetchState==="In-Progress"?a.jsx(ni,{}):g==="Error"?a.jsx(ii,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{vendorId:r,billId:c}),a.jsx(qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:m,isLocalCurrencyEnabled:s})]})},Ki=Y((function(e,t){const{companyId:l}=t;return{billPaySetupView:Dn(e,l),analytics:D,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}}),(function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(jn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}}))(li),Ji=()=>{const e=K(),t=J(),{tenantEmailDomain:l}=ae(),[n,c]=f.useState(!1),r=me(),u=I((h=>H(h))),o=u.companyId??$.getSignedInUserTenant(l)?.companyId,s=$.getSignedInUser(),i=Ie(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(i?.loggedInUserRoleMap),m=h=>{c(h)};if(s==null)throw Error("Can't access bill pay promo page without signing in...");return u.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(te,{to:"../../../bills"}):d===!0&&p===!0?a.jsx(te,{to:"../../bills/setup"}):d===!1||i!=null&&Qe(u,i.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:h=>(g=>g.trackPageLoaded(Wt.Event.billPayPromoPage))(h)}),a.jsx(Jt,{isAppContentDrawerOpen:n,handleDrawerToggle:m}),a.jsx(Ki,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{m(!0)}})]}):a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function jo(){const e=I((F=>H(F))),t=Ie(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=le(),{isFeatureEnabled:r}=c(y.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Hi:zi,{isFeatureEnabled:o}=c(y.isDebitCardFeatureEnabled),s=$t(o,e),i=_t(e),d=J(),p=e?.userRole!=null&&wt(e?.userRole),m=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),h=Vt(t?.loggedInUserRoleMap),g=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Tn(t?.loggedInUserRoleMap),b=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!p,v=b&&Lt(t?.loggedInUserRoleMap),{isFeatureEnabled:j}=c(y.isChargeCardFeatureEnabled),B=si(e,j,o)&&!p,C=B&&Pn(t?.loggedInUserRoleMap),U=Fn(t?.loggedInUserRoleMap),T=Ut(t?.loggedInUserRoleMap),G=Rn(t?.loggedInUserRoleMap),_=b&&T,k=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!p&&G,W=Vn(t?.loggedInUserRoleMap),N=$n(t?.loggedInUserRoleMap),w=_n(t?.loggedInUserRoleMap),O=B&&W,{tenantEmailDomain:M}=ae();return a.jsxs(oa,{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:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"setup"})}),a.jsx(S,{path:"verification",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"verification"})}),a.jsx(S,{path:"promo",element:a.jsx(Ji,{})}),a.jsx(S,{path:"approval-rules/*",element:m?a.jsx(mi,{}):a.jsx(bi,{showZeniAccountRoute:_,isUserHasBillPayAccess:N,isUserHasReimbursementAccess:w,showTreasuryRoute:k,isTenantBankingOnly:s,showChargeCardRoute:O,tenantEmailDomain:M??""})}),a.jsx(S,{path:"international-wire",element:a.jsx(Pe,{isBillPayAdminLevelAccess:m,isUserHasOnlyBillPayAccess:h,isReimbursementAdminLevelAccess:g,isZeniAccountAdminLevelAccess:v,isChargeCardAdminLevelAccess:C,isUserHasOnlyCardAccess:U,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(S,{path:"*",element:a.jsx(Ti,{})}),(s===!0||i===!0)&&a.jsx(S,{path:"/*",element:a.jsx(Yt,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(S,{path:"*",element:a.jsx(te,{to:"../setup"})}),t!=null&&Qe(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(A,{appContent:a.jsx(yt,{})})}),a.jsx(S,{path:":billId",element:a.jsx(A,{appContent:a.jsx(gi,{})})}),a.jsx(S,{path:":billId/edit",element:a.jsx(A,{appContent:a.jsx(yt,{})})}),a.jsx(S,{path:"new/review",element:a.jsx(A,{appContent:a.jsx(kt,{})})}),a.jsx(S,{path:":billId/edit/review",element:a.jsx(A,{appContent:a.jsx(kt,{})})}),a.jsx(S,{path:"/:billId/:addressType",element:a.jsx(A,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"/new/:addressType",element:a.jsx(A,{appContent:a.jsx(dt,{isSubPage:!0})})}),a.jsx(S,{path:"new/vendor/create",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"new/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:"new/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:"new/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(A,{appContent:a.jsx(Ae,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/ach",element:a.jsx(A,{appContent:a.jsx(he,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/domestic",element:a.jsx(A,{appContent:a.jsx(ge,{})})}),a.jsx(S,{path:":billId/edit/vendor/create/international",element:a.jsx(A,{appContent:a.jsx(u,{})})}),a.jsx(S,{path:"*",element:a.jsx(xe,{})})]}):a.jsx(S,{path:"*",element:a.jsx(re,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${x.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(S,{path:"*",element:a.jsx(xe,{})})]})}export{jo as default};
@@ -0,0 +1,9 @@
1
+ import{j as C}from"./liveblocks-BqtYq8PY.js";import{a as V}from"./sentry-BtWdTNDK.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-4nWRIid2.js";import{D as ce,w as ue,aS as de,z,Z as pe,e as B,ag as x,h as E,bH as le,au as me,x as R,av as P}from"./index-qYSCKekz.js";import{Qt as fe,e$ as G,tZ as ye,KO as Se,zY as ge,Dn as Ie,G8 as he,GN as Te,HN as be,QQ as De,QR as Oe,QS as Ce,QT as ke,QU as Ve,Nf as Ne,PV as we,Nu as Ae,Er as _e,Nv as ve,Ev as Fe,lo as xe,gn as Ee,gm as ze,gl as Be,r_ as Re,rR as Pe,rO as Ue,lg as Le,u6 as Me,u4 as U,bE as L,ui as M,cB as je}from"./zeni-epic-state-Brhydpej.js";import{n as Ge}from"./mui-ChRNPf14.js";import{d as j}from"./routePaths-TA66BJgf.js";import{M as Qe}from"./MobileAppDrawer-hdYoVCXp.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="dcaa2a4e-6131-43b0-b11e-e42456fa856c",t._sentryDebugIdIdentifier="sentry-dbid-dcaa2a4e-6131-43b0-b11e-e42456fa856c")}catch{}})();const Ze=Ge.div`
2
+ display: flex;
3
+ min-height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${t=>t.theme.colors.grey4};
9
+ `,$e=re((function(t,u){const{businessVerificationDetails:n}=u,i=G(t),y=z.getSignedInUser(),S=i.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},T=Ne(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=we(t.companyConfigState),s=Ae(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:l}=u,{tenantEmailDomain:T}=y;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:d,companyIndustryType:D,companyLegalName:O,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:r,primaryContactName:o,primaryContactUserId:c,primaryContactSyncToken:b,syncToken:f,fileIds:a,incDate:p,typeOfIncorporation:N,stateOfIncorporation:w,sourceOfFunds:A,companySubIndustry:_,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:Z,transactionVolume:$,transactionVolumeDescription:q,purposeOfAccount:H,purposeOfAccountDescription:K,regulatedStatus:W,regulatedStatusDescription:Y,usNexus:J,usNexusTypes:X}=e,v=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?je(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:p!=null?L(p?.toString()):p,typeOfIncorporation:N?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:A?.selectedOption??"",companySubIndustry:_?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((F=>F.length===2?F:P(F)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:$?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:K,regulatedStatus:W??"",regulatedStatusDescription:Y,usNexus:J,usNexusTypes:X?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:b};t(M({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:e=>{const s=e.map((d=>{const{officerType:D,userId:O,name:g,email:m,nationalityCountryCode:I,ssn:r,dob:o,phone:c,syncToken:b,selectDocument:f,role:a,ownership:p,isSelectedForVerification:N,userVerificationStatus:w,treasuryUserVerificationStatus:A,fileIds:_}=d;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:D,userId:O,firstName:g.firstName,lastName:g.lastName,email:m,ssn:r,nationalityCountryCode:I?.selectedOption!=null?P(I.selectedOption):void 0,phone:c,birthday:o!=null?L(o?.toString()):o,syncToken:b,titleAtCompany:a.selectedOption,ownershipInCompany:p,documentTypeSelectedForVerification:h,isSelectedForVerification:N,userVerificationStatus:w,treasuryUserVerificationStatus:A,fileIds:_,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(M({officers:s}))},onSaveDetailsClick:e=>{t(U(n,e,i))},onSendForVerificationClick:e=>{t(U(n,e,i,!0))},onAddressClick:e=>{const s=j(T,e),d=R(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=j(T,e),d=R(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Me({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(Le({files:e}))},onDeleteFile:e=>{t(Ue(e))},onDeleteFileList:e=>{t(Pe(e))},onEditFileName:(e,s)=>{t(Re(e,s.split(".")[0]))},onGetOtp:e=>{t(Be(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ze(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ee(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(xe({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=ve(e.documentType);s!=null&&t(Fe({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(_e({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(le),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[l,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=ce(),{useDynamicConfig:d}=ue(),{configValue:D}=d(de.zeniAccountsConfig),O=fe(D),g=k((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),m=k((a=>a.companyConfigState.fetchState)),I=k((a=>a.userRoleConfigState.fetchState)),r=k((a=>G(a))),o=r.companyId??z.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{m==="Not-Started"&&i(ye()),I==="Not-Started"&&i(Se(!0))}),[m,I,i]),V.useEffect((()=>{if(!y&&g==="Not-Started"&&o!=null)switch(S(!0),t){case"zeni_accounts":i(be(o,!0));break;case"zeni_treasury":i(Te(o,!0));break;case"reimbursement":i(he(o,!0));break;case"charge_cards":i(Ie(o,!0));break;default:i(ge(o,!0))}}),[y,g,o,i]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(t){case"zeni_accounts":c=r.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=r.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=r.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||r.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=r.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=r.companyBillPayInfo?.info?.isBillPayTOSAccepted}const b=a=>{T(a)},f=k((a=>{switch(t){case"zeni_accounts":return Ve(a,o);case"zeni_treasury":return ke(a,o);case"charge_cards":return Ce(a,o);case"reimbursement":return Oe(a,o);default:return De(a,o)}}));return c===!1?C.jsx(ie,{to:"../promo"}):C.jsxs(Ze,{children:[C.jsx(pe,{analytics:B,onLoad:a=>(p=>{switch(t){case"zeni_accounts":return p.trackPageLoaded(E.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return p.trackPageLoaded(E.Event.reimbursementBusinessVerification);default:return p.trackPageLoaded(E.Event.billPayBusinessVerification,x(n)?"Settings":void 0)}})(a)}),x(n)?C.jsx(Qe,{isAppContentDrawerOpen:l,handleDrawerToggle:b}):null,C.jsx($e,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:x(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{b(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};
@@ -1,14 +1,14 @@
1
- import{j as g}from"./liveblocks-bqFl_SVp.js";import{a as l}from"./sentry-Bj_fC7Ll.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Bnb5S7eF.js";import{Z as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,D as we,g as $,dj as H,dt as Ee,O as ke,j as Ae,a9 as Te,dm as xe,dn as Oe,a4 as _e,dr as Ue,b6 as ve,ds as Qe}from"./index-DQqz4S7_.js";import{gp as Fe,eY as G,eZ as $e,fs as De,iO as je,iK as Le,e_ as B,g9 as Ve,g1 as Re,g5 as N,ga as qe,gc as Me,gd as He,ge as Be,gf as Ne}from"./zeni-epic-state-GXytJkko.js";import{D as ze,n as j,P as We,S as Ge}from"./mui-BAFflVdx.js";import"./recharts-B3FaT6ex.js";import"./analytics-fzE8ssbj.js";import"./plaid-Il6Pn-tK.js";import"./dnd-BclBZkmc.js";import"./stripe-cKAAJElX.js";import"./lottie-CosVBOrn.js";import"./lexical-DbVLnI8g.js";import"./pdf-Ba7sOjY6.js";import"./utils-BKBg63lI.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="d19cada3-125d-412e-9e25-b6bf2cc4c8c7",e._sentryDebugIdIdentifier="sentry-dbid-d19cada3-125d-412e-9e25-b6bf2cc4c8c7")}catch{}})();const Y="chat-response-generated",Z="cards/ask",K="card_policy_hero";function D(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),c=a.isSubmitting,d=Oe(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:O}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,O)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${Z}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(Ve({questionAnswerId:n,isCollapsed:t}))},...Ue(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Ze=ee.pageTitle,Ke=J.chatHeaderSubtitle,Xe=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:O}=be();l.useEffect((()=>{o(Fe())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ze:A,subtitle:I?Xe:Ke})),[I]),[ae,_]=l.useState(null),[oe,U]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),U(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),U(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),U(w),v.current=!1}}),[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${Z}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(je())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))}),[V,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:O,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Je=j(Ge)`
1
+ import{j as g}from"./liveblocks-BqtYq8PY.js";import{a as l}from"./sentry-BtWdTNDK.js";import{u as pe,h as he,g as Ce,j as q,i as fe,n as Se}from"./core-4nWRIid2.js";import{Y as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,Z as we,e as $,dj as H,dt as Ee,a as ke,h as Ae,a9 as Te,dm as xe,dn as Ue,a4 as _e,dr as Oe,b6 as ve,ds as Qe}from"./index-qYSCKekz.js";import{gr as Fe,e_ as G,e$ as $e,fu as De,iQ as Le,iM as Ve,f0 as B,gb as je,g3 as Me,g7 as N,gc as Re,ge as qe,gf as He,gg as Be,gh as Ne}from"./zeni-epic-state-Brhydpej.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-ChRNPf14.js";import"./recharts-UIIeT-6j.js";import"./analytics-CP-wGaZJ.js";import"./plaid-j-SLH4pe.js";import"./dnd-DPx0nGIt.js";import"./stripe-cKAAJElX.js";import"./lottie-C6mBeCcV.js";import"./lexical-Dce73siJ.js";import"./pdf-CHegScPw.js";import"./utils-BGj88Dzy.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="1584eedf-5e99-4c43-8dc8-c0560c150914",e._sentryDebugIdIdentifier="sentry-dbid-1584eedf-5e99-4c43-8dc8-c0560c150914")}catch{}})();const Y="chat-response-generated",X="cards/ask",Z="card_policy_hero";function D(e){return`/${e}/cards`}function J(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===Z?J(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=qe(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Re(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Me()),m((function(n){return`/${n}/${X}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:K,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=K.pageTitle,Xe=ee.pageTitle,Ze=K.chatHeaderSubtitle,Je=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(Fe())}),[o]);const i=q((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=q((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===Z,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Xe:A,subtitle:I?Je:Ze})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",M=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${X}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&M&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,M,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?J(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Ke,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Ke=L(Ge)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
- `,et=j.div`
5
+ `,et=L.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
- `,tt=j(We)`
11
+ `,tt=L(We)`
12
12
  box-shadow: ${({theme:e})=>e.colors.elevation2};
13
13
  color: ${({theme:e})=>e.colors.grey4};
14
14
  `;export{St as default};