@zeniai/web-app-ui 5.1.83-qa → 5.1.84-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/assets/AddressRoutes-D43Hie1x.js +1 -0
  2. package/dist/assets/{AddressScreen-DIAMV5NV.js → AddressScreen-Bnw-q9qt.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-BM4aLv8t.js → AiCfoScreen-BO05qm0c.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-DyNet4Dh.js → BillPayApprovalRoutes-DBMfRYXl.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-DahrLOQo.js → BillPayRoutes-o29F4oPZ.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-hhu22D-k.js → BusinessVerificationPageScreen-B8VFGhUV.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen-KYH4Ki4h.js → CardsAiCfoScreen-DFtKqSRR.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-CVK7ftE8.js → ChargeCardRoutes-CQRi_1i0.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-C4_S1yey.js → CompanyPassportScreen-8iMZOnSy.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-DtSlcTBq.js → ConnectionAuthScreen-BHV7qr-x.js} +1 -1
  11. package/dist/assets/CustomerOnboardingAuthScreen-BItV_COK.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-2pW-PoXE.js → CustomerOnboardingRoutes-Cl40SwkO.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-ChvENwE6.js → DashboardRoutes-CjsVoBRB.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-CP_ZH2Ge.js → DefaultTenantHome-2HZruVD2.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-AcOlPn9O.js → DomesticWireDetailScreen-e1trJnvt.js} +1 -1
  16. package/dist/assets/{DrawerScreen-DRCNRfxe.js → DrawerScreen-Bya9lr4Z.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-DlliIqlm.js → EntityDetailRoutes-C_Faivbe.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-CLZL8a0X.js → ExpenseAutomationRoutes-Cxa3XwQw.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-B2gZeqUb.js → FeaturePreviewScreen-Dn_zg2p2.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-CfC4M7mm.js → HubSpotOAuthCallbackScreen-B_Ph3HFN.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-Dp_stmdj.js → MagicLinkRoutes-Uz_joJsm.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-C4HWtf4f.js → MagicLinkSignInScreen-PA0FO6w5.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-dE23MOLW.js → MobileAppDrawer-DcqtBaJ_.js} +1 -1
  24. package/dist/assets/NotFoundScreen-CHiFDKSx.js +1 -0
  25. package/dist/assets/{NotificationRoutes-BL3YGmTW.js → NotificationRoutes-CuaW_wp1.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-2eBJwvVw.js → OAuthConsentScreen-BjdGEQsz.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-48iqKN3i.js → PandLWithForecastRoutes-C_o9q5tf.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-CJUZR66T.js → PeopleRoutes-BNe-SNwv.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-CIjGOTRD.js → PerformanceRoutes-BGeL6rwl.js} +1 -1
  30. package/dist/assets/{Preview-CSENbf5Y.js → Preview-CgSsrnKQ.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-Bekm7lLE.js → QBOConnectionScreen-CqGga6uy.js} +1 -1
  32. package/dist/assets/{ReferralListScreen-C6vqx1Yh.js → ReferralListScreen-D8zOvwWJ.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRoutes-BwqzeGQB.js → ReimbursementApprovalRoutes-tGHJ0QCT.js} +1 -1
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BEGnchZS.js → ReimbursementApprovalRuleDetailScreen-CCb9hYob.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes-CCF8TuvF.js → ReimbursementRoutes-zkxlyExd.js} +1 -1
  36. package/dist/assets/{ReportsRoutes-CxUu65BR.js → ReportsRoutes-B4lzoQh1.js} +1 -1
  37. package/dist/assets/{RewardsRoutes-CsHO22ee.js → RewardsRoutes-DvFyQIi8.js} +1 -1
  38. package/dist/assets/{ScreenRoutes-CVaUWXvd.js → ScreenRoutes-Ctwfcc9a.js} +2 -2
  39. package/dist/assets/{SettingsRoutes-hMKJth_j.js → SettingsRoutes-DavfbxFR.js} +1 -1
  40. package/dist/assets/{SetupPagesScreen-0Rmn0ujO.js → SetupPagesScreen-BC3BoXD_.js} +1 -1
  41. package/dist/assets/{SignInScreen-Crek87Vb.js → SignInScreen-CQXzFx_z.js} +1 -1
  42. package/dist/assets/{SignOutScreen-DxaQXOoV.js → SignOutScreen-BybKoKnw.js} +1 -1
  43. package/dist/assets/{TaskListScreen-vdZl6FIK.js → TaskListScreen-CPYcZ-W1.js} +1 -1
  44. package/dist/assets/{TaskRoutes-DP0W1LHA.js → TaskRoutes-BKVylwuJ.js} +1 -1
  45. package/dist/assets/{TransactionDetailRoutes-FhjOSBK5.js → TransactionDetailRoutes-BSVgqI50.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-DYS9pjlk.js → TransactionDetailScreen-C65Eg3fS.js} +1 -1
  47. package/dist/assets/{TransactionListRoutes-DoBemwVy.js → TransactionListRoutes-CSD6p4gK.js} +1 -1
  48. package/dist/assets/{TreasuryRoutes-DCVwIPze.js → TreasuryRoutes-BR0NZDFR.js} +1 -1
  49. package/dist/assets/{VendorsRoutes-C61wzEgU.js → VendorsRoutes-vOefstHk.js} +1 -1
  50. package/dist/assets/{WiseConfirmationScreen-Lft0vp_G.js → WiseConfirmationScreen-D5iY8RkT.js} +1 -1
  51. package/dist/assets/{ZeniAccountRoutes-wGMhyI_M.js → ZeniAccountRoutes-D6tU2qsA.js} +1 -1
  52. package/dist/assets/{ZeniAccountStatementScreen-DtGgE7ht.js → ZeniAccountStatementScreen-CHJTxsb2.js} +1 -1
  53. package/dist/assets/{accountMappingHelper-CmKvpzoN.js → accountMappingHelper-D6Z0Ua4l.js} +1 -1
  54. package/dist/assets/{analytics-extNsQM8.js → analytics-Cg5Z8SGG.js} +1 -1
  55. package/dist/assets/{analyticsHelper-DyTlv1-T.js → analyticsHelper-DWC4hX57.js} +1 -1
  56. package/dist/assets/{core-DDFcSPsn.js → core-B-oTPJV8.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-CPTO8idR.js → decodeURIComponentSafe-B-Q21fwV.js} +1 -1
  58. package/dist/assets/{dnd-GX-YRNnI.js → dnd-Cuk4xXCx.js} +1 -1
  59. package/dist/assets/{empty-DWfA4iTK.js → empty-CYpS2TbR.js} +1 -1
  60. package/dist/assets/{empty-Dk5kDWTI.js → empty-DgQDBiwJ.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-GNMGRpBs.js → emptyVideoElement-DtCA8N-R.js} +1 -1
  62. package/dist/assets/{epic-DcqP-rL_.js → epic-BmcJChEN.js} +1 -1
  63. package/dist/assets/{getLocaleForTenant-BO5EnrD4.js → getLocaleForTenant-CI2a05yW.js} +1 -1
  64. package/dist/assets/{index-CSmboeEv.js → index-B3pJy6gI.js} +1 -1
  65. package/dist/assets/{index-EJSKhejW.js → index-BHdbfxaf.js} +1 -1
  66. package/dist/assets/{index-COqszKFG.js → index-BIrv--jH.js} +1 -1
  67. package/dist/assets/{index-CgwSp4D3.js → index-BU7vvomP.js} +7 -7
  68. package/dist/assets/{index-B9VjmGcl.js → index-B_xZ_EM-.js} +1 -1
  69. package/dist/assets/{index-BJ9iY39Q.js → index-CtsuEXfE.js} +1 -1
  70. package/dist/assets/{index-B5_pJz9_.js → index-DpLVPxVp.js} +1 -1
  71. package/dist/assets/{index-Dhnt8gRJ.js → index-upy8aYPu.js} +2 -2
  72. package/dist/assets/{lexical-D9kS-egQ.js → lexical-C1Fq0m2V.js} +1 -1
  73. package/dist/assets/{liveblocks-Ckwdhq4C.js → liveblocks-DxxjGfPC.js} +1 -1
  74. package/dist/assets/{lottie-DPGHK2Fp.js → lottie-BuADNAKO.js} +1 -1
  75. package/dist/assets/{mui-BSNq34yE.js → mui-DOSI1h7F.js} +1 -1
  76. package/dist/assets/{pathToGoBack-z6DifYqP.js → pathToGoBack-BdMEfB48.js} +1 -1
  77. package/dist/assets/{pdf-Cb-UfSwB.js → pdf-AGHLQmyT.js} +3 -3
  78. package/dist/assets/{pdf-lib-BueZLsmu.js → pdf-lib-BzFzADtQ.js} +1 -1
  79. package/dist/assets/{plaid-D2PLJyWm.js → plaid-DWHfnJbe.js} +1 -1
  80. package/dist/assets/{pusher-ClXHoGeS.js → pusher-CQ5idiVM.js} +1 -1
  81. package/dist/assets/{react-6BEqXkCa.js → react-BO9xF_5M.js} +1 -1
  82. package/dist/assets/{react-Cb2J7c8L.js → react-CPfK-DEW.js} +1 -1
  83. package/dist/assets/{react-CDex0X-s.js → react-CjA8ShB_.js} +1 -1
  84. package/dist/assets/{react-BnkEQrdA.js → react-Deibnr2g.js} +1 -1
  85. package/dist/assets/{react-Cqvnxnn8.js → react-NInFZLum.js} +1 -1
  86. package/dist/assets/{react-vt52CePA.js → react-UYi9eWyI.js} +1 -1
  87. package/dist/assets/{recharts-DQxuWpcO.js → recharts-CP2XLGhX.js} +1 -1
  88. package/dist/assets/{routePaths-DCyoygy_.js → routePaths-DwDsjUCb.js} +1 -1
  89. package/dist/assets/{sentry-aFjQa0wD.js → sentry-BpQCK5If.js} +1 -1
  90. package/dist/assets/{url-BBADomhk.js → url-Dz8sFxR6.js} +1 -1
  91. package/dist/assets/{url-B6e2NbkE.js → url-fYs6tNor.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-i-SLI8wl.js → useAiCfoDashboardSuggestedQuestionsChips-DZ2p1AkJ.js} +1 -1
  93. package/dist/assets/{useAskAiCfoHostNavButtonProps-CYe1ZjKR.js → useAskAiCfoHostNavButtonProps-CZxITSCv.js} +1 -1
  94. package/dist/assets/{useCashManagementBanner-d_F0MJix.js → useCashManagementBanner-DJ9WTKd7.js} +1 -1
  95. package/dist/assets/{useChargeCardPusherEvents-DcKydMhz.js → useChargeCardPusherEvents-BhEJ6Y-2.js} +1 -1
  96. package/dist/assets/{useDeviceId-Di6qOl9C.js → useDeviceId-BonKNQmk.js} +1 -1
  97. package/dist/assets/{useEmailConnectResultRefresh-CxWjKiVU.js → useEmailConnectResultRefresh-BckImPOJ.js} +1 -1
  98. package/dist/assets/{useInitialThreadRequest-DbDztg-_.js → useInitialThreadRequest-ji5lalBJ.js} +1 -1
  99. package/dist/assets/{utils-B36TjS8C.js → utils-BnUMtQnE.js} +1 -1
  100. package/dist/assets/{withTransactionSidePanel-Ct1cyn0I.js → withTransactionSidePanel-BmZ7t99-.js} +1 -1
  101. package/dist/assets/{zeni-epic-state-BcyaAx36.js → zeni-epic-state-HC9UoYd1.js} +5 -5
  102. package/dist/index.html +1 -1
  103. package/package.json +4 -4
  104. package/dist/assets/AddressRoutes-DJNJoStb.js +0 -1
  105. package/dist/assets/CustomerOnboardingAuthScreen-CYR9jnxd.js +0 -1
  106. package/dist/assets/NotFoundScreen-CLypooWD.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DxxjGfPC.js";import{A as d}from"./AddressScreen-Bnw-q9qt.js";import i from"./NotFoundScreen-CHiFDKSx.js";import"./sentry-BpQCK5If.js";import{o as s,p as r}from"./core-B-oTPJV8.js";import"./zeni-epic-state-HC9UoYd1.js";import"./recharts-CP2XLGhX.js";import"./index-BU7vvomP.js";import"./mui-DOSI1h7F.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.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-Ckwdhq4C.js";import{a as h}from"./sentry-aFjQa0wD.js";import{h as P,u as _,g as M,i as j,j as E,n as B}from"./core-DDFcSPsn.js";import{Z as $,m as D,z as K,I as L,y as U,J as z,f as C,h as S,r as F,n as b,s as N}from"./index-CgwSp4D3.js";import{MI as I,hU as R,eX as G,MJ as J,c6 as O,MK as V,ld as q}from"./zeni-epic-state-BcyaAx36.js";import{n as H}from"./mui-BSNq34yE.js";import X from"./NotFoundScreen-CLypooWD.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]="86c2c267-0feb-4e0a-ba6f-9ee2d5ede229",e._sentryDebugIdIdentifier="sentry-dbid-86c2c267-0feb-4e0a-ba6f-9ee2d5ede229")}catch{}})();const Z=H.div`
1
+ import{j as r}from"./liveblocks-DxxjGfPC.js";import{a as h}from"./sentry-BpQCK5If.js";import{h as P,u as _,g as M,i as j,j as E,n as B}from"./core-B-oTPJV8.js";import{Z as $,m as D,z as K,I as L,y as U,J as z,f as C,h as S,r as F,n as b,s as N}from"./index-BU7vvomP.js";import{MI as I,hU as R,eX as G,MJ as J,c6 as O,MK as V,ld as q}from"./zeni-epic-state-HC9UoYd1.js";import{n as H}from"./mui-DOSI1h7F.js";import X from"./NotFoundScreen-CHiFDKSx.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]="86c2c267-0feb-4e0a-ba6f-9ee2d5ede229",e._sentryDebugIdIdentifier="sentry-dbid-86c2c267-0feb-4e0a-ba6f-9ee2d5ede229")}catch{}})();const Z=H.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-Ckwdhq4C.js";import{a as r}from"./sentry-aFjQa0wD.js";import{u as xe,h as Pe,g as we,j as K,i as ye,n as Ee}from"./core-DDFcSPsn.js";import{X as Te,db as ve,z as Ae,Z as Qe,dc as _e,dd as Ue,ba as Z,de as se,df as Oe,b9 as ae,s as V,J as B,f as I,dg as R,dh as je,di as Le,a2 as Fe,h as De,a8 as Be,dj as Re,dk as Me,a3 as Ve,dl as $e,dm as Ge,dn as qe,v as Ne,b5 as We,dp as ze}from"./index-CgwSp4D3.js";import{gl as He,eW as oe,eX as Xe,iA as Ye,TU as Je,fq as Ke,iK as Ze,iG as et,eY as M,fx as tt,g6 as st,f$ as at,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-BcyaAx36.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-BSNq34yE.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-i-SLI8wl.js";import{p as pt}from"./pathToGoBack-z6DifYqP.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="6c3b5b93-4330-4ccc-b6c7-4b5e08329be7",e._sentryDebugIdIdentifier="sentry-dbid-6c3b5b93-4330-4ccc-b6c7-4b5e08329be7")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Me(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=K(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=K(i=>Xe(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Ye("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Je()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Oe(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",X=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),Y=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(Y,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=V(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ke({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:z.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[z]);r.useEffect(()=>{F!=="In-Progress"&&D&&t(Ze())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&X&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,X,n,a,t]);const J=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:J}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(M(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:J}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(M(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:Y,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(M(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
1
+ import{j as c}from"./liveblocks-DxxjGfPC.js";import{a as r}from"./sentry-BpQCK5If.js";import{u as xe,h as Pe,g as we,j as K,i as ye,n as Ee}from"./core-B-oTPJV8.js";import{X as Te,db as ve,z as Ae,Z as Qe,dc as _e,dd as Ue,ba as Z,de as se,df as Oe,b9 as ae,s as V,J as B,f as I,dg as R,dh as je,di as Le,a2 as Fe,h as De,a8 as Be,dj as Re,dk as Me,a3 as Ve,dl as $e,dm as Ge,dn as qe,v as Ne,b5 as We,dp as ze}from"./index-BU7vvomP.js";import{gl as He,eW as oe,eX as Xe,iA as Ye,TU as Je,fq as Ke,iK as Ze,iG as et,eY as M,fx as tt,g6 as st,f$ as at,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-HC9UoYd1.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-DOSI1h7F.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-DZ2p1AkJ.js";import{p as pt}from"./pathToGoBack-BdMEfB48.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="6c3b5b93-4330-4ccc-b6c7-4b5e08329be7",e._sentryDebugIdIdentifier="sentry-dbid-6c3b5b93-4330-4ccc-b6c7-4b5e08329be7")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Me(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=K(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=K(i=>Xe(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Ye("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Je()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Oe(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",X=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),Y=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(Y,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=V(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ke({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:z.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[z]);r.useEffect(()=>{F!=="In-Progress"&&D&&t(Ze())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&X&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,X,n,a,t]);const J=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:J}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(M(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:J}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(M(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:Y,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(M(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-Ckwdhq4C.js";import{a as v}from"./sentry-aFjQa0wD.js";import{h as U,g as B,u as j,j as y,N as z,n as P,i as W,o as te,p as x}from"./core-DDFcSPsn.js";import{eX as k,Q7 as A,PP as h,zq as E,zi as q,zm as R,zb as K,PR as M,zs as ae,ze as Q,zv as X,zr as C}from"./zeni-epic-state-BcyaAx36.js";import{z as V,a8 as G,bM as oe,af as O,bD as H,bN as le,m as J,y as Y,bO as pe,bP as se}from"./index-CgwSp4D3.js";import"./mui-BSNq34yE.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-BEGnchZS.js";import re from"./NotFoundScreen-CLypooWD.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]="708deb45-2270-4d0d-9bda-a6469f51c20c",e._sentryDebugIdIdentifier="sentry-dbid-708deb45-2270-4d0d-9bda-a6469f51c20c")}catch{}})();const T="bill-approval-rule-update",ie=P(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(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(G(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),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 g={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(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...g})},_="bill-approval-rule-update",de=P(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(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(G(le)),ue=()=>{const e=y(o=>k(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=>k(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),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 g={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(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...g})},fe=P(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=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=f=>{const g=[];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}}),m=w.concat(S);g.push({action:s.stepType.selectedOption,actors:m,operator:m.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g},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(X(!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(Q(!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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t})}const me=P(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=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=m=>{const b=[];return m.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,g=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const m=i.comparator.selectedOption;s.amount={type:"amount",comparator:m,min:m==="less_than"?void 0:i.min,max:m==="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=g?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const m={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(m))}else{const m={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(m))}},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(X(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(ge,{}):c.jsx(ye,{})}function ge(){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(Z(),v.useEffect(()=>{l||(d(!0),p(Q(!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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(me,{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($,{})}),c.jsx(x,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(x,{path:"*",element:c.jsx(re,{})})]})}export{De as B};
1
+ import{j as c}from"./liveblocks-DxxjGfPC.js";import{a as v}from"./sentry-BpQCK5If.js";import{h as U,g as B,u as j,j as y,N as z,n as P,i as W,o as te,p as x}from"./core-B-oTPJV8.js";import{eX as k,Q7 as A,PP as h,zq as E,zi as q,zm as R,zb as K,PR as M,zs as ae,ze as Q,zv as X,zr as C}from"./zeni-epic-state-HC9UoYd1.js";import{z as V,a8 as G,bM as oe,af as O,bD as H,bN as le,m as J,y as Y,bO as pe,bP as se}from"./index-BU7vvomP.js";import"./mui-DOSI1h7F.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CCb9hYob.js";import re from"./NotFoundScreen-CHiFDKSx.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]="708deb45-2270-4d0d-9bda-a6469f51c20c",e._sentryDebugIdIdentifier="sentry-dbid-708deb45-2270-4d0d-9bda-a6469f51c20c")}catch{}})();const T="bill-approval-rule-update",ie=P(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(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(G(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),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 g={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(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...g})},_="bill-approval-rule-update",de=P(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(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(G(le)),ue=()=>{const e=y(o=>k(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=>k(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),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 g={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(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...g})},fe=P(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=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=f=>{const g=[];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}}),m=w.concat(S);g.push({action:s.stepType.selectedOption,actors:m,operator:m.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g},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(X(!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(Q(!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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t})}const me=P(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=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=m=>{const b=[];return m.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,g=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const m=i.comparator.selectedOption;s.amount={type:"amount",comparator:m,min:m==="less_than"?void 0:i.min,max:m==="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=g?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const m={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(m))}else{const m={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(m))}},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(X(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(ge,{}):c.jsx(ye,{})}function ge(){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(Z(),v.useEffect(()=>{l||(d(!0),p(Q(!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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(me,{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($,{})}),c.jsx(x,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(x,{path:"*",element:c.jsx(re,{})})]})}export{De as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-Ckwdhq4C.js";import{h as J,u as se,g as K,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-DDFcSPsn.js";import{eX as W,Pp as Ue,bs as kt,Kd as oa,bq as wt,bJ as pe,Pq as At,yI as Ct,zX as $e,zf as la,bn as De,Pr as sa,Ps as ra,c6 as ca,Pt as da,kx as Bt,Pu as xt,Pv as Et,Aw as Ge,yX as Be,Pw as ua,yw as tt,Px as pa,EB as ma,yA as ba,yG as Dt,Py as Ie,Pz as Me,zY as Ne,PA as ha,PB as ga,z$ as Oe,PC as ya,Ac as Sa,PD as Pt,zI as at,zN as fa,PE as Ia,PF as ue,PG as jt,PH as Tt,PI as Ft,gp as va,z0 as Le,cA as Rt,PJ as ka,fz as wa,PK as Aa,PL as Ca,fE as Vt,fC as $t,PM as ze,PN as Ba,PO as xa,N7 as Ze,PP as Ea,N8 as oe,N9 as He,PQ as Da,PR as Pa,PS as ja,zP as nt,zM as Ta,PT as Fa,PU as Ra,PV as Va,zy as $a,PW as La,PX as _a,PY as Ua,co as Lt,cQ as _t,kI as Ga,bP as Ma,bo as Ut,bQ as Gt,xO as Na,PZ as Oa,Eo as za,Eu as Za,ub as Ha,zZ as Wa,AD as Qa,kV as fe,P_ as qa,P$ as Mt,ln as Ja,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ka,Q0 as Xa,Q1 as ve,js as Ya,Q2 as ot,Q3 as en,jw as tn,jR as an,AR as nn,Q4 as on,lg as ln,AH as sn,Q5 as lt,AL as rn,AQ as cn,AN as dn,AF as un,Q6 as zt,yR as pn,Q7 as mn,Q8 as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as In,l5 as vn,AJ as kn,jC as wn,lu as An,Q9 as Cn,ju as Bn,rt as xn,Qa as En,zE as Dn,bK as Pn,bt as jn,LX as Tn,cT as Fn,cS as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-BcyaAx36.js";import{m as me,z as $,I as ke,$ as We,Q as le,e as y,aR as xe,y as re,o as x,J as Pe,f as D,bi as Ln,s as H,a3 as Qe,v as E,Z as we,bj as rt,bk as ct,bl as _n,ak as Un,H as Gn,aL as Mn,D as Zt,a as qe,K as Je,bm as Nn,at as Ht,bn as On,Y as zn,h as Wt,a8 as Zn,bo as Hn,bp as Wn,bq as Qn,br as qn,bs as Jn,bt as Kn,bu as Xn,bv as Yn,bw as ei,A as ti,bx as ai,bd as ni,by as ii,bz as oi,i as li}from"./index-CgwSp4D3.js";import{n as _,S as si}from"./mui-BSNq34yE.js";import{A as dt}from"./AddressScreen-DIAMV5NV.js";import{g as ie,a as je,i as Qt,V as Ke,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-AcOlPn9O.js";import{a as f}from"./sentry-aFjQa0wD.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CYe1ZjKR.js";import{u as qt}from"./useInitialThreadRequest-DbDztg-_.js";import Ee from"./NotFoundScreen-CLypooWD.js";import{D as ui}from"./DrawerScreen-DRCNRfxe.js";import{M as Jt}from"./MobileAppDrawer-dE23MOLW.js";import{F as Kt}from"./FeaturePreviewScreen-B2gZeqUb.js";import{S as Te}from"./SetupPagesScreen-0Rmn0ujO.js";import{B as pi}from"./BillPayApprovalRoutes-DyNet4Dh.js";import{FallBackRoute as mi}from"./ScreenRoutes-CVaUWXvd.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.js";import"./analyticsHelper-DyTlv1-T.js";import"./routePaths-DCyoygy_.js";import"./BusinessVerificationPageScreen-hhu22D-k.js";import"./ReimbursementApprovalRuleDetailScreen-BEGnchZS.js";import"./getLocaleForTenant-BO5EnrD4.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]="4bef7b5a-b1a7-45fd-bfdf-a35ee2ce3456",e._sentryDebugIdIdentifier="sentry-dbid-4bef7b5a-b1a7-45fd-bfdf-a35ee2ce3456")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(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=De(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}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(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(Ie({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=J(),t=se(),l=K(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=v(z=>W(z)),s=v(z=>Ue(z,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,I]=f.useState(!1),[P,C]=f.useState(!1),[B,U]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:Q}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(xe.zeniAssistConfig),w=oa(o),O=wt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||M||s.allApprovers.find(z=>z.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,O,M,o.isZeni,w,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",L,F,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,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(Pe,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:Q,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({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)}}})(Mn);function A({appContent:e}){const t=se(),l=J(),{billId:n}=ae(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(xe.zeniAssistConfig),P=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=v(R=>W(R)),[B,U]=f.useState(!1),[j,G]=f.useState(!1),[L,k]=f.useState(!1),[Q,N]=f.useState(),w=v(R=>Me(R,m,g,n));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=v(R=>Ue(R,n??""));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{O==="Not-Started"&&(u&&j?G(!1):!u&&B&&U(!1))},[n]),f.useEffect(()=>{B||n==null||u||(U(!0),t(Ct(n,h,P,!1)),j||(G(!0),t($e(!1,h,P,b,n)))),u&&!j&&(G(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(Q,m,n))},onCancelClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ha({file:Q,billId:n}))}},ee=f.useCallback(()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(C.tenantEmailDomain);t(Ie({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})},[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(Ee,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(pt,{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(mt,{}):null,L?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:fi(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 Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-DxxjGfPC.js";import{h as J,u as se,g as K,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-B-oTPJV8.js";import{eX as W,Pp as Ue,bs as kt,Kd as oa,bq as wt,bJ as pe,Pq as At,yI as Ct,zX as $e,zf as la,bn as De,Pr as sa,Ps as ra,c6 as ca,Pt as da,kx as Bt,Pu as xt,Pv as Et,Aw as Ge,yX as Be,Pw as ua,yw as tt,Px as pa,EB as ma,yA as ba,yG as Dt,Py as Ie,Pz as Me,zY as Ne,PA as ha,PB as ga,z$ as Oe,PC as ya,Ac as Sa,PD as Pt,zI as at,zN as fa,PE as Ia,PF as ue,PG as jt,PH as Tt,PI as Ft,gp as va,z0 as Le,cA as Rt,PJ as ka,fz as wa,PK as Aa,PL as Ca,fE as Vt,fC as $t,PM as ze,PN as Ba,PO as xa,N7 as Ze,PP as Ea,N8 as oe,N9 as He,PQ as Da,PR as Pa,PS as ja,zP as nt,zM as Ta,PT as Fa,PU as Ra,PV as Va,zy as $a,PW as La,PX as _a,PY as Ua,co as Lt,cQ as _t,kI as Ga,bP as Ma,bo as Ut,bQ as Gt,xO as Na,PZ as Oa,Eo as za,Eu as Za,ub as Ha,zZ as Wa,AD as Qa,kV as fe,P_ as qa,P$ as Mt,ln as Ja,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ka,Q0 as Xa,Q1 as ve,js as Ya,Q2 as ot,Q3 as en,jw as tn,jR as an,AR as nn,Q4 as on,lg as ln,AH as sn,Q5 as lt,AL as rn,AQ as cn,AN as dn,AF as un,Q6 as zt,yR as pn,Q7 as mn,Q8 as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as In,l5 as vn,AJ as kn,jC as wn,lu as An,Q9 as Cn,ju as Bn,rt as xn,Qa as En,zE as Dn,bK as Pn,bt as jn,LX as Tn,cT as Fn,cS as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-HC9UoYd1.js";import{m as me,z as $,I as ke,$ as We,Q as le,e as y,aR as xe,y as re,o as x,J as Pe,f as D,bi as Ln,s as H,a3 as Qe,v as E,Z as we,bj as rt,bk as ct,bl as _n,ak as Un,H as Gn,aL as Mn,D as Zt,a as qe,K as Je,bm as Nn,at as Ht,bn as On,Y as zn,h as Wt,a8 as Zn,bo as Hn,bp as Wn,bq as Qn,br as qn,bs as Jn,bt as Kn,bu as Xn,bv as Yn,bw as ei,A as ti,bx as ai,bd as ni,by as ii,bz as oi,i as li}from"./index-BU7vvomP.js";import{n as _,S as si}from"./mui-DOSI1h7F.js";import{A as dt}from"./AddressScreen-Bnw-q9qt.js";import{g as ie,a as je,i as Qt,V as Ke,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-e1trJnvt.js";import{a as f}from"./sentry-BpQCK5If.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CZxITSCv.js";import{u as qt}from"./useInitialThreadRequest-ji5lalBJ.js";import Ee from"./NotFoundScreen-CHiFDKSx.js";import{D as ui}from"./DrawerScreen-Bya9lr4Z.js";import{M as Jt}from"./MobileAppDrawer-DcqtBaJ_.js";import{F as Kt}from"./FeaturePreviewScreen-Dn_zg2p2.js";import{S as Te}from"./SetupPagesScreen-BC3BoXD_.js";import{B as pi}from"./BillPayApprovalRoutes-DBMfRYXl.js";import{FallBackRoute as mi}from"./ScreenRoutes-Ctwfcc9a.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";import"./analyticsHelper-DWC4hX57.js";import"./routePaths-DwDsjUCb.js";import"./BusinessVerificationPageScreen-B8VFGhUV.js";import"./ReimbursementApprovalRuleDetailScreen-CCb9hYob.js";import"./getLocaleForTenant-CI2a05yW.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]="4bef7b5a-b1a7-45fd-bfdf-a35ee2ce3456",e._sentryDebugIdIdentifier="sentry-dbid-4bef7b5a-b1a7-45fd-bfdf-a35ee2ce3456")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(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=De(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}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(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(Ie({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=J(),t=se(),l=K(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=v(z=>W(z)),s=v(z=>Ue(z,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,I]=f.useState(!1),[P,C]=f.useState(!1),[B,U]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:Q}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(xe.zeniAssistConfig),w=oa(o),O=wt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||M||s.allApprovers.find(z=>z.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,O,M,o.isZeni,w,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",L,F,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,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(Pe,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:Q,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({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)}}})(Mn);function A({appContent:e}){const t=se(),l=J(),{billId:n}=ae(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(xe.zeniAssistConfig),P=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=v(R=>W(R)),[B,U]=f.useState(!1),[j,G]=f.useState(!1),[L,k]=f.useState(!1),[Q,N]=f.useState(),w=v(R=>Me(R,m,g,n));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=v(R=>Ue(R,n??""));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{O==="Not-Started"&&(u&&j?G(!1):!u&&B&&U(!1))},[n]),f.useEffect(()=>{B||n==null||u||(U(!0),t(Ct(n,h,P,!1)),j||(G(!0),t($e(!1,h,P,b,n)))),u&&!j&&(G(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(Q,m,n))},onCancelClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ha({file:Q,billId:n}))}},ee=f.useCallback(()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(C.tenantEmailDomain);t(Ie({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})},[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(Ee,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(pt,{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(mt,{}):null,L?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:fi(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 Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(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 pt=_.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-Ckwdhq4C.js";import{a as V}from"./sentry-aFjQa0wD.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-DDFcSPsn.js";import{I as ce,Q as ue,aR as de,z,J as le,f as B,af as x,h as E,bI as pe,at as me,v as P,au as M}from"./index-CgwSp4D3.js";import{PX as fe,eX as G,tC as ye,Kg as Se,zy as ge,CZ as Ie,FK as he,Gn as be,Hn as Te,Qi as De,Qj as Oe,Qk as Ce,Ql as ke,Qm as Ve,MJ as we,Pk as Ae,MY as Ne,E1 as Fe,MZ as _e,E5 as ve,ld as xe,gh as Ee,gg as ze,gf as Be,rC as Pe,rt as Me,rq as Re,l5 as Ue,tL as Le,tJ as R,bE as U,tX as L,cy as je}from"./zeni-epic-state-BcyaAx36.js";import{n as Ge}from"./mui-BSNq34yE.js";import{d as j}from"./routePaths-DCyoygy_.js";import{M as Qe}from"./MobileAppDrawer-dE23MOLW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="7b2b6979-99d1-446a-ac45-e71b8ec5ad4a",t._sentryDebugIdIdentifier="sentry-dbid-7b2b6979-99d1-446a-ac45-e71b8ec5ad4a")}catch{}})();const Ze=Ge.div`
1
+ import{j as C}from"./liveblocks-DxxjGfPC.js";import{a as V}from"./sentry-BpQCK5If.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-B-oTPJV8.js";import{I as ce,Q as ue,aR as de,z,J as le,f as B,af as x,h as E,bI as pe,at as me,v as P,au as M}from"./index-BU7vvomP.js";import{PX as fe,eX as G,tC as ye,Kg as Se,zy as ge,CZ as Ie,FK as he,Gn as be,Hn as Te,Qi as De,Qj as Oe,Qk as Ce,Ql as ke,Qm as Ve,MJ as we,Pk as Ae,MY as Ne,E1 as Fe,MZ as _e,E5 as ve,ld as xe,gh as Ee,gg as ze,gf as Be,rC as Pe,rt as Me,rq as Re,l5 as Ue,tL as Le,tJ as R,bE as U,tX as L,cy as je}from"./zeni-epic-state-HC9UoYd1.js";import{n as Ge}from"./mui-DOSI1h7F.js";import{d as j}from"./routePaths-DwDsjUCb.js";import{M as Qe}from"./MobileAppDrawer-DcqtBaJ_.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="7b2b6979-99d1-446a-ac45-e71b8ec5ad4a",t._sentryDebugIdIdentifier="sentry-dbid-7b2b6979-99d1-446a-ac45-e71b8ec5ad4a")}catch{}})();const Ze=Ge.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-Ckwdhq4C.js";import{a as l}from"./sentry-aFjQa0wD.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-DDFcSPsn.js";import{X as ge,db as be,z as ye,dc as Pe,de as z,df as Ie,b9 as W,J as we,f as $,dg as H,dq as Ee,a as ke,h as Ae,a8 as Te,dj as xe,dk as Ue,a3 as _e,dn as Oe,b5 as ve,dp as Qe}from"./index-CgwSp4D3.js";import{gl as Fe,eW as G,eX as $e,fq as De,iK as Le,iG as Ve,eY as B,g6 as je,f$ as qe,g3 as N,g7 as Re,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-BcyaAx36.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-BSNq34yE.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.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]="0275720c-b4a0-46b1-8194-58db51514fa4",e._sentryDebugIdIdentifier="sentry-dbid-0275720c-b4a0-46b1-8194-58db51514fa4")}catch{}})();const X="chat-response-generated",Y="cards/ask",J="card_policy_hero";function D(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Xe=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):D(i);return{onEventReceived:(n,t)=>{if(n===X&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Re(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(qe()),m(function(n){return`/${n}/${Y}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ye=ee.pageTitle,Je=Z.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>$e(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Ye:A,subtitle:I?Ke:Je}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${Y}/${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}.${X}`),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"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))},[j,q,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(Xe,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(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(Ze,{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)}})})})]})},Ze=L(Ge)`
1
+ import{j as g}from"./liveblocks-DxxjGfPC.js";import{a as l}from"./sentry-BpQCK5If.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-B-oTPJV8.js";import{X as ge,db as be,z as ye,dc as Pe,de as z,df as Ie,b9 as W,J as we,f as $,dg as H,dq as Ee,a as ke,h as Ae,a8 as Te,dj as xe,dk as Ue,a3 as _e,dn as Oe,b5 as ve,dp as Qe}from"./index-BU7vvomP.js";import{gl as Fe,eW as G,eX as $e,fq as De,iK as Le,iG as Ve,eY as B,g6 as je,f$ as qe,g3 as N,g7 as Re,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-HC9UoYd1.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-DOSI1h7F.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.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]="0275720c-b4a0-46b1-8194-58db51514fa4",e._sentryDebugIdIdentifier="sentry-dbid-0275720c-b4a0-46b1-8194-58db51514fa4")}catch{}})();const X="chat-response-generated",Y="cards/ask",J="card_policy_hero";function D(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Xe=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):D(i);return{onEventReceived:(n,t)=>{if(n===X&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Re(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(qe()),m(function(n){return`/${n}/${Y}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ye=ee.pageTitle,Je=Z.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>$e(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Ye:A,subtitle:I?Ke:Je}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${Y}/${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}.${X}`),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"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))},[j,q,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(Xe,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(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(Ze,{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)}})})})]})},Ze=L(Ge)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-Ckwdhq4C.js";import{u as me,j as i,h as le,g as he,i as Ve,N as oa,s as _t,n as Pe,t as An,o as ts,p as ce}from"./core-DDFcSPsn.js";import{f8 as Pt,RT as ns,fk as wt,bt as Fe,RU as rs,RV as ss,eZ as pn,RW as Dn,f6 as _n,RX as Pn,RY as wn,RZ as vn,R_ as Tn,f7 as Fn,fj as xn,R$ as Bn,S0 as cs,fd as os,fc as is,S1 as ds,C2 as Rn,fm as ia,S2 as ls,S3 as us,e$ as ms,e_ as Cs,fz as Ye,ff as Ln,fe as On,S4 as ps,fg as hs,Bz as fs,By as gs,BC as Ss,BE as bs,fs as ys,eW as Un,S5 as Is,S6 as ks,fx as jn,S7 as Es,fy as yt,BK as As,BH as Ds,eX as ge,S8 as qa,fC as xe,fD as Be,fE as Re,gw as da,cv as la,S9 as ua,Sa as vt,uQ as $a,kF as za,Sb as Ya,Ci as ka,fn as Qe,Ck as Tt,kv as Mn,Sc as ma,C6 as _a,Sd as _s,Se as Ps,C9 as Qa,Sf as ws,Qf as Xa,fi as Nn,Cf as Sa,hV as vs,Sg as Vn,f9 as Ca,bo as Ts,Sh as Fs,gh as Ja,gg as et,CO as xs,gf as at,PX as Bs,Si as Hn,co as Gn,cQ as Rs,Qe as wa,Dn as $n,Sj as hn,CZ as Pa,Sk as zn,Do as Ls,QD as Os,Dp as Us,Eu as js,ub as Ms,Eo as Ns,Sl as Vs,Cj as sa,Sm as Hs,Sn as Gs,So as $s,Sp as zs,Sq as Ys,Sr as Ft,Ss as Ks,Cz as Yn,Cs as Zs,St as Ws,gy as qs,CI as Kn,CM as Zn,gx as Qs,Su as Xs,D9 as Wn,Sv as Js,Sw as ec,Sx as ac,CK as qn,Cv as Qn,Cc as Xn,CE as Jn,CC as er,CG as tc,Sy as ar,Sz as nc,fu as rc,fv as sc,fw as cc,SA as tt,fo as tr,cS as xt,SB as oc,SC as ic,SD as dc,SE as lc,CU as It,Dg as uc,Dc as mc,CQ as Cc,De as pc,D4 as hc,D6 as fc,SF as nr,Dm as Ga,Kd as gc,SG as Sc,SH as bc,SI as yc,SJ as rr,SK as Ic,DJ as kc,CY as sr,CT as Ne,CX as Ec,SL as Ac,SM as Dc,C3 as _c,SN as cr,fh as or,SO as Pc,C5 as wc,C4 as fn,SP as vc,SQ as Tc,SR as Fc,MK as xc,SS as Bt,ST as Bc,xR as ir,ld as Rc,hL as Lc,DO as Oc,SU as dr,f3 as Uc,f4 as jc,SV as Mc,dj as Nc,fl as Vc,DE as Hc,Dy as qe,bs as Gc,bJ as $c,cA as zc,bK as Yc,LX as Kc}from"./zeni-epic-state-BcyaAx36.js";import{I as Le,cq as lr,s as we,cr as ur,cs as mr,ct as Zc,a as Je,$ as Rt,cu as Wc,cv as qc,X as Cr,c as pr,_ as hr,v as ye,Q as ue,e as K,aq as ya,cw as fr,cx as Qc,cy as Xc,z as te,y as va,cf as nt,cz as Jc,cA as eo,cB as ao,Z as Ta,aR as Ke,bs as Lt,cC as to,D as Fa,n as rt,m as Ot,f as J,a8 as st,cD as no,bF as ba,cE as kt,cF as ro,J as Ut,cG as so,at as gr,a3 as Et,cH as co,Y as Sr,h as br,cI as oo,cJ as io,cK as lo,cL as uo,cM as mo,cN as Co,o as Ka,cO as po,cP as ho,cQ as ht,A as fo,cR as go,cS as So,cT as bo,cU as yo,cV as Io,i as ko}from"./index-CgwSp4D3.js";import{n as He,D as yr,S as Eo}from"./mui-BSNq34yE.js";import{a as r}from"./sentry-aFjQa0wD.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CYe1ZjKR.js";import{M as Ie}from"./MobileAppDrawer-dE23MOLW.js";import{d as jt}from"./recharts-DQxuWpcO.js";import{g as _e,a as Ba,b as Ir,c as Oe,d as Ue,e as Xe,f as ea,h as aa,A as Ao,i as Mt,P as Do,j as Nt,s as Ia,k as kr,l as ca,m as Er,n as _o,o as Ar,p as Po,S as gn}from"./SetupPagesScreen-0Rmn0ujO.js";import{u as Dr}from"./useInitialThreadRequest-DbDztg-_.js";import ct from"./NotFoundScreen-CLypooWD.js";import{u as Vt}from"./useChargeCardPusherEvents-DcKydMhz.js";import{n as Sn}from"./utils-B36TjS8C.js";import{t as wo}from"./AddressScreen-DIAMV5NV.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./analyticsHelper-DyTlv1-T.js";import"./routePaths-DCyoygy_.js";import"./BusinessVerificationPageScreen-hhu22D-k.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]="37cc87da-9aaf-41ff-976a-ab3db272268a",e._sentryDebugIdIdentifier="sentry-dbid-37cc87da-9aaf-41ff-976a-ab3db272268a")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Pr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>ns(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:bn}}}=Je.getLocalizedStrings(),To=e=>Ln(e,!1),Fo=e=>On(e.name,!1);function xo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(rs()),a(ss()),a(pn())},[a]);const v=i(A=>Dn(A.cardPolicyState)),m=i(A=>_n(A.cardPolicyState)),M=i(A=>Pn(A.cardPolicyState)),B=i(A=>wn(A.cardPolicyState)),R=i(A=>vn(A.cardPolicyState)),p=i(A=>Tn(A.cardPolicyState)),h=i(A=>Fn(A.cardPolicyState)),T=i(A=>Pt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),w=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(xn())},[a,v]),Pr();const E=i(A=>Bn(A.createCardPolicyState)),U=i(A=>cs(A.createCardPolicyState)),y=i(A=>os(A.cardPolicyState)),k=i(A=>is(A.cardPolicyState)),x=i(A=>ds(A.createCardPolicyState)),d=i(A=>Rn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>m.map(To),[m]),j=r.useMemo(()=>h.map(Fo),[h]),H=r.useMemo(()=>d.cards.filter(A=>!lr(A.status.code)).map(_r),[d.cards]),O=v==="Completed"&&d.fetchState==="Completed"&&w==="Completed";r.useEffect(()=>{O&&x==null&&a(ls({cardsMasterList:H,defaultRequireReceiptAmount:l,suggestedAllowMerchants:M,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[w,a,O,x,H,l,M,B,R,p]);const L=r.useMemo(()=>jt(A=>{a(wt(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),$=E.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const A=we(n.state?.pathnameStackToGoBack),W=A.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(A=>{a(us(A))},[a]),I=r.useCallback(A=>{const W=ur(A);a(ms({templates:[W]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(Cs(A))},[a]),Z=r.useCallback(()=>{a(pn())},[a]),X=r.useRef($);r.useEffect(()=>{const A=X.current;X.current=$,$==="Completed"&&A!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?E.error?.message??bn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:bn.createPageTitle,onBackClick:D,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Zc,{formDraft:x,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:y,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:u,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(oa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Bo}}}=Je.getLocalizedStrings(),Ro=e=>Ln(e,!1),Lo=e=>On(e.name,!1);function Oo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),b=Le(),g=Fe(b?.loggedInUserRoleMap),[S,P]=r.useState(!1),u=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ps(o)),M=i(o=>Dn(o.cardPolicyState)),B=i(o=>_n(o.cardPolicyState)),R=i(o=>Pn(o.cardPolicyState)),p=i(o=>wn(o.cardPolicyState)),h=i(o=>vn(o.cardPolicyState)),T=i(o=>Tn(o.cardPolicyState)),l=i(o=>Fn(o.cardPolicyState)),w=i(o=>Pt(o.cardPolicyState)),E=i(o=>Rn(o)),U=i(o=>a!=null?hs(o.cardPolicyState,a):void 0),y=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?fs(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(gs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(xn())},[s,M]),Pr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{E.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[E.fetchState,s]);const x=r.useMemo(()=>B.map(Ro),[B]),d=r.useMemo(()=>l.map(Lo),[l]),f=r.useMemo(()=>E.cards.filter(o=>!lr(o.status.code)).map(_r),[E.cards]);Rt({isDataReady:y!=null});const j=r.useMemo(()=>{if(y!=null)return Wc({draft:y,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[y,f,x,d,k,R,p,h,T]),[H,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||H!=null||j==null||(L.current=!0,O(j))},[H,j]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=m.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),A=o.poppedPathname??G;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const A=ur(o);s(Ss(A)),s(bs(a))},[s,a]),Z=r.useRef(D);r.useEffect(()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?m.updateFetchState.error?.message??Bo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(oa,{to:"..",replace:!0}):H!=null&&M==="Completed"&&E.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(qc,{templateName:m.template?.name??"",formDraft:H,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:v,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:v})]})}function wr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function vr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(ys(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=Je.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),u=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=C(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Is(_)),R=i(_=>Bn(_.createCardPolicyState)),p=i(_=>ks(_.createCardPolicyState)),h=i(_=>p==null?[]:jn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,l=i(_=>Es(_.createCardPolicyState)),w=ya(R.fetchState);r.useEffect(()=>{if(w==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:l,kind:"created_policy"}))});else if(w==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:Je.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,l,h,w]);const E=B.fetchState.fetchState;r.useEffect(()=>{E!=="Not-Started"&&E!=="Error"||a(As())},[a,E]);const U=B.archiveFetchState.fetchState,y=ya(U);r.useEffect(()=>{y==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,y]);const k=r.useMemo(()=>B.templates.map(No),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=k.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=Cr(),A=pr(),W=hr(),ne=i(oe=>Un(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=vr("card_policy"),ve=r.useMemo(()=>wr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=W&&A&&Z!=null&&!X,re=r.useCallback(oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Z]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:b,isFileUploadEnabled:F}),f=v&&d!=null?c.jsx(fr,{...d}):null,j=m&&f==null,H=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(Ds(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Qc,{onBackClick:H,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{policies:k,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:H,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:M})]})}function Ho(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),b=Le(),g=Fe(b?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(K.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(K.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),l=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:v,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),w=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(q=>da(q,s.companyId)),U=la(E.controllers),{creditAccount:y,creditAccountRepayment:k}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&l&&m,f=i(q=>vt(q,n,d,l)),[j,H]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Z]),r.useEffect(()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(H(!0),t(ka(n,d,!1)))},[j,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Mn())},[y.fetchState,k.fetchState,t,l,m,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Xe(l,T,w,m),W=Ba(l,m,g,y,k),ne=Ir(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Jc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:y,classListFetchState:x,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Tr="charge-card-transaction-update",Fr="charge-card-transaction-created",xr="charge-card-transaction-declined",Br="charge-card-transaction-updated",Rr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Go="charge-card-department-updated",Lr="charge-card-repayment-completed",Or="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ra],zo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(_s({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Yo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(M=>ge(M)),{useFeatureGate:b}=ue(),{isFeatureEnabled:g}=b(K.isCardsCommentingEnabled),[S,P]=r.useState(!1),u=i(M=>ma(M)),C=Dr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback(()=>{const M=we(t.state?.pathnameStackToGoBack),B=M.poppedPathname??Ko(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(Vt({events:ha(v,$o),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(zo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(eo,{onBackClick:F})}const Ko=e=>`/${e}/cards`,Zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ke.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Ps(I,s)),l=T.chargeCard,w=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:E}=ue(),{isFeatureEnabled:U}=E(K.isChargeCardFeatureEnabled),{isFeatureEnabled:y}=E(K.isDebitCardFeatureEnabled),k=Re(y,R),x=Oe({isDebitCardFeatureEnabled:y,isBankingOnlyTenant:k}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),j=xe(R),H=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:U,isBookKeepingTenant:H,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&w!=="In-Progress"&&w!=="Completed"&&(t(Qa()),P(!0)),u===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,T.fetchState,S,w]);const $=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(ws({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,l?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Nn(I.userState,B.userId)),G=()=>{l?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),v(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=I=>{M(I)};if(w!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Xo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(qo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=vs(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const g=Vn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let u=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ts())||C,showMenuIcon:u,shippingAddress:b,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(xs(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(Fs({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(to),Qo=He.div`
1
+ import{j as c}from"./liveblocks-DxxjGfPC.js";import{u as me,j as i,h as le,g as he,i as Ve,N as oa,s as _t,n as Pe,t as An,o as ts,p as ce}from"./core-B-oTPJV8.js";import{f8 as Pt,RT as ns,fk as wt,bt as Fe,RU as rs,RV as ss,eZ as pn,RW as Dn,f6 as _n,RX as Pn,RY as wn,RZ as vn,R_ as Tn,f7 as Fn,fj as xn,R$ as Bn,S0 as cs,fd as os,fc as is,S1 as ds,C2 as Rn,fm as ia,S2 as ls,S3 as us,e$ as ms,e_ as Cs,fz as Ye,ff as Ln,fe as On,S4 as ps,fg as hs,Bz as fs,By as gs,BC as Ss,BE as bs,fs as ys,eW as Un,S5 as Is,S6 as ks,fx as jn,S7 as Es,fy as yt,BK as As,BH as Ds,eX as ge,S8 as qa,fC as xe,fD as Be,fE as Re,gw as da,cv as la,S9 as ua,Sa as vt,uQ as $a,kF as za,Sb as Ya,Ci as ka,fn as Qe,Ck as Tt,kv as Mn,Sc as ma,C6 as _a,Sd as _s,Se as Ps,C9 as Qa,Sf as ws,Qf as Xa,fi as Nn,Cf as Sa,hV as vs,Sg as Vn,f9 as Ca,bo as Ts,Sh as Fs,gh as Ja,gg as et,CO as xs,gf as at,PX as Bs,Si as Hn,co as Gn,cQ as Rs,Qe as wa,Dn as $n,Sj as hn,CZ as Pa,Sk as zn,Do as Ls,QD as Os,Dp as Us,Eu as js,ub as Ms,Eo as Ns,Sl as Vs,Cj as sa,Sm as Hs,Sn as Gs,So as $s,Sp as zs,Sq as Ys,Sr as Ft,Ss as Ks,Cz as Yn,Cs as Zs,St as Ws,gy as qs,CI as Kn,CM as Zn,gx as Qs,Su as Xs,D9 as Wn,Sv as Js,Sw as ec,Sx as ac,CK as qn,Cv as Qn,Cc as Xn,CE as Jn,CC as er,CG as tc,Sy as ar,Sz as nc,fu as rc,fv as sc,fw as cc,SA as tt,fo as tr,cS as xt,SB as oc,SC as ic,SD as dc,SE as lc,CU as It,Dg as uc,Dc as mc,CQ as Cc,De as pc,D4 as hc,D6 as fc,SF as nr,Dm as Ga,Kd as gc,SG as Sc,SH as bc,SI as yc,SJ as rr,SK as Ic,DJ as kc,CY as sr,CT as Ne,CX as Ec,SL as Ac,SM as Dc,C3 as _c,SN as cr,fh as or,SO as Pc,C5 as wc,C4 as fn,SP as vc,SQ as Tc,SR as Fc,MK as xc,SS as Bt,ST as Bc,xR as ir,ld as Rc,hL as Lc,DO as Oc,SU as dr,f3 as Uc,f4 as jc,SV as Mc,dj as Nc,fl as Vc,DE as Hc,Dy as qe,bs as Gc,bJ as $c,cA as zc,bK as Yc,LX as Kc}from"./zeni-epic-state-HC9UoYd1.js";import{I as Le,cq as lr,s as we,cr as ur,cs as mr,ct as Zc,a as Je,$ as Rt,cu as Wc,cv as qc,X as Cr,c as pr,_ as hr,v as ye,Q as ue,e as K,aq as ya,cw as fr,cx as Qc,cy as Xc,z as te,y as va,cf as nt,cz as Jc,cA as eo,cB as ao,Z as Ta,aR as Ke,bs as Lt,cC as to,D as Fa,n as rt,m as Ot,f as J,a8 as st,cD as no,bF as ba,cE as kt,cF as ro,J as Ut,cG as so,at as gr,a3 as Et,cH as co,Y as Sr,h as br,cI as oo,cJ as io,cK as lo,cL as uo,cM as mo,cN as Co,o as Ka,cO as po,cP as ho,cQ as ht,A as fo,cR as go,cS as So,cT as bo,cU as yo,cV as Io,i as ko}from"./index-BU7vvomP.js";import{n as He,D as yr,S as Eo}from"./mui-DOSI1h7F.js";import{a as r}from"./sentry-BpQCK5If.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CZxITSCv.js";import{M as Ie}from"./MobileAppDrawer-DcqtBaJ_.js";import{d as jt}from"./recharts-CP2XLGhX.js";import{g as _e,a as Ba,b as Ir,c as Oe,d as Ue,e as Xe,f as ea,h as aa,A as Ao,i as Mt,P as Do,j as Nt,s as Ia,k as kr,l as ca,m as Er,n as _o,o as Ar,p as Po,S as gn}from"./SetupPagesScreen-BC3BoXD_.js";import{u as Dr}from"./useInitialThreadRequest-ji5lalBJ.js";import ct from"./NotFoundScreen-CHiFDKSx.js";import{u as Vt}from"./useChargeCardPusherEvents-BhEJ6Y-2.js";import{n as Sn}from"./utils-BnUMtQnE.js";import{t as wo}from"./AddressScreen-Bnw-q9qt.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./analyticsHelper-DWC4hX57.js";import"./routePaths-DwDsjUCb.js";import"./BusinessVerificationPageScreen-B8VFGhUV.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]="37cc87da-9aaf-41ff-976a-ab3db272268a",e._sentryDebugIdIdentifier="sentry-dbid-37cc87da-9aaf-41ff-976a-ab3db272268a")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Pr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>ns(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:bn}}}=Je.getLocalizedStrings(),To=e=>Ln(e,!1),Fo=e=>On(e.name,!1);function xo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(rs()),a(ss()),a(pn())},[a]);const v=i(A=>Dn(A.cardPolicyState)),m=i(A=>_n(A.cardPolicyState)),M=i(A=>Pn(A.cardPolicyState)),B=i(A=>wn(A.cardPolicyState)),R=i(A=>vn(A.cardPolicyState)),p=i(A=>Tn(A.cardPolicyState)),h=i(A=>Fn(A.cardPolicyState)),T=i(A=>Pt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),w=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(xn())},[a,v]),Pr();const E=i(A=>Bn(A.createCardPolicyState)),U=i(A=>cs(A.createCardPolicyState)),y=i(A=>os(A.cardPolicyState)),k=i(A=>is(A.cardPolicyState)),x=i(A=>ds(A.createCardPolicyState)),d=i(A=>Rn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>m.map(To),[m]),j=r.useMemo(()=>h.map(Fo),[h]),H=r.useMemo(()=>d.cards.filter(A=>!lr(A.status.code)).map(_r),[d.cards]),O=v==="Completed"&&d.fetchState==="Completed"&&w==="Completed";r.useEffect(()=>{O&&x==null&&a(ls({cardsMasterList:H,defaultRequireReceiptAmount:l,suggestedAllowMerchants:M,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[w,a,O,x,H,l,M,B,R,p]);const L=r.useMemo(()=>jt(A=>{a(wt(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),$=E.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const A=we(n.state?.pathnameStackToGoBack),W=A.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(A=>{a(us(A))},[a]),I=r.useCallback(A=>{const W=ur(A);a(ms({templates:[W]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(Cs(A))},[a]),Z=r.useCallback(()=>{a(pn())},[a]),X=r.useRef($);r.useEffect(()=>{const A=X.current;X.current=$,$==="Completed"&&A!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?E.error?.message??bn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:bn.createPageTitle,onBackClick:D,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Zc,{formDraft:x,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:y,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:u,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(oa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Bo}}}=Je.getLocalizedStrings(),Ro=e=>Ln(e,!1),Lo=e=>On(e.name,!1);function Oo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),b=Le(),g=Fe(b?.loggedInUserRoleMap),[S,P]=r.useState(!1),u=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ps(o)),M=i(o=>Dn(o.cardPolicyState)),B=i(o=>_n(o.cardPolicyState)),R=i(o=>Pn(o.cardPolicyState)),p=i(o=>wn(o.cardPolicyState)),h=i(o=>vn(o.cardPolicyState)),T=i(o=>Tn(o.cardPolicyState)),l=i(o=>Fn(o.cardPolicyState)),w=i(o=>Pt(o.cardPolicyState)),E=i(o=>Rn(o)),U=i(o=>a!=null?hs(o.cardPolicyState,a):void 0),y=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?fs(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(gs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(xn())},[s,M]),Pr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{E.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[E.fetchState,s]);const x=r.useMemo(()=>B.map(Ro),[B]),d=r.useMemo(()=>l.map(Lo),[l]),f=r.useMemo(()=>E.cards.filter(o=>!lr(o.status.code)).map(_r),[E.cards]);Rt({isDataReady:y!=null});const j=r.useMemo(()=>{if(y!=null)return Wc({draft:y,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[y,f,x,d,k,R,p,h,T]),[H,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||H!=null||j==null||(L.current=!0,O(j))},[H,j]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=m.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),A=o.poppedPathname??G;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const A=ur(o);s(Ss(A)),s(bs(a))},[s,a]),Z=r.useRef(D);r.useEffect(()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?m.updateFetchState.error?.message??Bo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(oa,{to:"..",replace:!0}):H!=null&&M==="Completed"&&E.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(qc,{templateName:m.template?.name??"",formDraft:H,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:v,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:v})]})}function wr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function vr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(ys(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=Je.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),u=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=C(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Is(_)),R=i(_=>Bn(_.createCardPolicyState)),p=i(_=>ks(_.createCardPolicyState)),h=i(_=>p==null?[]:jn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,l=i(_=>Es(_.createCardPolicyState)),w=ya(R.fetchState);r.useEffect(()=>{if(w==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:l,kind:"created_policy"}))});else if(w==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:Je.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,l,h,w]);const E=B.fetchState.fetchState;r.useEffect(()=>{E!=="Not-Started"&&E!=="Error"||a(As())},[a,E]);const U=B.archiveFetchState.fetchState,y=ya(U);r.useEffect(()=>{y==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,y]);const k=r.useMemo(()=>B.templates.map(No),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=k.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=Cr(),A=pr(),W=hr(),ne=i(oe=>Un(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=vr("card_policy"),ve=r.useMemo(()=>wr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=W&&A&&Z!=null&&!X,re=r.useCallback(oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Z]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:b,isFileUploadEnabled:F}),f=v&&d!=null?c.jsx(fr,{...d}):null,j=m&&f==null,H=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(Ds(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Qc,{onBackClick:H,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{policies:k,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:H,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:M})]})}function Ho(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),b=Le(),g=Fe(b?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(K.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(K.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),l=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:v,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),w=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(q=>da(q,s.companyId)),U=la(E.controllers),{creditAccount:y,creditAccountRepayment:k}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&l&&m,f=i(q=>vt(q,n,d,l)),[j,H]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Z]),r.useEffect(()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(H(!0),t(ka(n,d,!1)))},[j,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Mn())},[y.fetchState,k.fetchState,t,l,m,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Xe(l,T,w,m),W=Ba(l,m,g,y,k),ne=Ir(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Jc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:y,classListFetchState:x,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Tr="charge-card-transaction-update",Fr="charge-card-transaction-created",xr="charge-card-transaction-declined",Br="charge-card-transaction-updated",Rr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Go="charge-card-department-updated",Lr="charge-card-repayment-completed",Or="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ra],zo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(_s({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Yo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(M=>ge(M)),{useFeatureGate:b}=ue(),{isFeatureEnabled:g}=b(K.isCardsCommentingEnabled),[S,P]=r.useState(!1),u=i(M=>ma(M)),C=Dr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback(()=>{const M=we(t.state?.pathnameStackToGoBack),B=M.poppedPathname??Ko(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(Vt({events:ha(v,$o),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(zo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(eo,{onBackClick:F})}const Ko=e=>`/${e}/cards`,Zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ke.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Ps(I,s)),l=T.chargeCard,w=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:E}=ue(),{isFeatureEnabled:U}=E(K.isChargeCardFeatureEnabled),{isFeatureEnabled:y}=E(K.isDebitCardFeatureEnabled),k=Re(y,R),x=Oe({isDebitCardFeatureEnabled:y,isBankingOnlyTenant:k}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),j=xe(R),H=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:U,isBookKeepingTenant:H,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&w!=="In-Progress"&&w!=="Completed"&&(t(Qa()),P(!0)),u===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,T.fetchState,S,w]);const $=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(ws({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,l?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Nn(I.userState,B.userId)),G=()=>{l?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),v(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=I=>{M(I)};if(w!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Xo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(qo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=vs(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const g=Vn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let u=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ts())||C,showMenuIcon:u,shippingAddress:b,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(xs(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(Fs({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(to),Qo=He.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${Zo.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-Ckwdhq4C.js";import{a as g}from"./sentry-aFjQa0wD.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-DDFcSPsn.js";import{z as N,bd as P,J as F,f as V,h as j,af as C,be as A,at as L,au as U,v as B}from"./index-CgwSp4D3.js";import{eX as D,gj as M,tC as _,ge as G,c6 as R,Pk as z,bn as Y,rC as q,rq as H,l5 as J,mG as S,Pl as Q,bE as X,cy as h,mQ as Z,mT as $}from"./zeni-epic-state-BcyaAx36.js";import"./mui-BSNq34yE.js";import{d as K}from"./routePaths-DCyoygy_.js";import{M as W}from"./MobileAppDrawer-dE23MOLW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="4ea14f42-67f8-47d7-8da7-3913c6dff3d2",t._sentryDebugIdIdentifier="sentry-dbid-4ea14f42-67f8-47d7-8da7-3913c6dff3d2")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t($())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(Z({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...n,website:u!=""&&u!=null?h(u):void 0,meetingLink:y!=""&&y!=null?h(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?X(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(Q(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(J({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=k(),{tenantEmailDomain:l}=x(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-DxxjGfPC.js";import{a as g}from"./sentry-BpQCK5If.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-B-oTPJV8.js";import{z as N,bd as P,J as F,f as V,h as j,af as C,be as A,at as L,au as U,v as B}from"./index-BU7vvomP.js";import{eX as D,gj as M,tC as _,ge as G,c6 as R,Pk as z,bn as Y,rC as q,rq as H,l5 as J,mG as S,Pl as Q,bE as X,cy as h,mQ as Z,mT as $}from"./zeni-epic-state-HC9UoYd1.js";import"./mui-DOSI1h7F.js";import{d as K}from"./routePaths-DwDsjUCb.js";import{M as W}from"./MobileAppDrawer-DcqtBaJ_.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="4ea14f42-67f8-47d7-8da7-3913c6dff3d2",t._sentryDebugIdIdentifier="sentry-dbid-4ea14f42-67f8-47d7-8da7-3913c6dff3d2")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t($())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(Z({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...n,website:u!=""&&u!=null?h(u):void 0,meetingLink:y!=""&&y!=null?h(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?X(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(Q(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(J({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=k(),{tenantEmailDomain:l}=x(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-Ckwdhq4C.js";import{a}from"./sentry-aFjQa0wD.js";import{u as D,g as v,j as m,N as w}from"./core-DDFcSPsn.js";import{LT as A,eX as _,g1 as L,o9 as O,gs as h,g0 as j,fA as U,L_ as F}from"./zeni-epic-state-BcyaAx36.js";import{u as $,z as c,L as C,a as k,o as H}from"./index-CgwSp4D3.js";import{n as z}from"./mui-BSNq34yE.js";import{t as R}from"./getLocaleForTenant-BO5EnrD4.js";import{g as P,Q as G}from"./QBOConnectionScreen-Bekm7lLE.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.js";import"./empty-DWfA4iTK.js";import"./pdf-lib-BueZLsmu.js";import"./index-EJSKhejW.js";import"./url-B6e2NbkE.js";import"./index-B5_pJz9_.js";import"./decodeURIComponentSafe-CPTO8idR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="3e91a235-535c-45d5-a59e-44e6deebd68c",t._sentryDebugIdIdentifier="sentry-dbid-3e91a235-535c-45d5-a59e-44e6deebd68c")}catch{}})();const Q=z.div`
1
+ import{j as g}from"./liveblocks-DxxjGfPC.js";import{a}from"./sentry-BpQCK5If.js";import{u as D,g as v,j as m,N as w}from"./core-B-oTPJV8.js";import{LT as A,eX as _,g1 as L,o9 as O,gs as h,g0 as j,fA as U,L_ as F}from"./zeni-epic-state-HC9UoYd1.js";import{u as $,z as c,L as C,a as k,o as H}from"./index-BU7vvomP.js";import{n as z}from"./mui-DOSI1h7F.js";import{t as R}from"./getLocaleForTenant-CI2a05yW.js";import{g as P,Q as G}from"./QBOConnectionScreen-CqGga6uy.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";import"./empty-CYpS2TbR.js";import"./pdf-lib-BzFzADtQ.js";import"./index-BHdbfxaf.js";import"./url-fYs6tNor.js";import"./index-DpLVPxVp.js";import"./decodeURIComponentSafe-B-Q21fwV.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="3e91a235-535c-45d5-a59e-44e6deebd68c",t._sentryDebugIdIdentifier="sentry-dbid-3e91a235-535c-45d5-a59e-44e6deebd68c")}catch{}})();const Q=z.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-DxxjGfPC.js";import{z as n}from"./index-BU7vvomP.js";import{g as d}from"./QBOConnectionScreen-CqGga6uy.js";import"./sentry-BpQCK5If.js";import{g as p,N as s}from"./core-B-oTPJV8.js";import"./zeni-epic-state-HC9UoYd1.js";import"./recharts-CP2XLGhX.js";import"./mui-DOSI1h7F.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";import"./empty-CYpS2TbR.js";import"./pdf-lib-BzFzADtQ.js";import"./index-BHdbfxaf.js";import"./url-fYs6tNor.js";import"./index-DpLVPxVp.js";import"./decodeURIComponentSafe-B-Q21fwV.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]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-Ckwdhq4C.js";import{t as yt,A as Ve}from"./AddressScreen-DIAMV5NV.js";import ht from"./NotFoundScreen-CLypooWD.js";import{a as c}from"./sentry-aFjQa0wD.js";import{h as be,g as Ie,u as ne,i as ke,j as _,N as U,l as St,n as et,o as Ct,p as q}from"./core-DDFcSPsn.js";import{z as R,Q as _e,e as H,d as bt,v as Q,J as ae,f as N,h as de,ap as It,Z as kt,A as tt,I as nt,aq as Le,n as Se,ar as _t,o as Re,as as Ne,at as vt,au as Me,av as Ot,aw as Tt}from"./index-CgwSp4D3.js";import{eX as J,fE as ve,fC as Oe,bs as Et,fS as xt,bS as wt,o7 as At,tm as Pt,tp as Dt,MS as jt,MT as Bt,k9 as Ce,kc as at,Mn as Ft,bY as Ut,c6 as le,tQ as Te,tB as Vt,MU as ue,tR as ot,Kg as Lt,ld as st,MV as Rt,MW as Nt,rj as Mt,hq as $t,Mf as ge,hn as Gt,Mg as zt,x_ as Qt,rn as Kt,hf as qt,hi as $e,MX as it,MY as Ht,E1 as Zt,MZ as Yt,E5 as Jt,ts as Wt,M_ as Xt,M$ as en,k7 as tn,ka as nn,u1 as an,tD as rt,tP as on,bE as Ge,cy as sn,u0 as ze,rC as rn,rq as cn,l5 as dn,gh as un,gg as ln,gf as pn,N0 as mn,tv as gn,u2 as fn,u5 as yn,u8 as hn,ue as Sn,cY as Cn}from"./zeni-epic-state-BcyaAx36.js";import{n as Ee}from"./mui-BSNq34yE.js";import{g as bn,h as In,q as oe}from"./QBOConnectionScreen-Bekm7lLE.js";import{u as kn,a as _n}from"./useEmailConnectResultRefresh-CxWjKiVU.js";import{u as vn}from"./useChargeCardPusherEvents-DcKydMhz.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.js";import"./empty-DWfA4iTK.js";import"./pdf-lib-BueZLsmu.js";import"./index-EJSKhejW.js";import"./url-B6e2NbkE.js";import"./index-B5_pJz9_.js";import"./decodeURIComponentSafe-CPTO8idR.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]="134b7e44-105e-4416-9b25-0cf572031d76",t._sentryDebugIdIdentifier="sentry-dbid-134b7e44-105e-4416-9b25-0cf572031d76")}catch{}})();const On=()=>{const t=be(),u=Ie(),s=ne(),[o,l]=c.useState(!1),[r,f]=c.useState(!1),{tenantEmailDomain:C}=ke(),e=R.getSignedInUser(),{useFeatureGate:n}=_e(),{isFeatureEnabled:d}=n(H.isApAgingFeatureEnabled),{isFeatureEnabled:b}=n(H.isArAgingFeatureEnabled),{isFeatureEnabled:S}=n(H.isReferralFeatureEnabled),{isFeatureEnabled:v}=n(H.isExpenseAutomationEnabledV2),{isFeatureEnabled:i}=n(H.isDebitCardFeatureEnabled),k=bt(),y=_(h=>J(h)),m=_(h=>h.onboardingCustomerViewState.fetchState),E=y.excludedResources,x=y.companyId??R.getSignedInUserTenant(C)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const O=ve(i,y),P=Oe(y),p=[],M=E?.resources?.find(h=>h.resource==="/reports/top_expenses")==null,j=E?.resources?.find(h=>h.resource==="/reports/task_card")==null,$=y?.userRole!=null&&Et(y?.userRole),G=E?.resources?.find(h=>h.resource==="/bills")==null&&!$,w=E?.resources?.find(h=>h.resource==="/reimbursements")==null;M===!1&&p.push("top_expenses"),j===!1&&p.push("task_card"),G===!1&&p.push("bill_pay_card","bill_pay_promo_card"),w===!1&&p.push("reimbursement_card","reimbursement_promo_card"),p.push("zeni_accounts_promo_card","treasury_promo_card"),S===!1&&p.push("rewards_card");const B=_(h=>{const D=[];d===!1&&D.push("accounts_payable_aging"),b===!1&&D.push("accounts_receivable_aging"),D.push("zeni_accounts_promo_card","treasury_promo_card"),S===!1&&D.push("rewards_card"),k===!1&&D.push("expense_automation_card");const Z=xt(h,D,e,v,k);return wt(Z.reportsInOrder.map(A=>({fetchState:A.fetchState,error:A.error}))).fetchState});c.useEffect(()=>{m!=="Completed"||o||O||P||(l(!0),s(At(e.userId,x,y.tenantId,!0,!1,p)))},[o,m,O,P,e,y.tenantId,s]);const K=c.useRef(!1),z=c.useCallback(()=>{const h={pathnameStackToGoBack:Q(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};t(O?"../../checking":P?"../../cards":"../../dashboard",{state:h})},[t,u,O,P]),V=c.useCallback(()=>{K.current||(K.current=!0,z())},[z]);return c.useEffect(()=>{const h=setTimeout(()=>f(!0),3e3);return()=>clearTimeout(h)},[]),c.useEffect(()=>{const h=setTimeout(V,6e3);return()=>clearTimeout(h)},[V]),c.useEffect(()=>{O||P||!r||B!=="Completed"&&B!=="Error"||V()},[r,B,O,P,V]),m!=="Completed"?a.jsx(U,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(ae,{analytics:N,onLoad:h=>h.trackPageLoaded(de.Event.onboardingDashboardActivation)}),a.jsx(It,{show:!0,onComplete:V})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Qe=(t,u)=>{const s=new Map(t.map(o=>[o.key,o]));return u.map(o=>{return l=s.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l})},Ke=(t,u)=>{if(t.length===0)return!1;const s=new Map(t.map(o=>[o.key,o]));return u.every(o=>s.get(o)?.status==="ready")},qe=Ee.div`
1
+ import{j as a}from"./liveblocks-DxxjGfPC.js";import{t as yt,A as Ve}from"./AddressScreen-Bnw-q9qt.js";import ht from"./NotFoundScreen-CHiFDKSx.js";import{a as c}from"./sentry-BpQCK5If.js";import{h as be,g as Ie,u as ne,i as ke,j as _,N as U,l as St,n as et,o as Ct,p as q}from"./core-B-oTPJV8.js";import{z as R,Q as _e,e as H,d as bt,v as Q,J as ae,f as N,h as de,ap as It,Z as kt,A as tt,I as nt,aq as Le,n as Se,ar as _t,o as Re,as as Ne,at as vt,au as Me,av as Ot,aw as Tt}from"./index-BU7vvomP.js";import{eX as J,fE as ve,fC as Oe,bs as Et,fS as xt,bS as wt,o7 as At,tm as Pt,tp as Dt,MS as jt,MT as Bt,k9 as Ce,kc as at,Mn as Ft,bY as Ut,c6 as le,tQ as Te,tB as Vt,MU as ue,tR as ot,Kg as Lt,ld as st,MV as Rt,MW as Nt,rj as Mt,hq as $t,Mf as ge,hn as Gt,Mg as zt,x_ as Qt,rn as Kt,hf as qt,hi as $e,MX as it,MY as Ht,E1 as Zt,MZ as Yt,E5 as Jt,ts as Wt,M_ as Xt,M$ as en,k7 as tn,ka as nn,u1 as an,tD as rt,tP as on,bE as Ge,cy as sn,u0 as ze,rC as rn,rq as cn,l5 as dn,gh as un,gg as ln,gf as pn,N0 as mn,tv as gn,u2 as fn,u5 as yn,u8 as hn,ue as Sn,cY as Cn}from"./zeni-epic-state-HC9UoYd1.js";import{n as Ee}from"./mui-DOSI1h7F.js";import{g as bn,h as In,q as oe}from"./QBOConnectionScreen-CqGga6uy.js";import{u as kn,a as _n}from"./useEmailConnectResultRefresh-BckImPOJ.js";import{u as vn}from"./useChargeCardPusherEvents-BhEJ6Y-2.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";import"./empty-CYpS2TbR.js";import"./pdf-lib-BzFzADtQ.js";import"./index-BHdbfxaf.js";import"./url-fYs6tNor.js";import"./index-DpLVPxVp.js";import"./decodeURIComponentSafe-B-Q21fwV.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]="134b7e44-105e-4416-9b25-0cf572031d76",t._sentryDebugIdIdentifier="sentry-dbid-134b7e44-105e-4416-9b25-0cf572031d76")}catch{}})();const On=()=>{const t=be(),u=Ie(),s=ne(),[o,l]=c.useState(!1),[r,f]=c.useState(!1),{tenantEmailDomain:C}=ke(),e=R.getSignedInUser(),{useFeatureGate:n}=_e(),{isFeatureEnabled:d}=n(H.isApAgingFeatureEnabled),{isFeatureEnabled:b}=n(H.isArAgingFeatureEnabled),{isFeatureEnabled:S}=n(H.isReferralFeatureEnabled),{isFeatureEnabled:v}=n(H.isExpenseAutomationEnabledV2),{isFeatureEnabled:i}=n(H.isDebitCardFeatureEnabled),k=bt(),y=_(h=>J(h)),m=_(h=>h.onboardingCustomerViewState.fetchState),E=y.excludedResources,x=y.companyId??R.getSignedInUserTenant(C)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const O=ve(i,y),P=Oe(y),p=[],M=E?.resources?.find(h=>h.resource==="/reports/top_expenses")==null,j=E?.resources?.find(h=>h.resource==="/reports/task_card")==null,$=y?.userRole!=null&&Et(y?.userRole),G=E?.resources?.find(h=>h.resource==="/bills")==null&&!$,w=E?.resources?.find(h=>h.resource==="/reimbursements")==null;M===!1&&p.push("top_expenses"),j===!1&&p.push("task_card"),G===!1&&p.push("bill_pay_card","bill_pay_promo_card"),w===!1&&p.push("reimbursement_card","reimbursement_promo_card"),p.push("zeni_accounts_promo_card","treasury_promo_card"),S===!1&&p.push("rewards_card");const B=_(h=>{const D=[];d===!1&&D.push("accounts_payable_aging"),b===!1&&D.push("accounts_receivable_aging"),D.push("zeni_accounts_promo_card","treasury_promo_card"),S===!1&&D.push("rewards_card"),k===!1&&D.push("expense_automation_card");const Z=xt(h,D,e,v,k);return wt(Z.reportsInOrder.map(A=>({fetchState:A.fetchState,error:A.error}))).fetchState});c.useEffect(()=>{m!=="Completed"||o||O||P||(l(!0),s(At(e.userId,x,y.tenantId,!0,!1,p)))},[o,m,O,P,e,y.tenantId,s]);const K=c.useRef(!1),z=c.useCallback(()=>{const h={pathnameStackToGoBack:Q(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};t(O?"../../checking":P?"../../cards":"../../dashboard",{state:h})},[t,u,O,P]),V=c.useCallback(()=>{K.current||(K.current=!0,z())},[z]);return c.useEffect(()=>{const h=setTimeout(()=>f(!0),3e3);return()=>clearTimeout(h)},[]),c.useEffect(()=>{const h=setTimeout(V,6e3);return()=>clearTimeout(h)},[V]),c.useEffect(()=>{O||P||!r||B!=="Completed"&&B!=="Error"||V()},[r,B,O,P,V]),m!=="Completed"?a.jsx(U,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(ae,{analytics:N,onLoad:h=>h.trackPageLoaded(de.Event.onboardingDashboardActivation)}),a.jsx(It,{show:!0,onComplete:V})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Qe=(t,u)=>{const s=new Map(t.map(o=>[o.key,o]));return u.map(o=>{return l=s.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l})},Ke=(t,u)=>{if(t.length===0)return!1;const s=new Map(t.map(o=>[o.key,o]));return u.every(o=>s.get(o)?.status==="ready")},qe=Ee.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${t=>t.theme.colors.grey4};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-Ckwdhq4C.js";import{i as K,j as k,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as O}from"./core-DDFcSPsn.js";import{eX as U,Nj as We,bE as ia,bo as xe,Ox as Pn,i$ as On,Oy as Kt,Oz as Fn,j2 as Ct,OA as qe,OB as Rn,j7 as Bn,OC as Zt,OD as jn,jb as _t,OE as Qe,OF as Mn,co as yt,OG as Ln,OH as Un,ND as Gn,k3 as Vn,OI as Yn,bn as Xe,OJ as ca,N7 as ce,bc as la,kh as da,oh as ua,k0 as ma,N9 as le,N8 as J,eW as pa,fs as Nn,g3 as kt,OK as $n,OL as zn,OM as ha,ON as Oe,vQ as Me,vR as Le,wc as De,w6 as de,vV as Ue,OO as Kn,OP as Zn,OQ as qn,OR as fa,OS as Fe,OT as Qn,dK as Je,sa as ga,OU as Hn,OV as Wn,OW as Xn,OX as At,Mp as vt,kx as we,wk as It,si as Jn,OY as eo,vS as qt,sd as Ee,s9 as ba,OZ as ge,O_ as to,O$ as Et,Mo as Tt,ui as Ca,P0 as ao,P1 as no,P2 as oo,P3 as xt,uv as so,P4 as ro,vU as Qt,uh as _a,P5 as be,P6 as io,bs as ka,wo as Sa,P7 as co,P8 as lo,P9 as uo,Pa as Dt,wj as mo,Pb as po,vT as Ht,wn as ya,Pc as Ce,Pd as ho,Pe as fo,Pf as Aa,km as va,oe as Ia,kr as Ea,oc as Ta,ob as xa,oa as Da,tG as go,Pg as bo,cS as Co,cT as _o,o7 as ko,fS as So,oo as yo,GB as dt,Gt as Ao,Gx as vo,Ph as Io,Pi as Eo,Pj as To,b5 as et,fK as xo,hJ as Do,gj as wo,oi as Po,jV as Oo,of as Fo,od as Ro,fE as Bo,fC as jo}from"./zeni-epic-state-BcyaAx36.js";import{z as M,a3 as te,v as D,f as T,a as Z,aZ as Mo,$ as Ge,J as Ve,a_ as wa,h as Y,a$ as Lo,I as ke,b0 as Pa,Q as Se,e as B,m as Uo,b1 as Go,b2 as Vo,X as Oa,Z as Fa,c as Ra,_ as Yo,b3 as No,V as $o,aR as Ba,a0 as se,b4 as ja,b5 as Ma,a2 as La,b6 as zo,b7 as Ko,d as Zo,aq as qo,s as Qo,Y as Ho,b8 as Wo,b9 as Xo,ba as Jo,bb as es,bc as _e}from"./index-CgwSp4D3.js";import{n as wt}from"./mui-BSNq34yE.js";import{a as b}from"./sentry-aFjQa0wD.js";import{w as Ua}from"./withTransactionSidePanel-Ct1cyn0I.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as ts}from"./routePaths-DCyoygy_.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CYe1ZjKR.js";import je from"./NotFoundScreen-CLypooWD.js";import{u as Ot}from"./useInitialThreadRequest-DbDztg-_.js";import{t as Va}from"./analyticsHelper-DyTlv1-T.js";import{C as as}from"./CompanyPassportScreen-C4_S1yey.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-i-SLI8wl.js";import{F as os}from"./FeaturePreviewScreen-B2gZeqUb.js";import{R as ss}from"./ReferralListScreen-C6vqx1Yh.js";import"./recharts-DQxuWpcO.js";import"./analytics-extNsQM8.js";import"./plaid-D2PLJyWm.js";import"./dnd-GX-YRNnI.js";import"./stripe-DMRn4zHo.js";import"./lottie-DPGHK2Fp.js";import"./lexical-D9kS-egQ.js";import"./pdf-Cb-UfSwB.js";import"./utils-B36TjS8C.js";import"./TransactionDetailScreen-DYS9pjlk.js";import"./decodeURIComponentSafe-CPTO8idR.js";import"./MobileAppDrawer-dE23MOLW.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]="3376b3f9-9bfc-458e-9bc2-52911de30319",e._sentryDebugIdIdentifier="sentry-dbid-3376b3f9-9bfc-458e-9bc2-52911de30319")}catch{}})();const rs=Ua(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>U(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ia(r):xe(),[r]),p=$(),f=W(),S=k(I=>Pn(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))},[h]),A=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))},[]),x=b.useCallback(I=>{p(Kt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:A,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=$(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>U(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),A=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(Ct(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ua(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>U(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ia(r):xe(),[r]),h=$(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),A=b.useCallback((y,I)=>{h(Zt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(Zt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:A,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=$(),a=W(),t=k(A=>jn(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(A=>U(A)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(A=>{e(Qe({searchString:A}))},[]),h=b.useCallback((A,_)=>{e(Qe({sortKey:_,sortOrder:A}))},[]),p=b.useCallback(A=>{a(`./${A}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(A=>{e(Qe({downloadState:A}))},[]),S=b.useCallback((A,_)=>{e(Qe({selectedDate:A,agingDateSelectionType:_})),e(_t(A))},[]),E=b.useCallback((A,_)=>{e(Mn({nodeId:A,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:A=>A.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Ln(e).accountsInOrder.map((n,o)=>Ya(n,o)),t=Un(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},Na)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Ya(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},Na)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=yt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(je,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=yt(n?.loggedInUserRoleMap),r=k(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
1
+ import{j as d}from"./liveblocks-DxxjGfPC.js";import{i as K,j as k,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as O}from"./core-B-oTPJV8.js";import{eX as U,Nj as We,bE as ia,bo as xe,Ox as Pn,i$ as On,Oy as Kt,Oz as Fn,j2 as Ct,OA as qe,OB as Rn,j7 as Bn,OC as Zt,OD as jn,jb as _t,OE as Qe,OF as Mn,co as yt,OG as Ln,OH as Un,ND as Gn,k3 as Vn,OI as Yn,bn as Xe,OJ as ca,N7 as ce,bc as la,kh as da,oh as ua,k0 as ma,N9 as le,N8 as J,eW as pa,fs as Nn,g3 as kt,OK as $n,OL as zn,OM as ha,ON as Oe,vQ as Me,vR as Le,wc as De,w6 as de,vV as Ue,OO as Kn,OP as Zn,OQ as qn,OR as fa,OS as Fe,OT as Qn,dK as Je,sa as ga,OU as Hn,OV as Wn,OW as Xn,OX as At,Mp as vt,kx as we,wk as It,si as Jn,OY as eo,vS as qt,sd as Ee,s9 as ba,OZ as ge,O_ as to,O$ as Et,Mo as Tt,ui as Ca,P0 as ao,P1 as no,P2 as oo,P3 as xt,uv as so,P4 as ro,vU as Qt,uh as _a,P5 as be,P6 as io,bs as ka,wo as Sa,P7 as co,P8 as lo,P9 as uo,Pa as Dt,wj as mo,Pb as po,vT as Ht,wn as ya,Pc as Ce,Pd as ho,Pe as fo,Pf as Aa,km as va,oe as Ia,kr as Ea,oc as Ta,ob as xa,oa as Da,tG as go,Pg as bo,cS as Co,cT as _o,o7 as ko,fS as So,oo as yo,GB as dt,Gt as Ao,Gx as vo,Ph as Io,Pi as Eo,Pj as To,b5 as et,fK as xo,hJ as Do,gj as wo,oi as Po,jV as Oo,of as Fo,od as Ro,fE as Bo,fC as jo}from"./zeni-epic-state-HC9UoYd1.js";import{z as M,a3 as te,v as D,f as T,a as Z,aZ as Mo,$ as Ge,J as Ve,a_ as wa,h as Y,a$ as Lo,I as ke,b0 as Pa,Q as Se,e as B,m as Uo,b1 as Go,b2 as Vo,X as Oa,Z as Fa,c as Ra,_ as Yo,b3 as No,V as $o,aR as Ba,a0 as se,b4 as ja,b5 as Ma,a2 as La,b6 as zo,b7 as Ko,d as Zo,aq as qo,s as Qo,Y as Ho,b8 as Wo,b9 as Xo,ba as Jo,bb as es,bc as _e}from"./index-BU7vvomP.js";import{n as wt}from"./mui-DOSI1h7F.js";import{a as b}from"./sentry-BpQCK5If.js";import{w as Ua}from"./withTransactionSidePanel-BmZ7t99-.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as ts}from"./routePaths-DwDsjUCb.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CZxITSCv.js";import je from"./NotFoundScreen-CHiFDKSx.js";import{u as Ot}from"./useInitialThreadRequest-ji5lalBJ.js";import{t as Va}from"./analyticsHelper-DWC4hX57.js";import{C as as}from"./CompanyPassportScreen-8iMZOnSy.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-DZ2p1AkJ.js";import{F as os}from"./FeaturePreviewScreen-Dn_zg2p2.js";import{R as ss}from"./ReferralListScreen-D8zOvwWJ.js";import"./recharts-CP2XLGhX.js";import"./analytics-Cg5Z8SGG.js";import"./plaid-DWHfnJbe.js";import"./dnd-Cuk4xXCx.js";import"./stripe-DMRn4zHo.js";import"./lottie-BuADNAKO.js";import"./lexical-C1Fq0m2V.js";import"./pdf-AGHLQmyT.js";import"./utils-BnUMtQnE.js";import"./TransactionDetailScreen-C65Eg3fS.js";import"./decodeURIComponentSafe-B-Q21fwV.js";import"./MobileAppDrawer-DcqtBaJ_.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]="3376b3f9-9bfc-458e-9bc2-52911de30319",e._sentryDebugIdIdentifier="sentry-dbid-3376b3f9-9bfc-458e-9bc2-52911de30319")}catch{}})();const rs=Ua(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>U(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ia(r):xe(),[r]),p=$(),f=W(),S=k(I=>Pn(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))},[h]),A=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))},[]),x=b.useCallback(I=>{p(Kt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:A,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=$(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>U(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),A=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(Ct(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ua(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>U(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ia(r):xe(),[r]),h=$(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),A=b.useCallback((y,I)=>{h(Zt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(Zt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:A,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=$(),a=W(),t=k(A=>jn(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(A=>U(A)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(A=>{e(Qe({searchString:A}))},[]),h=b.useCallback((A,_)=>{e(Qe({sortKey:_,sortOrder:A}))},[]),p=b.useCallback(A=>{a(`./${A}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(A=>{e(Qe({downloadState:A}))},[]),S=b.useCallback((A,_)=>{e(Qe({selectedDate:A,agingDateSelectionType:_})),e(_t(A))},[]),E=b.useCallback((A,_)=>{e(Mn({nodeId:A,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:A=>A.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Ln(e).accountsInOrder.map((n,o)=>Ya(n,o)),t=Un(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},Na)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Ya(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},Na)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=yt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(je,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=yt(n?.loggedInUserRoleMap),r=k(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;