@zeniai/web-app-ui 5.2.15-qa → 5.2.16-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 (131) hide show
  1. package/dist/assets/AddressRoutes-CvVopZml.js +1 -0
  2. package/dist/assets/{AddressScreen-Cghsd8AF.js → AddressScreen-DWZ3m1W6.js} +2 -2
  3. package/dist/assets/{AiCfoScreen-CzUpn_XQ.js → AiCfoScreen-DiSXwSAy.js} +3 -3
  4. package/dist/assets/{BillPayApprovalRoutes-1xHFB4_G.js → BillPayApprovalRoutes-Bzj_wN2N.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CQEZhXWJ.js → BillPayRoutes-Bf6AaWgJ.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-CB_FGxY4.js → BusinessVerificationPageScreen-DFVMEcvH.js} +2 -2
  7. package/dist/assets/{CardsAiCfoScreen-3KsnF1t1.js → CardsAiCfoScreen-CvKPSEX_.js} +3 -3
  8. package/dist/assets/{ChargeCardRoutes-O25seQLJ.js → ChargeCardRoutes-B_kWsesI.js} +8 -8
  9. package/dist/assets/CompanyPassportScreen-D3CNonob.js +1 -0
  10. package/dist/assets/{ConnectionAuthScreen-DgMKH21m.js → ConnectionAuthScreen-BN3ff9tH.js} +1 -1
  11. package/dist/assets/CustomerOnboardingAuthScreen-DlKfeAMx.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-D3QZqtw-.js → CustomerOnboardingRoutes-fNU7A_X6.js} +6 -6
  13. package/dist/assets/{DashboardRoutes-BqyD3tS0.js → DashboardRoutes-vwFGyOnq.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-Vrs9w3px.js → DefaultTenantHome-COmsVe67.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-Bmq0Ta-G.js +18 -0
  16. package/dist/assets/DrawerScreen-CFNs8DOc.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-BhHCRnyf.js +1 -0
  18. package/dist/assets/ExpenseAutomationRoutes-Bcbqp-xi.js +25 -0
  19. package/dist/assets/FeaturePreviewScreen-CQa-Dzig.js +1 -0
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-BXnSQnHv.js → HubSpotOAuthCallbackScreen-yv2-7Ea8.js} +1 -1
  21. package/dist/assets/MagicLinkRoutes-DSjPLdSb.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-D_r-xHBU.js +12 -0
  23. package/dist/assets/MobileAppDrawer-CcKlE5IP.js +1 -0
  24. package/dist/assets/NotFoundScreen-DlOrYovK.js +1 -0
  25. package/dist/assets/{NotificationRoutes-BRKTm1Ne.js → NotificationRoutes-gyrenPAq.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-1d0A0tZs.js +1 -0
  27. package/dist/assets/{PandLWithForecastRoutes-B2EmklfO.js → PandLWithForecastRoutes-DjhLwT7A.js} +1 -1
  28. package/dist/assets/PeopleRoutes-B4_xTiyk.js +22 -0
  29. package/dist/assets/PerformanceRoutes-DylBZUt_.js +1 -0
  30. package/dist/assets/{Preview-Q7E6grqg.js → Preview-CcprGnkI.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-ibUYeVer.js → QBOConnectionScreen-TnPId4Sm.js} +1 -1
  32. package/dist/assets/ReimbursementApprovalRoutes-POVUD6sL.js +1 -0
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-ZZ1ge8yw.js → ReimbursementApprovalRuleDetailScreen-DdpFdkik.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-DngluHTS.js → ReimbursementRoutes-CEVKaVBL.js} +7 -7
  35. package/dist/assets/{ReportsRoutes-CM8Ic-LD.js → ReportsRoutes-B1TQ9Bhd.js} +1 -1
  36. package/dist/assets/RewardsRoutes-DfP429d0.js +1 -0
  37. package/dist/assets/{ScreenRoutes-Cqn5rEvL.js → ScreenRoutes-B4XnnElP.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-DP0WHPGX.js → SettingsRoutes-Cwng1-zQ.js} +7 -7
  39. package/dist/assets/{SetupPagesScreen-CeI_lyzl.js → SetupPagesScreen-DFoSoY9W.js} +5 -5
  40. package/dist/assets/SignInScreen-e-dzxuhM.js +1 -0
  41. package/dist/assets/SignOutScreen-zX0f3nhU.js +9 -0
  42. package/dist/assets/{TaskListScreen-BnNQR3xi.js → TaskListScreen-DDBul9iH.js} +2 -2
  43. package/dist/assets/TaskRoutes-8qo7Ls7z.js +9 -0
  44. package/dist/assets/{TransactionDetailRoutes-JE1zhf5_.js → TransactionDetailRoutes-djuKroPk.js} +1 -1
  45. package/dist/assets/TransactionDetailScreen-D5r3-Mgi.js +5 -0
  46. package/dist/assets/{TransactionListRoutes-CLT0ugHA.js → TransactionListRoutes-DZo7bIuR.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-DGF0Ml1C.js → TreasuryRoutes-Dicm3fpM.js} +5 -5
  48. package/dist/assets/{VendorsRoutes-1x6Cup5r.js → VendorsRoutes-CSBYzvJD.js} +13 -13
  49. package/dist/assets/WiseConfirmationScreen-Cq4Two3C.js +12 -0
  50. package/dist/assets/{ZeniAccountRoutes-CQvULhdG.js → ZeniAccountRoutes-BZkpbBgO.js} +7 -7
  51. package/dist/assets/ZeniAccountStatementScreen-CrIZG1fJ.js +9 -0
  52. package/dist/assets/{accountMappingHelper-C5WHpsgJ.js → accountMappingHelper-DvHt_faU.js} +1 -1
  53. package/dist/assets/{analytics-D_NuuF2U.js → analytics-fzE8ssbj.js} +1 -1
  54. package/dist/assets/analyticsHelper-H9dml3jr.js +1 -0
  55. package/dist/assets/{core-Da6TLrNx.js → core-Bnb5S7eF.js} +1 -1
  56. package/dist/assets/{decodeURIComponentSafe-B-r3T5bV.js → decodeURIComponentSafe-IB5WoVjO.js} +1 -1
  57. package/dist/assets/{dnd-DC_qF3Wr.js → dnd-BclBZkmc.js} +1 -1
  58. package/dist/assets/{empty-s0Z9SHTS.js → empty-BXrJtoVu.js} +1 -1
  59. package/dist/assets/{empty-C73kmkO9.js → empty-CGGO74v5.js} +1 -1
  60. package/dist/assets/{emptyVideoElement-CUd0nWeJ.js → emptyVideoElement-DBjMlLZt.js} +1 -1
  61. package/dist/assets/epic-Bq9rvz3h.js +2 -0
  62. package/dist/assets/getLocaleForTenant-CqG7z-4D.js +1 -0
  63. package/dist/assets/{index-DykhB8j2.js → index-B9FzYJpE.js} +1 -1
  64. package/dist/assets/{index-DAI9X2Zp.js → index-BSl9hMca.js} +2 -2
  65. package/dist/assets/{index-XC9zB3-f.js → index-BfeFOTnu.js} +1 -1
  66. package/dist/assets/{index-CsQZjvif.js → index-D7gFR706.js} +1 -1
  67. package/dist/assets/{index-Di1s4e5m.js → index-DQqz4S7_.js} +14415 -14185
  68. package/dist/assets/{index-b_fXiiPC.js → index-DRI9BXaF.js} +1 -1
  69. package/dist/assets/{index-CWFrIv4j.js → index-gZ-YqOdE.js} +1 -1
  70. package/dist/assets/{index-COd9LNlP.js → index-oAxAWZsp.js} +1 -1
  71. package/dist/assets/{lexical-CQoPutFC.js → lexical-DbVLnI8g.js} +1 -1
  72. package/dist/assets/{liveblocks-C8AAaKDR.js → liveblocks-bqFl_SVp.js} +1 -1
  73. package/dist/assets/{lottie-B7_cpoe1.js → lottie-CosVBOrn.js} +1 -1
  74. package/dist/assets/{mui-CosLSKUu.js → mui-BAFflVdx.js} +1 -1
  75. package/dist/assets/{pathToGoBack-C_jELk-6.js → pathToGoBack-BX0vhbVE.js} +1 -1
  76. package/dist/assets/{pdf-CQB-J2hc.js → pdf-Ba7sOjY6.js} +3 -3
  77. package/dist/assets/{pdf-lib-CscVz5ta.js → pdf-lib-Sz3Y8uGi.js} +1 -1
  78. package/dist/assets/{plaid-2mv_ck83.js → plaid-Il6Pn-tK.js} +1 -1
  79. package/dist/assets/{pusher-DrRS7JyV.js → pusher-DSTN6BAp.js} +1 -1
  80. package/dist/assets/{react-B7r6-bpj.js → react-Ahj_9ocn.js} +1 -1
  81. package/dist/assets/{react-DTDSsBUn.js → react-BQr1_2Lm.js} +1 -1
  82. package/dist/assets/{react-C6MFx27g.js → react-DF-XRbvU.js} +1 -1
  83. package/dist/assets/{react-B42V2lQZ.js → react-DV1w5wyt.js} +1 -1
  84. package/dist/assets/{react-DJflHsBg.js → react-DjsKx-MP.js} +1 -1
  85. package/dist/assets/{react-BmvpxDDj.js → react-wreqxVEC.js} +1 -1
  86. package/dist/assets/{recharts-9jMEgSjc.js → recharts-B3FaT6ex.js} +1 -1
  87. package/dist/assets/{routePaths-C00xjTzW.js → routePaths-BU7xzRci.js} +1 -1
  88. package/dist/assets/{sentry-DfheywaX.js → sentry-Bj_fC7Ll.js} +1 -1
  89. package/dist/assets/{url-C-T2kMoW.js → url-CRSVA0N_.js} +1 -1
  90. package/dist/assets/{url-HWxh2lX9.js → url-Cv9qurGb.js} +1 -1
  91. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DGxNs-T2.js → useAiCfoDashboardSuggestedQuestionsChips-C3L5nQ7N.js} +1 -1
  92. package/dist/assets/useAskAiCfoHostNavButtonProps-C8xAByz8.js +1 -0
  93. package/dist/assets/useCashManagementBanner-7vax8nj5.js +1 -0
  94. package/dist/assets/{useChargeCardPusherEvents-BYuDd-Gt.js → useChargeCardPusherEvents-t2lV6Mj_.js} +1 -1
  95. package/dist/assets/{useDeviceId-COe_GzcU.js → useDeviceId-CnUmsNEA.js} +1 -1
  96. package/dist/assets/{useEmailConnectResultRefresh-BjWNFubI.js → useEmailConnectResultRefresh-GsUIcf-d.js} +1 -1
  97. package/dist/assets/{useInitialThreadRequest-DoJoRClL.js → useInitialThreadRequest-DA5ML13t.js} +1 -1
  98. package/dist/assets/{utils-BykfwIo5.js → utils-BKBg63lI.js} +1 -1
  99. package/dist/assets/withTransactionSidePanel-ZD8SIzTb.js +21 -0
  100. package/dist/assets/{zeni-epic-state-BqRlfhza.js → zeni-epic-state-GXytJkko.js} +5 -5
  101. package/dist/index.html +1 -1
  102. package/package.json +4 -4
  103. package/dist/assets/AddressRoutes-DJzFs1TJ.js +0 -1
  104. package/dist/assets/CompanyPassportScreen-QR3t2jCV.js +0 -1
  105. package/dist/assets/CustomerOnboardingAuthScreen-BzSz6YYh.js +0 -1
  106. package/dist/assets/DomesticWireDetailScreen-bKr1naWX.js +0 -18
  107. package/dist/assets/DrawerScreen-B1WCu8EA.js +0 -1
  108. package/dist/assets/EntityDetailRoutes-DWJcyQDq.js +0 -1
  109. package/dist/assets/ExpenseAutomationRoutes-PPxq880X.js +0 -25
  110. package/dist/assets/FeaturePreviewScreen-BPveJn8E.js +0 -1
  111. package/dist/assets/MagicLinkRoutes-BFVdaTa3.js +0 -72
  112. package/dist/assets/MagicLinkSignInScreen-DqmsP04r.js +0 -12
  113. package/dist/assets/MobileAppDrawer-DqFii0U-.js +0 -1
  114. package/dist/assets/NotFoundScreen-BEl52fo_.js +0 -1
  115. package/dist/assets/OAuthConsentScreen-Q0fwJrGA.js +0 -1
  116. package/dist/assets/PeopleRoutes-BYR9_J0o.js +0 -22
  117. package/dist/assets/PerformanceRoutes-Dfm_2dgF.js +0 -1
  118. package/dist/assets/ReimbursementApprovalRoutes-v56rgDew.js +0 -1
  119. package/dist/assets/RewardsRoutes-C3ldEdqJ.js +0 -1
  120. package/dist/assets/SignInScreen-Ce4sEOOU.js +0 -1
  121. package/dist/assets/SignOutScreen-Ca4mPIX6.js +0 -9
  122. package/dist/assets/TaskRoutes-B4QMbkFu.js +0 -9
  123. package/dist/assets/TransactionDetailScreen-SL2to1sC.js +0 -5
  124. package/dist/assets/WiseConfirmationScreen-BwZDrWO1.js +0 -12
  125. package/dist/assets/ZeniAccountStatementScreen-B7_iH7R_.js +0 -9
  126. package/dist/assets/analyticsHelper-CY5dpKAo.js +0 -1
  127. package/dist/assets/epic-DAjg0wXj.js +0 -2
  128. package/dist/assets/getLocaleForTenant-B28GqiVQ.js +0 -1
  129. package/dist/assets/useAskAiCfoHostNavButtonProps-BLThPlIr.js +0 -1
  130. package/dist/assets/useCashManagementBanner-B9wkg7e1.js +0 -1
  131. package/dist/assets/withTransactionSidePanel-BZEqEmm2.js +0 -21
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-bqFl_SVp.js";import{A as d}from"./AddressScreen-DWZ3m1W6.js";import i from"./NotFoundScreen-DlOrYovK.js";import"./sentry-Bj_fC7Ll.js";import{o as s,p as r}from"./core-Bnb5S7eF.js";import"./zeni-epic-state-GXytJkko.js";import"./recharts-B3FaT6ex.js";import"./index-DQqz4S7_.js";import"./mui-BAFflVdx.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 t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-C8AAaKDR.js";import{a as h}from"./sentry-DfheywaX.js";import{h as T,u as _,g as E,i as j,j as B,n as D}from"./core-Da6TLrNx.js";import{J as M,y as $,z as L,d as N,D as K,E as z,e as C,g as S,q as F,k as b,r as R}from"./index-Di1s4e5m.js";import{N4 as k,hY as U,eZ as q,N5 as G,c7 as O,N6 as V,lm as H}from"./zeni-epic-state-BqRlfhza.js";import{n as J}from"./mui-CosLSKUu.js";import Y from"./NotFoundScreen-BEl52fo_.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]="db33a2c6-2add-4ff1-8932-62e4ad65faec",e._sentryDebugIdIdentifier="sentry-dbid-db33a2c6-2add-4ff1-8932-62e4ad65faec")}catch{}})();const Z=J.div`
1
+ import{j as r}from"./liveblocks-bqFl_SVp.js";import{a as S}from"./sentry-Bj_fC7Ll.js";import{h as T,u as _,g as E,i as j,j as B,n as D}from"./core-Bnb5S7eF.js";import{p as M,E as $,z as L,f as N,B as K,D as z,g as C,j as m,r as F,n as h,v as R}from"./index-DQqz4S7_.js";import{N4 as v,hY as U,eZ as G,N5 as O,c7 as V,N6 as q,lm as H}from"./zeni-epic-state-GXytJkko.js";import{n as Y}from"./mui-BAFflVdx.js";import Z from"./NotFoundScreen-DlOrYovK.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]="eb98373d-bb1d-4ba8-b378-03ecf9b1dfee",e._sentryDebugIdIdentifier="sentry-dbid-eb98373d-bb1d-4ba8-b378-03ecf9b1dfee")}catch{}})();const J=Y.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as r}from"./liveblocks-C8AAaKDR.js";import{a as h}from"./sentry-Dfheywa
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,Q=D((function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=q(e),a=t.roleMap!=null&&G(t.roleMap),d=i||c==="user_address"||O(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=V(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=k(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}}),(function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,n=R(d?.pathnameStackToGoBack);let s=n.poppedPathname??w();const u=d?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(s=`${s}?${f}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=W(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(),f=M(),I=$(),v=L.getSignedInUser(),[g,x]=h.useState(s==null),p=B((m=>s!=null?k(m,s).fetchState:"Not-Started")),A=N();if(v==null)throw Error("Can't access address page without signing in...");const P=m=>m.trackPageLoaded(s!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{g||s==null||(x(!0),d(U(s,!1)))}),[g,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!g&&p==="Not-Started"||g&&p==="In-Progress"?r.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):s!=null&&p==="Error"?(a(`${w(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(z,{analytics:C,onLoad:P}),r.jsx(Z,{windowSize:f,children:r.jsx(Q,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:A?.loggedInUserRoleMap})})]}):r.jsx(Y,{})}const w=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},W=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,W as t};
9
+ `,Q=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:h.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=v(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:h.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??w();const u=d?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(s=`${s}?${f}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=W(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(m.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}}))(F);function re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=_(),n=E(),{addressId:s,addressType:u}=j(),f=M(),I=$(),k=L.getSignedInUser(),[g,x]=S.useState(s==null),p=B((b=>s!=null?v(b,s).fetchState:"Not-Started")),A=N();if(k==null)throw Error("Can't access address page without signing in...");const P=b=>b.trackPageLoaded(s!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return S.useEffect((()=>{g||s==null||(x(!0),d(U(s,!1)))}),[g,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!g&&p==="Not-Started"||g&&p==="In-Progress"?r.jsx(K,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):s!=null&&p==="Error"?(a(`${w(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(z,{analytics:C,onLoad:P}),r.jsx(J,{windowSize:f,children:r.jsx(Q,{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 w=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},W=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,W as t};
@@ -1,17 +1,17 @@
1
- import{j as u}from"./liveblocks-C8AAaKDR.js";import{a as l}from"./sentry-DfheywaX.js";import{u as we,h as Pe,g as Ee,j as Z,i as ye,n as Te}from"./core-Da6TLrNx.js";import{Y as ve,de as Ae,z as Qe,J as _e,df as Oe,dg as Ue,bb as X,dh as ae,di as je,ba as oe,r as V,E as B,e as I,dj as R,dk as Fe,dl as Le,a3 as De,g as Be,a9 as Re,dm as Me,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,v as ze,b6 as He,ds as We}from"./index-Di1s4e5m.js";import{gp as Ye,eY as ne,eZ as Je,iE as Ke,Uj as Ze,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-BqRlfhza.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-CosLSKUu.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-DGxNs-T2.js";import{p as gt}from"./pathToGoBack-C_jELk-6.js";import"./recharts-9jMEgSjc.js";import"./analytics-D_NuuF2U.js";import"./plaid-2mv_ck83.js";import"./dnd-DC_qF3Wr.js";import"./stripe-cKAAJElX.js";import"./lottie-B7_cpoe1.js";import"./lexical-CQoPutFC.js";import"./pdf-CQB-J2hc.js";import"./utils-BykfwIo5.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]="07d2b385-8aaa-429c-8342-e44c971b91a6",e._sentryDebugIdIdentifier="sentry-dbid-07d2b385-8aaa-429c-8342-e44c971b91a6")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:A}=oe(x,m);g!=="answer"?I.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,We(A,i),c.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&He(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=ze(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{b(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{b(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Re(Me)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=Ee(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=Ae();l.useEffect((()=>{a(Ye())}),[a]);const h=Z((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=ye(),c=_e(),g=De(c),m=Z((r=>Je(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,E=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&&E!=null&&E!==""){const r=o.state;_(E),O($),U(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[E,$,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 y=h.uiState.lastContextMessage;l.useEffect((()=>{y!=null&&y!==""&&i!=null&&(_(y),O(!0),U(void 0),j(void 0),a(Ze()))}),[y,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 K=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const Ie=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(bt,{children:[u.jsx(B,{analytics:I,onLoad:K}),Q.drawerElement,u.jsx(It,{children:u.jsx(se,{children:u.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(M(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:I,onLoad:K}):null,u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:I,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&Q.drawerElement,u.jsx(ft,{...be,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers: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?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-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)`
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
- `,bt=k.div`
8
+ `,It=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
- `,It=k.div`
14
+ `,bt=k.div`
15
15
  flex: 1;
16
16
  min-height: 0;
17
17
  display: flex;
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-C8AAaKDR.js";import{a as v}from"./sentry-DfheywaX.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 x}from"./core-Da6TLrNx.js";import{eZ as O,Qs as A,Q8 as h,zO as E,zG as Q,zK as R,zz as q,Qa as K,zQ as ae,zC as G,zT as M,zP as C}from"./zeni-epic-state-BqRlfhza.js";import{z as V,a9 as Z,bL as oe,ag as P,bC as H,bM as le,y as J,D as X,bN as pe,bO as se}from"./index-Di1s4e5m.js";import"./mui-CosLSKUu.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-ZZ1ge8yw.js";import re from"./NotFoundScreen-BEl52fo_.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]="9bbd3ddc-6d79-444a-9535-6815234d7ea4",e._sentryDebugIdIdentifier="sentry-dbid-9bbd3ddc-6d79-444a-9535-6815234d7ea4")}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,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx($,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...m})},_="bill-approval-rule-update",de=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)),ue=()=>{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,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx($,{to:"../../promo"}):c.jsx(de,{currentTenant:d,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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?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))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(v.useEffect((()=>{l||(d(!0),p(G(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,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:u,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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let D=[];L==="role"&&N!=null?D=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(D=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:D,operator:D.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:d(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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?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))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(Y(),v.useEffect((()=>{l||(d(!0),p(G(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,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:u,location:t},o??"new")}function De(){return c.jsxs(te,{children:[c.jsx(x,{path:"/",element:c.jsx(ue,{})}),c.jsx(x,{path:"/new",element:c.jsx(z,{})}),c.jsx(x,{path:"/:approvalRuleId/edit",element:c.jsx(z,{})}),c.jsx(x,{path:"*",element:c.jsx(re,{})})]})}export{De as B};
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,4 +1,4 @@
1
- import{j as a}from"./liveblocks-C8AAaKDR.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as J,l as ia,o as oa,p as y}from"./core-Da6TLrNx.js";import{eZ as W,PK as Ge,bs as wt,KB as la,bq as Bt,bJ as pe,PL as At,z4 as Ct,Aj as $e,zD as sa,bn as Ee,PM as ra,PN as ca,c7 as da,PO as ua,kG as xt,PP as Et,PQ as Dt,AU as Me,zj as Ae,PR as pa,yU as tt,PS as ma,EZ as ba,yY as ha,z2 as jt,PT as fe,PU as Oe,Ak as Ne,PV as ga,PW as Sa,An as ze,PX as ya,AA as fa,PY as Tt,A4 as at,A9 as va,PZ as ka,P_ as ue,P$ as Pt,Q0 as Ft,Q1 as Rt,gt as Ia,zo as Le,cC as Vt,Q2 as wa,fB as Ba,Q3 as Aa,Q4 as Ca,fG as $t,fE as Lt,Q5 as Qe,Q6 as xa,Q7 as Ea,Nv as Ze,Q8 as Da,Nw as oe,Nx as We,Q9 as ja,Qa as Ta,Qb as Pa,Ab as nt,A8 as Fa,Qc as Ra,Qd as Va,Qe as $a,zW as La,Qf as Ua,Qg as _a,Qh as Ga,cq as Ut,cS as _t,kR as Ma,bP as Oa,bo as Gt,bQ as Mt,ya as Na,Qi as za,EM as Qa,ES as Za,uw as Wa,Al as Ha,A$ as qa,l2 as ye,Qj as Ka,Qk as Ot,lw as Ya,kY as Nt,lh as zt,lg as it,bE as be,bO as Ja,Ql as Xa,Qm as ve,jB as en,Qn as ot,Qo as tn,jF as an,j_ as nn,Bd as on,Qp as ln,lp as sn,B3 as rn,Qq as lt,B7 as cn,Bc as dn,B9 as un,B1 as pn,Qr as Qt,zd as mn,Qs as bn,Qt as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rY as kn,le as In,B5 as wn,jL as Bn,lD as An,Qu as Cn,jD as xn,rP as En,Qv as Dn,A0 as jn,bK as Tn,bt as Pn,Mj as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-BqRlfhza.js";import{y as me,z as $,d as ke,a0 as He,A as le,c as S,aS as Ce,D as re,o as x,E as De,e as D,bh as Un,r as Z,a4 as qe,v as E,J as Ie,bi as rt,bj as ct,bk as _n,al as Gn,K as Mn,aM as On,H as Zt,O as je,M as Ke,bl as Nn,au as Wt,bm as zn,Z as Qn,g as Ht,a9 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Yn,bs as Jn,bt as Xn,bu as ei,bv as ti,$ as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-Di1s4e5m.js";import{n as U,S as ri}from"./mui-CosLSKUu.js";import{A as dt}from"./AddressScreen-Cghsd8AF.js";import{g as ie,a as Te,i as qt,V as Ye,b as Je,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-bKr1naWX.js";import{a as f}from"./sentry-DfheywaX.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-BLThPlIr.js";import{u as Kt}from"./useInitialThreadRequest-DoJoRClL.js";import xe from"./NotFoundScreen-BEl52fo_.js";import{D as pi}from"./DrawerScreen-B1WCu8EA.js";import{M as Yt}from"./MobileAppDrawer-DqFii0U-.js";import{F as Jt}from"./FeaturePreviewScreen-BPveJn8E.js";import{S as Pe}from"./SetupPagesScreen-CeI_lyzl.js";import{B as mi}from"./BillPayApprovalRoutes-1xHFB4_G.js";import{FallBackRoute as bi}from"./ScreenRoutes-Cqn5rEvL.js";import"./recharts-9jMEgSjc.js";import"./analytics-D_NuuF2U.js";import"./plaid-2mv_ck83.js";import"./dnd-DC_qF3Wr.js";import"./stripe-cKAAJElX.js";import"./lottie-B7_cpoe1.js";import"./lexical-CQoPutFC.js";import"./pdf-CQB-J2hc.js";import"./utils-BykfwIo5.js";import"./analyticsHelper-CY5dpKAo.js";import"./routePaths-C00xjTzW.js";import"./BusinessVerificationPageScreen-CB_FGxY4.js";import"./ReimbursementApprovalRuleDetailScreen-ZZ1ge8yw.js";import"./getLocaleForTenant-B28GqiVQ.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]="61f88823-f9a9-4231-b516-c597dafe5aa1",e._sentryDebugIdIdentifier="sentry-dbid-61f88823-f9a9-4231-b516-c597dafe5aa1")}catch{}})();const hi=J((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(Un);function gi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=k((z=>W(z))),s=k((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(Ce.zeniAssistConfig),w=la(o),N=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,N,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Ue=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=J((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(On);function B({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k((R=>W(R))),[C,_]=f.useState(!1),[T,G]=f.useState(!1),[L,I]=f.useState(!1),[H,O]=f.useState(),w=k((R=>Oe(R,m,g,n)));let N=w.fetchState,M=w.file,F=w.showAutofill;const q=k((R=>Ge(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{N==="Not-Started"&&(u&&T?G(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:O,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Ue.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Ue.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:I,setPayload:O,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(Ii,{children:`${Ue.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-bqFl_SVp.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as J,l as ia,o as oa,p as y}from"./core-Bnb5S7eF.js";import{eZ as W,PN as Ge,bs as wt,KB as la,bq as Bt,bJ as pe,PO as At,z4 as Ct,Aj as $e,zD as sa,bn as Ee,PP as ra,PQ as ca,c7 as da,PR as ua,kG as xt,PS as Et,PT as Dt,AU as Me,zj as Ae,PU as pa,yU as tt,PV as ma,EZ as ba,yY as ha,z2 as jt,PW as fe,PX as Oe,Ak as Ne,PY as ga,PZ as Sa,An as ze,P_ as ya,AA as fa,P$ as Tt,A4 as at,A9 as va,Q0 as ka,Q1 as ue,Q2 as Pt,Q3 as Ft,Q4 as Rt,gt as Ia,zo as Le,cC as Vt,Q5 as wa,fB as Ba,Q6 as Aa,Q7 as Ca,fG as $t,fE as Lt,Q8 as Qe,Q9 as xa,Qa as Ea,Nv as Ze,Qb as Da,Nw as oe,Nx as We,Qc as ja,Qd as Ta,Qe as Pa,Ab as nt,A8 as Fa,Qf as Ra,Qg as Va,Qh as $a,zW as La,Qi as Ua,Qj as _a,Qk as Ga,cq as Ut,cS as _t,kR as Ma,bP as Oa,bo as Gt,bQ as Mt,ya as Na,Ql as za,EM as Qa,ES as Za,uw as Wa,Al as Ha,A$ as qa,l2 as ye,Qm as Ka,Qn as Ot,lw as Ya,kY as Nt,lh as zt,lg as it,bE as be,bO as Ja,Qo as Xa,Qp as ve,jB as en,Qq as ot,Qr as tn,jF as an,j_ as nn,Bd as on,Qs as ln,lp as sn,B3 as rn,Qt as lt,B7 as cn,Bc as dn,B9 as un,B1 as pn,Qu as Qt,zd as mn,Qv as bn,Qw as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rY as kn,le as In,B5 as wn,jL as Bn,lD as An,Qx as Cn,jD as xn,rP as En,Qy as Dn,A0 as jn,bK as Tn,bt as Pn,Mj as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-GXytJkko.js";import{E as me,z as $,f as ke,a0 as He,y as le,d as S,aS as Ce,B as re,o as x,D as De,g as D,bh as Un,v as Z,a4 as qe,w as E,p as Ie,bi as rt,bj as ct,bk as _n,al as Gn,K as Mn,aM as On,G as Zt,O as je,M as Ke,bl as Nn,au as Wt,bm as zn,_ as Qn,j as Ht,a9 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Yn,bs as Jn,bt as Xn,bu as ei,bv as ti,x as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-DQqz4S7_.js";import{n as U,S as ri}from"./mui-BAFflVdx.js";import{A as dt}from"./AddressScreen-DWZ3m1W6.js";import{g as ie,a as Te,i as qt,V as Ye,b as Je,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-Bmq0Ta-G.js";import{a as f}from"./sentry-Bj_fC7Ll.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-C8xAByz8.js";import{u as Kt}from"./useInitialThreadRequest-DA5ML13t.js";import xe from"./NotFoundScreen-DlOrYovK.js";import{D as pi}from"./DrawerScreen-CFNs8DOc.js";import{M as Yt}from"./MobileAppDrawer-CcKlE5IP.js";import{F as Jt}from"./FeaturePreviewScreen-CQa-Dzig.js";import{S as Pe}from"./SetupPagesScreen-DFoSoY9W.js";import{B as mi}from"./BillPayApprovalRoutes-Bzj_wN2N.js";import{FallBackRoute as bi}from"./ScreenRoutes-B4XnnElP.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";import"./analyticsHelper-H9dml3jr.js";import"./routePaths-BU7xzRci.js";import"./BusinessVerificationPageScreen-DFVMEcvH.js";import"./ReimbursementApprovalRuleDetailScreen-DdpFdkik.js";import"./getLocaleForTenant-CqG7z-4D.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]="37d89ad5-f551-4fce-b9b1-fd37be67a61c",e._sentryDebugIdIdentifier="sentry-dbid-37d89ad5-f551-4fce-b9b1-fd37be67a61c")}catch{}})();const hi=J((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(Un);function gi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=k((z=>W(z))),s=k((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(Ce.zeniAssistConfig),w=la(o),N=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,N,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Ue=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=J((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(On);function B({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k((R=>W(R))),[C,_]=f.useState(!1),[T,G]=f.useState(!1),[L,I]=f.useState(!1),[H,O]=f.useState(),w=k((R=>Oe(R,m,g,n)));let N=w.fetchState,M=w.file,F=w.showAutofill;const q=k((R=>Ge(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Ne(!0))}),[n,t]),f.useEffect((()=>{N==="Not-Started"&&(u&&T?G(!1):!u&&C&&_(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(_(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:O,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:X}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Ue.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Ue.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:I,setPayload:O,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(Ii,{children:`${Ue.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(wi,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const mt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-C8AAaKDR.js";import{a as V}from"./sentry-DfheywaX.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-Da6TLrNx.js";import{d as ce,A as ue,aS as de,z,E as le,e as B,ag as E,g as x,bH as pe,au as me,v as P,av as L}from"./index-Di1s4e5m.js";import{Qg as fe,eZ as G,tX as ye,KE as Se,zW as ge,Dl as Ie,G6 as he,GL as be,HL as Te,QD as De,QE as Oe,QF as Ce,QG as ke,QH as Ve,N5 as Ae,PI as Ne,Nk as we,Ep as Fe,Nl as _e,Et as ve,lm as Ee,gl as xe,gk as ze,gj as Be,rY as Pe,rP as Le,rM as Re,le as Ue,u4 as Me,u2 as R,bE as U,ug as M,cA as je}from"./zeni-epic-state-BqRlfhza.js";import{n as Ge}from"./mui-CosLSKUu.js";import{d as j}from"./routePaths-C00xjTzW.js";import{M as Qe}from"./MobileAppDrawer-DqFii0U-.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]="0ecb3fd5-a320-493c-b26e-321ab209cfbc",t._sentryDebugIdIdentifier="sentry-dbid-0ecb3fd5-a320-493c-b26e-321ab209cfbc")}catch{}})();const He=Ge.div`
1
+ import{j as C}from"./liveblocks-bqFl_SVp.js";import{a as V}from"./sentry-Bj_fC7Ll.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-Bnb5S7eF.js";import{f as ce,y as ue,aS as de,z,D as le,g as B,ag as E,j as x,bH as pe,au as me,w as P,av as L}from"./index-DQqz4S7_.js";import{Qj as fe,eZ as G,tX as ye,KE as Se,zW as ge,Dl as Ie,G6 as he,GL as be,HL as Te,QG as De,QH as Oe,QI as Ce,QJ as ke,QK as Ve,N5 as we,PL as Ae,Nk as Ne,Ep as Fe,Nl as _e,Et as ve,lm as Ee,gl as xe,gk as ze,gj as Be,rY as Pe,rP as Le,rM as Re,le as Ue,u4 as je,u2 as R,bE as U,ug as j,cA as Me}from"./zeni-epic-state-GXytJkko.js";import{n as Ge}from"./mui-BAFflVdx.js";import{d as M}from"./routePaths-BU7xzRci.js";import{M as Qe}from"./MobileAppDrawer-CcKlE5IP.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]="c47708fb-2445-4754-a15d-5b70af657bd3",t._sentryDebugIdIdentifier="sentry-dbid-c47708fb-2445-4754-a15d-5b70af657bd3")}catch{}})();const He=Ge.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -6,4 +6,4 @@ import{j as C}from"./liveblocks-C8AAaKDR.js";import{a as V}from"./sentry-Dfheywa
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${t=>t.theme.colors.grey4};
9
- `,Ze=re((function(t,u){const{businessVerificationDetails:n}=u,i=G(t),y=z.getSignedInUser(),S=i.tenantId,p={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=Ae(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Ne(t.companyConfigState),s=we(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:p,isDisabled:b,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:p}=u,{tenantEmailDomain:b}=y;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:d,companyIndustryType:D,companyLegalName:O,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:r,primaryContactName:o,primaryContactUserId:c,primaryContactSyncToken:T,syncToken:f,fileIds:a,incDate:l,typeOfIncorporation:A,stateOfIncorporation:N,sourceOfFunds:w,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:H,transactionVolume:Z,transactionVolumeDescription:q,purposeOfAccount:W,purposeOfAccountDescription:$,regulatedStatus:K,regulatedStatusDescription:X,usNexus:Y,usNexusTypes:J}=e,_=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?je(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:l!=null?U(l?.toString()):l,typeOfIncorporation:A?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:w?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:L(v)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:Z?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:K??"",regulatedStatusDescription:X,usNexus:Y,usNexusTypes:J?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:T};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:T,selectDocument:f,role:a,ownership:l,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:F}=d;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:D,userId:O,firstName:g.firstName,lastName:g.lastName,email:m,ssn:r,nationalityCountryCode:I?.selectedOption!=null?L(I.selectedOption):void 0,phone:c,birthday:o!=null?U(o?.toString()):o,syncToken:T,titleAtCompany:a.selectedOption,ownershipInCompany:l,documentTypeSelectedForVerification:h,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(M({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=j(b,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=j(b,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(Me({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(Ue({files:e}))},onDeleteFile:e=>{t(Re(e))},onDeleteFileList:e=>{t(Le(e))},onEditFileName:(e,s)=>{t(Pe(e,s.split(".")[0]))},onGetOtp:e=>{t(Be(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ze(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(xe(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ee({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=_e(e.documentType);s!=null&&t(ve({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(Fe({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(pe),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[p,b]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=ce(),{useDynamicConfig:d}=ue(),{configValue:D}=d(de.zeniAccountsConfig),O=fe(D),g=k((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),m=k((a=>a.companyConfigState.fetchState)),I=k((a=>a.userRoleConfigState.fetchState)),r=k((a=>G(a))),o=r.companyId??z.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{m==="Not-Started"&&i(ye()),I==="Not-Started"&&i(Se(!0))}),[m,I,i]),V.useEffect((()=>{if(!y&&g==="Not-Started"&&o!=null)switch(S(!0),t){case"zeni_accounts":i(Te(o,!0));break;case"zeni_treasury":i(be(o,!0));break;case"reimbursement":i(he(o,!0));break;case"charge_cards":i(Ie(o,!0));break;default:i(ge(o,!0))}}),[y,g,o,i]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(t){case"zeni_accounts":c=r.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=r.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=r.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||r.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=r.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=r.companyBillPayInfo?.info?.isBillPayTOSAccepted}const T=a=>{b(a)},f=k((a=>{switch(t){case"zeni_accounts":return Ve(a,o);case"zeni_treasury":return ke(a,o);case"charge_cards":return Ce(a,o);case"reimbursement":return Oe(a,o);default:return De(a,o)}}));return c===!1?C.jsx(ie,{to:"../promo"}):C.jsxs(He,{children:[C.jsx(le,{analytics:B,onLoad:a=>(l=>{switch(t){case"zeni_accounts":return l.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return l.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return l.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?C.jsx(Qe,{isAppContentDrawerOpen:p,handleDrawerToggle:T}):null,C.jsx(Ze,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{T(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};
9
+ `,Ze=re((function(t,u){const{businessVerificationDetails:n}=u,i=G(t),y=z.getSignedInUser(),S=i.tenantId,p={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=we(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Ae(t.companyConfigState),s=Ne(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:p,isDisabled:b,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:y,navigate:S,location:p}=u,{tenantEmailDomain:b}=y;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:d,companyIndustryType:D,companyLegalName:O,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:r,primaryContactName:o,primaryContactUserId:c,primaryContactSyncToken:T,syncToken:f,fileIds:a,incDate:l,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:h,companySourceOfFunds:Q,companySourceOfFundsDescription:H,transactionVolume:Z,transactionVolumeDescription:q,purposeOfAccount:K,purposeOfAccountDescription:W,regulatedStatus:$,regulatedStatusDescription:J,usNexus:X,usNexusTypes:Y}=e,_=D?.selectedOption,ee={companyId:n,companyDescription:s,companyIndustry:d.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:O,taxIdOrEIN:g,website:m!=""&&m!=null?Me(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:l!=null?U(l?.toString()):l,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((v=>v.length===2?v:L(v)))??[],companySourceOfFunds:Q?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:Z?.selectedOption??"",transactionVolumeDescription:q,purposeOfAccount:K?.selectedOption??"",purposeOfAccountDescription:W,regulatedStatus:$??"",regulatedStatusDescription:J,usNexus:X,usNexusTypes:Y?.selectedOptions??[]},te={userId:c,firstName:o.firstName,lastName:o.lastName,email:r,syncToken:T};t(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:e=>{const s=e.map((d=>{const{officerType:D,userId:O,name:g,email:m,nationalityCountryCode:I,ssn:r,dob:o,phone:c,syncToken:T,selectDocument:f,role:a,ownership:l,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=d;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:D,userId:O,firstName:g.firstName,lastName:g.lastName,email:m,ssn:r,nationalityCountryCode:I?.selectedOption!=null?L(I.selectedOption):void 0,phone:c,birthday:o!=null?U(o?.toString()):o,syncToken:T,titleAtCompany:a.selectedOption,ownershipInCompany:l,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(j({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=M(b,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onRegisteredAddressClick:e=>{const s=M(b,e),d=P(p.state?.pathnameStackToGoBack,p.pathname);S(s,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{t(je({companyId:n})),S("../setup")},updateFilesEntity:e=>{t(Ue({files:e}))},onDeleteFile:e=>{t(Re(e))},onDeleteFileList:e=>{t(Le(e))},onEditFileName:(e,s)=>{t(Pe(e,s.split(".")[0]))},onGetOtp:e=>{t(Be(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ze(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(xe(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ee({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=_e(e.documentType);s!=null&&t(ve({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(Fe({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(pe),tt=({productType:t})=>{const u=ae(),n=ne(),i=se(),[y,S]=V.useState(!1),[p,b]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=ce(),{useDynamicConfig:d}=ue(),{configValue:D}=d(de.zeniAccountsConfig),O=fe(D),g=k((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),m=k((a=>a.companyConfigState.fetchState)),I=k((a=>a.userRoleConfigState.fetchState)),r=k((a=>G(a))),o=r.companyId??z.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{m==="Not-Started"&&i(ye()),I==="Not-Started"&&i(Se(!0))}),[m,I,i]),V.useEffect((()=>{if(!y&&g==="Not-Started"&&o!=null)switch(S(!0),t){case"zeni_accounts":i(Te(o,!0));break;case"zeni_treasury":i(be(o,!0));break;case"reimbursement":i(he(o,!0));break;case"charge_cards":i(Ie(o,!0));break;default:i(ge(o,!0))}}),[y,g,o,i]),z.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let c;switch(t){case"zeni_accounts":c=r.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":c=r.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":c=r.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||r.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":c=r.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:c=r.companyBillPayInfo?.info?.isBillPayTOSAccepted}const T=a=>{b(a)},f=k((a=>{switch(t){case"zeni_accounts":return Ve(a,o);case"zeni_treasury":return ke(a,o);case"charge_cards":return Ce(a,o);case"reimbursement":return Oe(a,o);default:return De(a,o)}}));return c===!1?C.jsx(ie,{to:"../promo"}):C.jsxs(He,{children:[C.jsx(le,{analytics:B,onLoad:a=>(l=>{switch(t){case"zeni_accounts":return l.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return l.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return l.trackPageLoaded(x.Event.billPayBusinessVerification,E(n)?"Settings":void 0)}})(a)}),E(n)?C.jsx(Qe,{isAppContentDrawerOpen:p,handleDrawerToggle:T}):null,C.jsx(Ze,{businessVerificationDetails:f,navigate:u,location:n,companyId:o,analytics:B,currentTenant:r,productType:t,isSettings:E(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{T(!0)},maxInsuredAmount:O.maxInsuredAmount})]})};export{tt as B};
@@ -1,14 +1,14 @@
1
- import{j as g}from"./liveblocks-C8AAaKDR.js";import{a as l}from"./sentry-DfheywaX.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Da6TLrNx.js";import{Y as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,E as we,e as $,dj as H,dt as Ee,O as ke,g 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-Di1s4e5m.js";import{gp as Fe,eY as Y,eZ as $e,fs as De,iO as Le,iK as Ve,e_ as B,g9 as je,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-BqRlfhza.js";import{D as ze,n as L,P as We,S as Ye}from"./mui-CosLSKUu.js";import"./recharts-9jMEgSjc.js";import"./analytics-D_NuuF2U.js";import"./plaid-2mv_ck83.js";import"./dnd-DC_qF3Wr.js";import"./stripe-cKAAJElX.js";import"./lottie-B7_cpoe1.js";import"./lexical-CQoPutFC.js";import"./pdf-CQB-J2hc.js";import"./utils-BykfwIo5.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]="e700db52-9426-4b11-993e-a1007f9f5a03",e._sentryDebugIdIdentifier="sentry-dbid-e700db52-9426-4b11-993e-a1007f9f5a03")}catch{}})();const G="chat-response-generated",K="cards/ask",X="card_policy_hero";function D(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ge=Se((function(e,a){const o=Y(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===X?Z(i):D(i);return{onEventReceived:(n,t)=>{if(n===G&&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}/${K}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({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,Ke=ee.pageTitle,Xe=J.chatHeaderSubtitle,Ze=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=>Y(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===X,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:A,subtitle:I?Ze:Xe})),[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:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${K}/${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}.${G}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ge,{...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?Z(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=L(Ye)`
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)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
5
- `,et=L.div`
5
+ `,et=j.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=L(We)`
11
+ `,tt=j(We)`
12
12
  box-shadow: ${({theme:e})=>e.colors.elevation2};
13
13
  color: ${({theme:e})=>e.colors.grey4};
14
14
  `;export{St as default};