@zeniai/web-app-ui 5.0.35-dev → 5.0.35-dev-betaML1

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 (102) hide show
  1. package/package.json +1 -1
  2. package/dist/assets/AddressRoutes-3WEV_IDY.js +0 -1
  3. package/dist/assets/AddressScreen-DHdHIQtB.js +0 -9
  4. package/dist/assets/AiCfoScreen-BhzTgFiw.js +0 -11
  5. package/dist/assets/BillPayApprovalRoutes-DA0GkQvq.js +0 -1
  6. package/dist/assets/BillPayRoutes-CdGhtak3.js +0 -119
  7. package/dist/assets/BusinessVerificationPageScreen-vJgUTiwv.js +0 -9
  8. package/dist/assets/ChargeCardRoutes-mRwxVyTO.js +0 -71
  9. package/dist/assets/CompanyPassportScreen-BzvRUSQp.js +0 -1
  10. package/dist/assets/ConnectionAuthScreen-hJ5bfIH7.js +0 -11
  11. package/dist/assets/CustomerOnboardingAuthScreen-Bwg5qQD_.js +0 -1
  12. package/dist/assets/CustomerOnboardingRoutes-D3CsgtWm.js +0 -23
  13. package/dist/assets/DashboardRoutes-CCgT0PhE.js +0 -20
  14. package/dist/assets/DefaultTenantHome-DWCxXcon.js +0 -1
  15. package/dist/assets/DomesticWireDetailScreen-CJP0cYEP.js +0 -18
  16. package/dist/assets/DrawerScreen-C1TnyHMa.js +0 -1
  17. package/dist/assets/EntityDetailRoutes-Qmmvv38B.js +0 -1
  18. package/dist/assets/ExpenseAutomationRoutes-DsTzqdwU.js +0 -25
  19. package/dist/assets/FeaturePreviewScreen-CFkQ1SQx.js +0 -1
  20. package/dist/assets/MagicLinkRoutes-bTXqx2sy.js +0 -72
  21. package/dist/assets/MagicLinkSignInScreen-Ch9tkQh6.js +0 -12
  22. package/dist/assets/MobileAppDrawer-DvG5gJ15.js +0 -1
  23. package/dist/assets/NotFoundScreen-D9U9JdnM.js +0 -1
  24. package/dist/assets/NotificationRoutes-BlBO0YR1.js +0 -1
  25. package/dist/assets/PandLWithForecastRoutes-CfToeBbi.js +0 -1
  26. package/dist/assets/PeopleRoutes-Dg-C28lR.js +0 -22
  27. package/dist/assets/PerformanceRoutes-Ye9B8E45.js +0 -1
  28. package/dist/assets/Preview-BbVH-6bH.js +0 -1
  29. package/dist/assets/QBOConnectionScreen-Dy5vR9Yr.js +0 -100
  30. package/dist/assets/ReferralListScreen-B4KYWwen.js +0 -5
  31. package/dist/assets/ReimbursementApprovalRoutes-BEUxHsg8.js +0 -1
  32. package/dist/assets/ReimbursementApprovalRuleDetailScreen-CMPqPG3U.js +0 -1
  33. package/dist/assets/ReimbursementRoutes-C0eCEfY0.js +0 -68
  34. package/dist/assets/ReportsRoutes-tkgmjTD1.js +0 -1
  35. package/dist/assets/RewardsRoutes-CrHzO3g-.js +0 -1
  36. package/dist/assets/ScreenRoutes-CWqttGks.js +0 -2
  37. package/dist/assets/SettingsRoutes-VugGDW7q.js +0 -57
  38. package/dist/assets/SetupPagesScreen-EtV9_VSj.js +0 -29
  39. package/dist/assets/SignInScreen-DO2eKYhp.js +0 -1
  40. package/dist/assets/SignOutScreen-BZasc741.js +0 -9
  41. package/dist/assets/TaskListScreen-W8sHldFK.js +0 -9
  42. package/dist/assets/TaskRoutes-BWfsqYOF.js +0 -9
  43. package/dist/assets/TransactionDetailRoutes-DDz1zqu3.js +0 -1
  44. package/dist/assets/TransactionDetailScreen-BL53vTcK.js +0 -5
  45. package/dist/assets/TransactionListRoutes-9Zbnw9hY.js +0 -1
  46. package/dist/assets/TreasuryRoutes-JC_WOiG_.js +0 -37
  47. package/dist/assets/VendorsRoutes-BTA0FcW-.js +0 -112
  48. package/dist/assets/WiseConfirmationScreen-xODhNhCG.js +0 -12
  49. package/dist/assets/ZeniAccountRoutes-Bob9e5Lf.js +0 -66
  50. package/dist/assets/ZeniAccountStatementScreen-f8D-xrxi.js +0 -9
  51. package/dist/assets/accountMappingHelper-xZvH7myI.js +0 -1
  52. package/dist/assets/analytics-ZBaPMYvi.js +0 -68
  53. package/dist/assets/analyticsHelper-2PTnaCzY.js +0 -1
  54. package/dist/assets/core-DM1rowt8.js +0 -12
  55. package/dist/assets/decodeURIComponentSafe-D0zhq0x7.js +0 -1
  56. package/dist/assets/dnd-C-Lnhdag.js +0 -6
  57. package/dist/assets/empty-CzFL6xhQ.js +0 -1
  58. package/dist/assets/empty-D1U7YTsh.js +0 -1
  59. package/dist/assets/emptyVideoElement-B21ksJRH.js +0 -1
  60. package/dist/assets/epic-BmEhQOaL.js +0 -2
  61. package/dist/assets/favicon-D56XvgAH.ico +0 -0
  62. package/dist/assets/getLocaleForTenant-dha6PIh0.js +0 -1
  63. package/dist/assets/index-Bc34frN_.css +0 -1
  64. package/dist/assets/index-BrzMHfEZ.js +0 -2
  65. package/dist/assets/index-CID5TSpA.js +0 -1
  66. package/dist/assets/index-Cb73b08V.js +0 -71853
  67. package/dist/assets/index-CrSe_x4f.js +0 -1
  68. package/dist/assets/index-DoOZkXVc.js +0 -1
  69. package/dist/assets/index-NBq_W8MN.js +0 -1
  70. package/dist/assets/index-qDQ5flzN.js +0 -3385
  71. package/dist/assets/lexical-C5McV7XP.js +0 -21
  72. package/dist/assets/liveblocks-BjW28Jor.js +0 -54
  73. package/dist/assets/logo192-CqcTe-t4.png +0 -0
  74. package/dist/assets/lottie-Lcmd6dcO.js +0 -2
  75. package/dist/assets/manifest-icT4lOF5.json +0 -49
  76. package/dist/assets/mui-D2eUyq0K.js +0 -109
  77. package/dist/assets/pathToGoBack-BzV0PkoJ.js +0 -1
  78. package/dist/assets/pdf-CnfUruOo.js +0 -13
  79. package/dist/assets/pdf-lib-w9llU0aY.js +0 -39
  80. package/dist/assets/plaid-BjrBUBaH.js +0 -2
  81. package/dist/assets/pusher-C56PjV1T.js +0 -1
  82. package/dist/assets/react-BAZC123N.js +0 -34
  83. package/dist/assets/react-Bj4rG6HA.js +0 -19
  84. package/dist/assets/react-C1mjYQZn.js +0 -22
  85. package/dist/assets/react-CZyOFSB_.js +0 -21
  86. package/dist/assets/react-DJgT0dzX.js +0 -19
  87. package/dist/assets/react-DTlWrv59.js +0 -17
  88. package/dist/assets/recharts-Boi6IWgf.js +0 -65
  89. package/dist/assets/routePaths-BlrSfedH.js +0 -1
  90. package/dist/assets/sentry-Cxwj7RZa.js +0 -500
  91. package/dist/assets/stripe-DMRn4zHo.js +0 -1
  92. package/dist/assets/url-DP5jm42y.js +0 -1
  93. package/dist/assets/url-YwSHsZ0_.js +0 -6
  94. package/dist/assets/useAskAiCfoHostNavButtonProps-amkrtBpQ.js +0 -1
  95. package/dist/assets/useDeviceId-VctjeswX.js +0 -13
  96. package/dist/assets/useFetchSuggestedQuestionsWhenReady-gIKSMWV6.js +0 -1
  97. package/dist/assets/useInitialThreadRequest-BrNpT4Fp.js +0 -1
  98. package/dist/assets/utils-DnmDUA9M.js +0 -36
  99. package/dist/assets/web-vitals-D_vxw1oG.js +0 -1
  100. package/dist/assets/withTransactionSidePanel-DwkjF9He.js +0 -21
  101. package/dist/assets/zeni-epic-state-CsIRSm_7.js +0 -14
  102. package/dist/index.html +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/web-app-ui",
3
- "version": "5.0.35-dev",
3
+ "version": "5.0.35-dev-betaML1",
4
4
  "files": [
5
5
  "dist/**/*"
6
6
  ],
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BjW28Jor.js";import{A as d}from"./AddressScreen-DHdHIQtB.js";import i from"./NotFoundScreen-D9U9JdnM.js";import"./sentry-Cxwj7RZa.js";import{n as s,o as r}from"./core-DM1rowt8.js";import"./zeni-epic-state-CsIRSm_7.js";import"./recharts-Boi6IWgf.js";import"./index-Cb73b08V.js";import"./mui-D2eUyq0K.js";import"./analytics-ZBaPMYvi.js";import"./plaid-BjrBUBaH.js";import"./dnd-C-Lnhdag.js";import"./stripe-DMRn4zHo.js";import"./lottie-Lcmd6dcO.js";import"./lexical-C5McV7XP.js";import"./pdf-CnfUruOo.js";import"./utils-DnmDUA9M.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]="4bd15e18-5b5f-4be1-8d33-8bd696c76da2",t._sentryDebugIdIdentifier="sentry-dbid-4bd15e18-5b5f-4be1-8d33-8bd696c76da2")}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,9 +0,0 @@
1
- import{j as d}from"./liveblocks-BjW28Jor.js";import{a as h}from"./sentry-Cxwj7RZa.js";import{j as T,h as _,u as j,l as E,g as B,k as M}from"./core-DM1rowt8.js";import{Z as $,h as D,z as L,A as K,s as N,w as J,e as C,g as m,n as z,j as b,p as F}from"./index-Cb73b08V.js";import{J0 as k,gN as R,eN as U,J1 as G,c0 as O,J2 as V,k7 as q}from"./zeni-epic-state-CsIRSm_7.js";import{n as H}from"./mui-D2eUyq0K.js";import Z from"./NotFoundScreen-D9U9JdnM.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]="43202249-3e57-4c1a-b03d-a37439c68050",e._sentryDebugIdIdentifier="sentry-dbid-43202249-3e57-4c1a-b03d-a37439c68050")}catch{}})();const Q=H.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `,W=M(function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=U(e),a=t.roleMap!=null&&G(t.roleMap),r=i||c==="user_address"||O(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=V(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:r,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=k(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:r}},function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const r=i.state,n=F(r?.pathnameStackToGoBack);let s=n.poppedPathname??w();const u=r?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(s=`${s}?${g}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const r=X(a);e(q({addressType:c,addressToCreate:r})),C?.trackSaveAddressClicked(m.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}})(z);function de({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),r=_(),n=j(),{addressId:s,addressType:u}=E(),g=$(),A=D(),I=L.getSignedInUser(),[p,v]=h.useState(s==null),f=B(S=>s!=null?k(S,s).fetchState:"Not-Started"),x=K();if(I==null)throw Error("Can't access address page without signing in...");const P=S=>S.trackPageLoaded(s!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return h.useEffect(()=>{p||s==null||(v(!0),r(R(s,!1)))},[p,s,r]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!p&&f==="Not-Started"||p&&f==="In-Progress"?d.jsx(N,{fetchState:f,style:{backgroundColor:A.colors.grey5}}):s!=null&&f==="Error"?(a(`${w(1)}/new`,{replace:!0}),d.jsx(d.Fragment,{})):d.jsxs(d.Fragment,{children:[d.jsx(J,{analytics:C,onLoad:P}),d.jsx(Q,{windowSize:g,children:d.jsx(W,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):d.jsx(Z,{})}const w=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},X=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{de as A,X as t};
@@ -1,11 +0,0 @@
1
- import{j as h}from"./liveblocks-BjW28Jor.js";import{a as r}from"./sentry-Cxwj7RZa.js";import{h as oe,j as ne,u as ie,g as G,l as re,k as le}from"./core-DM1rowt8.js";import{G as ce,cF as ue,z as de,Z as me,cG as pe,cH as fe,cI as he,cJ as q,w as Se,e as v,I as j,cK as ge,cL as Ce,g as be,a1 as ke,cM as we,N as Ie,q as Ee,p as V,aX as Pe,cN as Te}from"./index-Cb73b08V.js";import{fE as ye,f3 as H,eN as _e,hr as xe,Py as ve,eM as Ue,hB as Ae,hx as Qe,fu as Oe,fo as Fe,fh as De,fl as $,fp as Me,fq as Be,fr as Le,fs as Ne,ft as Re}from"./zeni-epic-state-CsIRSm_7.js";import{D as Ge,n as U,P as je,S as Ve}from"./mui-D2eUyq0K.js";import{p as $e}from"./pathToGoBack-BzV0PkoJ.js";import"./recharts-Boi6IWgf.js";import"./analytics-ZBaPMYvi.js";import"./plaid-BjrBUBaH.js";import"./dnd-C-Lnhdag.js";import"./stripe-DMRn4zHo.js";import"./lottie-Lcmd6dcO.js";import"./lexical-C5McV7XP.js";import"./pdf-CnfUruOo.js";import"./utils-DnmDUA9M.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new s.Error().stack;i&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[i]="b928bef5-11f1-46d5-9585-5b758c6b37e1",s._sentryDebugIdIdentifier="sentry-dbid-b928bef5-11f1-46d5-9585-5b758c6b37e1")}catch{}})();const W="chat-response-generated",qe=le(function(s,i){const a=H(s),m=i.isSubmitting;return{showSampleQuestions:i.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:m,isNewChatSession:i.sessionFromUrl==="new_chat"||i.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ie}/tableDownload`,emailLinkQuestion:i.emailLinkQuestion,autoSubmitEmailLinkQuestion:i.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:i.onEmailLinkQuestionProcessed,isFileUploadEnabled:i.isFileUploadEnabled,isUploadPromoVisible:i.isUploadPromoVisible,onUploadPromoClose:i.onUploadPromoClose}},function(s,i){const{location:a,currentTenant:m,userId:d,navigate:p,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:S,setIsAiCfoOpen:l}=i;return{onEventReceived:(e,o)=>{if(e===W&&typeof o.text=="string"&&typeof o.metadata=="object"){const n=o,c=Be(n.type),t=n.metadata.chat_session_id??null,{currentChatSession:I,currentQuestionAnswer:g,currentQuestionAnswerSummary:E}=q(S,t);c!=="answer"?v.trackAICFOChatResponseGenerated(c,g?.question.questionText??"",n.text,t,Te(E,I),n.metadata.message_id??null):v.trackAICFOChatAnswerGenerated(n.text,g?.question.questionText??"",(n.follow_up_questions?.length??0)>0,!!n.assumptions,!!n.insights,n.visualization!=null,Le(n.visualization?.type??"")??null,t,n.summarized_title,n.metadata.message_id??null),s(Ne({chatSessionId:n.metadata.chat_session_id,responseType:c,fetchState:{fetchState:"Completed",error:void 0}})),s(Re({chatSessionId:n.metadata.chat_session_id,answerPayload:n,userId:d}))}},onSubmit:(e,o,n,c)=>{e&&Pe(s,e,o,f,S,d,c,n)},updateCurrentInput:e=>{s($(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{s(Me(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=V(a.state?.pathnameStackToGoBack),o=e.poppedPathname??$e(1);p(o,{state:{...a.state,pathnameStackToGoBack:e.newStack}}),s($(""))},togglePageView:()=>{const e=V(a.state?.pathnameStackToGoBack),o=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(o,{state:{...a.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),l(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{f!=null&&s(De());const e=Ee(a.state?.pathnameStackToGoBack,a.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,o)=>{s(Fe({questionAnswerId:e,isCollapsed:o}))},onMenuClick:i.onMenuClick}})(ke(we)),dt=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:i}=ce(),a=oe(),m=ne(),d=ie(),[p,f]=r.useState(!1);r.useEffect(()=>{a(ye())},[a]);const{customPageTitle:S}=ue(),l=G(u=>H(u)),e=de.getSignedInUser(),{session_id:o}=re(),n=me(),c=G(u=>_e(u)),t=l.uiState.currentChatSessionId,I=c.tenantEmailDomain,{handleUploadPromoClose:g,isUploadPromoVisible:E}=pe({isFileUploadEnabled:s,tenantEmailDomain:I}),A=fe({currentTenant:c,currentChatSessionId:t,aiCfoView:l}),C=d.state,b=C?.aiCfoInitialQuestion,Q=!!C?.aiCfoShouldSubmit,[z,P]=r.useState(null),[J,T]=r.useState(!1),O=r.useRef(!1);r.useEffect(()=>{O.current||b==null||b===""||(P(b),T(Q),O.current=!0)},[b,Q]);const K=r.useCallback(()=>{P(null),T(!1)},[]),F=r.useMemo(()=>new URLSearchParams(d.search),[d.search]),D=F.get("ref")??C?.aiCfoRef,y=F.get("emailRefId")??C?.aiCfoEmailRefId,M=r.useRef(!1);r.useEffect(()=>{M.current||D!=="month-end-email"||y==null||t!=null||e==null||(a(xe("controller",e.userId,y,"MONTH_END_EMAIL")),M.current=!0)},[D,y,t,a,e]);const k=l.uiState.lastContextMessage;r.useEffect(()=>{k!=null&&k!==""&&t!=null&&(P(k),T(!0),a(ve()))},[k,t,a]);const Z=c.masterTOSInfo,w=Z?.isMasterTOSAccepted??!1,{visitedSessions:B}=he(t),_=l.fetchState,x=l.uiState.chatSessionsNextPageToken.hasMore||!l.uiState.chatSessionsFirstPageFetched,L=t!=null?l.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",N=t==null||(l.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=l.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:X}=q(R,t),Y=X.length===0;r.useEffect(()=>{w||m("../dashboard",{state:{...d.state,message:"open_ai_cfo_drawer"}})},[w]),r.useEffect(()=>{t!=null&&o!==t&&m(`../ai-cfo/${t}`,{state:{...d.state}})},[t,o]),r.useEffect(()=>{o!=null&&t==null&&o!=="new_chat"&&o!=="explore"&&a(Ue({sessionId:o,agentId:"controller"}))},[]);const ee=r.useMemo(()=>({events:B.map(u=>`private-chat-${u}.${W}`),eventCallback:(u,se,ae)=>ae.onEventReceived(u,se)}),[B]);if(r.useEffect(()=>{_!=="In-Progress"&&x&&a(Ae())},[_,x,a]),r.useEffect(()=>{t!=null&&L!=="In-Progress"&&N&&e!=null&&_==="Completed"&&!x&&a(Qe(t,e.userId))},[L,N,t,e,a]),e==null||o==null)throw Error("Can't access AI Controller page without signing in...");const te=t!=null&&l.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return h.jsxs(We,{children:[h.jsx(Se,{analytics:v,onLoad:u=>u.trackPageLoaded(be.Event.aiCFOPage)}),j(n)&&A.drawerElement,h.jsx(qe,{...ee,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,openOnboardingPage:()=>f(!0),userId:e.userId,setIsAiCfoOpen:i,navigate:m,sessionFromUrl:o,location:d,isSubmitting:te,isEmptyChatWithSession:Y,customPageTitle:S,currentTenant:c,emailLinkQuestion:z??void 0,autoSubmitEmailLinkQuestion:J,onEmailLinkQuestionProcessed:K,onMenuClick:j(n)?A.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:E,onUploadPromoClose:g}),h.jsx(Ge,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ze,style:{width:`${ge}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:h.jsx(He,{onClick:u=>u.stopPropagation(),children:h.jsx(Ce,{isTOSAccepted:w,acceptMasterTOSState:l.masterTOSAcceptanceState,customPageTitle:S,onCloseClick:()=>f(!1),onCompleteClick:()=>{w||c.userRoleId==null||a(Oe(c.userRoleId)),f(!1)}})})})]})},He=U(Ve)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,We=U.div`
6
- height: 100vh;
7
- width: 100%;
8
- `,ze=U(je)`
9
- box-shadow: ${({theme:s})=>s.colors.elevation2};
10
- color: ${({theme:s})=>s.colors.grey4};
11
- `;export{dt as default};
@@ -1 +0,0 @@
1
- import{j as l}from"./liveblocks-BjW28Jor.js";import{a as y}from"./sentry-Cxwj7RZa.js";import{j as U,u as j,h as B,g as v,N as $,k as T,l as N,n as O,o as h}from"./core-DM1rowt8.js";import{eN as L,Mj as A,L$ as b,x9 as w,x3 as F,x7 as x,wY as M,M1 as W,w$ as q,xb as z,xa as C}from"./zeni-epic-state-CsIRSm_7.js";import{h as P,z as k,s as V,a1 as Y,bx as G,aa as _,by as H}from"./index-Cb73b08V.js";import"./mui-D2eUyq0K.js";import{i as J}from"./ReimbursementApprovalRuleDetailScreen-CMPqPG3U.js";import K from"./NotFoundScreen-D9U9JdnM.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]="8315047c-5adc-41aa-ab28-1f6a20b08413",e._sentryDebugIdIdentifier="sentry-dbid-8315047c-5adc-41aa-ab28-1f6a20b08413")}catch{}})();const I="bill-approval-rule-update",Q=T(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:a,location:p}=o;return{onApprovalRulesEventReceived:t=>{t.endsWith(I)&&e(W(!1))},onBackClick:()=>{_(p)?a("../../"):a("../../../bills/setup")},onDeleteRuleClick:t=>{e(M(t))},onEditRuleClick:t=>{t!=null?(e(x(t)),a(`./${t}/edit`)):(e(x()),a("./new"))}}})(Y(G)),X=()=>{const e=U(),o=j(),a=B(),[p,t]=y.useState(!1),[u,s]=y.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>L(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(y.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&a(w())},[g]),y.useEffect(()=>{p||n!=="Not-Started"||(t(!0),a(F(!0)))},[p,n,a]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");y.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),a(x())),e("./new"))},[u,r,a]);const f={events:c.companyId!=null?[`private-${c.companyId}.${I}`]:[],eventCallback:(i,R,m)=>{i.endsWith(I)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx($,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...f})},Z=T(function(e,o){const a=b(e),p=a.billPaySetupApproverViewUpdateData?.type??"approval_create",t=p==="approval_create"&&a.allApprovalRules.length!==0;let u=a.allApprovalRules.length===0;return o.approvalRuleId&&(u=a.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:a,hideUpperBoundField:t,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:a,approvalUpdateDataView:p,approverViewData:t,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(f=>{const i=f.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),R=f.actors.selectedNonUsers.map(S=>{const E=!!J(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(R);g.push({action:f.stepType.selectedOption,actors:m,operator:m.length>1?f.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(w()),s==="approval_update"||d?a("../"):t.allApprovalRules.length===0&&t.fetchState==="Completed"?a("../../setup"):a("../")},onBackClick:()=>{e(w()),s==="approval_update"||d?a("../"):t.allApprovalRules.length===0&&t.fetchState==="Completed"?a("../../setup"):a("../")},onSaveRuleClick:()=>{e(z())},onSaveRuleSuccess:()=>{a("../")}}})(H);function D(){const e=U(),o=B(),a=j(),{approvalRuleId:p}=N(),t=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=y.useState(!1);if(y.useEffect(()=>{n||(c(!0),o(q(!0)))}),y.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),t==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Z,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:a})}function se(){return l.jsxs(O,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(K,{})})]})}export{se as B};
@@ -1,119 +0,0 @@
1
- import{j as a}from"./liveblocks-BjW28Jor.js";import{j as K,h as re,u as Q,l as te,g as k,N as ee,k as X,i as la,n as sa,o as y}from"./core-DM1rowt8.js";import{eN as Z,LB as Ge,bv as At,GE as ra,bo as xt,bD as pe,LC as Bt,wt as Et,xD as Ue,x0 as ca,bn as je,LD as da,LE as ua,c0 as pa,LF as ma,jr as Dt,LG as jt,LH as Tt,yc as Oe,wI as Be,LI as ba,wh as it,LJ as ha,Bo as ga,wl as Sa,wr as Pt,LK as Ie,LL as Ne,xE as ze,LM as ya,LN as fa,xH as Ze,LO as Ia,xU as ka,LP as Ft,xo as ot,xt as va,LQ as wa,LR as ue,LS as Rt,LT as Lt,LU as Vt,fI as Ca,wN as Me,cv as $t,LV as Aa,gD as xa,LW as Ba,LX as Ea,eT as Ut,eR as Mt,LY as He,LZ as Da,L_ as ja,Jk as We,L$ as Ta,Jl as ie,Jm as qe,M0 as Pa,M1 as Fa,M2 as Ra,xv as lt,xs as La,M3 as Va,M4 as $a,M5 as Ua,xe as Ma,M6 as _a,M7 as Ga,M8 as Oa,cj as _t,cL as Gt,jC as Na,bJ as za,bq as Ot,bK as Nt,vz as Za,M9 as Ha,Bb as Wa,Bh as qa,s6 as Ja,xF as Ka,yj as Qa,jP as fe,Ma as Xa,Mb as zt,kh as Ya,jJ as Zt,k2 as Ht,k1 as st,bC as be,bI as en,Mc as tn,Md as ke,il as an,Me as rt,Mf as nn,iq as on,iL as ln,yx as sn,Mg as rn,ka as cn,yn as dn,Mh as ct,yr as un,yw as pn,yt as mn,yl as bn,Mi as Wt,wC as hn,Mj as gn,Mk as Sn,fA as yn,fz as fn,fy as In,jS as kn,k8 as dt,kj as vn,pF as wn,j$ as Cn,yp as An,iw as xn,ko as Bn,Ml as En,io as Dn,pw as jn,Mm as Tn,xk as Pn,bE as Fn,bs as Rn,Il as Ln,cN as Vn,cM as $n,cu as Un,cA as Mn}from"./zeni-epic-state-CsIRSm_7.js";import{h as me,z as L,A as ve,G as Je,a as oe,d as S,aI as Ee,s as ce,o as E,w as Te,e as j,b4 as _n,p as z,N as Ke,q as D,Z as we,b5 as ut,b6 as pt,b7 as Gn,af as On,y as Nn,aC as zn,x as qt,D as Qe,E as Xe,b8 as Zn,ao as Jt,b9 as Hn,H as Wn,g as Kt,a1 as qn,ba as Jn,bb as Kn,bc as Qn,bd as Xn,be as Yn,bf as ei,bg as ti,bh as ai,bi as ni,r as ii,bj as oi,b0 as li,bk as si,bl as ri,a4 as ci}from"./index-Cb73b08V.js";import{n as V,S as di}from"./mui-D2eUyq0K.js";import{A as mt}from"./AddressScreen-DHdHIQtB.js";import{g as ne,a as Pe,i as Qt,V as Ye,b as et,c as ui,v as pi,d as mi,A as he,D as ge}from"./DomesticWireDetailScreen-CJP0cYEP.js";import{a as f}from"./sentry-Cxwj7RZa.js";import{u as tt}from"./useAskAiCfoHostNavButtonProps-amkrtBpQ.js";import{c as at}from"./useFetchSuggestedQuestionsWhenReady-gIKSMWV6.js";import{u as Xt}from"./useInitialThreadRequest-BrNpT4Fp.js";import De from"./NotFoundScreen-D9U9JdnM.js";import{D as bi}from"./DrawerScreen-C1TnyHMa.js";import{M as Yt}from"./MobileAppDrawer-DvG5gJ15.js";import{F as ea}from"./FeaturePreviewScreen-CFkQ1SQx.js";import{S as Re}from"./SetupPagesScreen-EtV9_VSj.js";import{B as hi}from"./BillPayApprovalRoutes-DA0GkQvq.js";import{FallBackRoute as gi}from"./ScreenRoutes-CWqttGks.js";import"./recharts-Boi6IWgf.js";import"./analytics-ZBaPMYvi.js";import"./plaid-BjrBUBaH.js";import"./dnd-C-Lnhdag.js";import"./stripe-DMRn4zHo.js";import"./lottie-Lcmd6dcO.js";import"./lexical-C5McV7XP.js";import"./pdf-CnfUruOo.js";import"./utils-DnmDUA9M.js";import"./analyticsHelper-2PTnaCzY.js";import"./routePaths-BlrSfedH.js";import"./BusinessVerificationPageScreen-vJgUTiwv.js";import"./ReimbursementApprovalRuleDetailScreen-CMPqPG3U.js";import"./getLocaleForTenant-dha6PIh0.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]="c9119454-9dc8-4967-8c2e-72638bc8da4d",e._sentryDebugIdIdentifier="sentry-dbid-c9119454-9dc8-4967-8c2e-72638bc8da4d")}catch{}})();const Si=X(function(e,t){const l=Ge(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=je(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:m,isMarkAsPaidBtnVisible:b}=da(l.billActivities,ua(t.currentTenant),n);d=m,p=b}const h=pa(t.currentTenant?.userRole??[]),g=l.transactionDetails!=null&&ma(l.transactionDetails,h,n);return{billDetails:l,isAccountingClassesEnabled:Dt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Ke}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:h,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:g,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Ie({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Pt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(Sa(l,s))},onSaveRealTimeApprovals:o=>{e(ga(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ha({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(it(l,o.type,"")):e(it(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=Pe(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ba({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Tt({data:i,billId:l})),e(Oe(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(jt({billId:l}))}}})(_n);function yi(){const e=K(),t=re(),l=Q(),{billId:n}=te(),c=me(),r=L.getSignedInUser(),u=ve(),o=k(w=>Z(w)),s=k(w=>Ge(w,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Xt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoOpen:p,setIsAiCfoOpen:h}=Je(),{isAiCfoAccessEnabled:g,onAskAiCfoClick:m}=tt({isAiCfoOpen:p,setIsAiCfoOpen:h,mobileExploreReferrer:"Bill Details"});at({isDataReady:s.fetchState==="Completed"});const b=o?.userRole!=null&&At(o?.userRole),A=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b,[T,I]=f.useState(!1),[v,H]=f.useState(!1),[M,_]=f.useState(!1),{useFeatureGate:F,useDynamicConfig:x}=oe(),{isFeatureEnabled:$}=F(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:U}=F(S.isBillPayCommentingEnabled),{isFeatureEnabled:B}=F(S.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=x(Ee.zeniAssistConfig),W=ra(o),q=xt(o.userRole),J=A&&pe(u?.loggedInUserRoleMap),G=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:le}=F(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=F(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&W===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||J||s.allApprovers.find(w=>w.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,J,o.isZeni,W,r]),f.useEffect(()=>{n!=null&&t(Bt(n))},[n]),f.useEffect(()=>{T||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Et(n??"",$,G,!1)))},[T,s,n,t]),f.useEffect(()=>{v||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(H(!0),t(Ue(!1,$,G,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(ca()))},[v,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(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(ce,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${E.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Te,{analytics:j,onLoad:w=>(se=>{n!=null&&se.trackBillPayBillDetails(n,s.isRecurring)})(w)}),a.jsx(Si,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:U,isRealTimeApprovalEnabled:M,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:le,hasZeniAssistAccess:G,isDetectInsufficientFundsEnabled:B,isAiCfoAccessEnabled:g,onAskAiCfoClick:m})]})}const Se=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,fi={containerWidth:new qt(100,58)},bt=X(function(e,t){const l=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:`${Jt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:E.sp10,paddingRight:E.sp3,paddingBottom:"15px",paddingLeft:E.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ka({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(ze(n))},onDeleteClick:()=>{e(Ia({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(zn);function C({appContent:e}){const t=re(),l=K(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:h}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:g}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:m}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:A}=p(Ee.zeniAssistConfig),T=A.user_ids!=null&&i?.userId!=null&&A.user_ids.includes(i?.userId),I=k(w=>Z(w)),[v,H]=f.useState(!1),[M,_]=f.useState(!1),[F,x]=f.useState(!1),[$,U]=f.useState(),B=k(w=>Ne(w,h,m,n));let O=B.fetchState,W=B.file,q=B.showAutofill;const J=k(w=>Ge(w,n??""));u===!1&&(O=J.fetchState,W=J.transactionDetails?.attachments?.[0],q=!1);const G=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(ze(!0))},[n,t]),f.useEffect(()=>{O==="Not-Started"&&(u&&M?_(!1):!u&&v&&H(!1))},[n]),f.useEffect(()=>{v||n==null||u||(H(!0),t(Et(n,g,T,!1)),M||(_(!0),t(Ue(!1,g,T,b,n)))),u&&!M&&(_(!0),t(Ue(!1,g,T,b,n)))},[v,M,u,n,t]);const le={onOkClick:()=>{if(x(!1),!$)return;const w=W!=null?"replace":"upload";j?.trackInvoiceActionClick(G??"",w,i?.userEmail??"","yes"),t(fa({replaceBillData:!0,billId:n})),t(Ze($,h,n))},onCancelClick:()=>{if(x(!1),!$)return;const w=W!=null?"replace":"upload";j?.trackInvoiceActionClick(G??"",w,i?.userEmail??"","no"),t(ya({file:$,billId:n}))}},Y=f.useCallback(()=>{const w=z(c.state?.pathnameStackToGoBack),se=w.poppedPathname??ne(I.tenantEmailDomain);t(Ie({billId:n})),l(se,{state:{pathnameStackToGoBack:w.newStack}})},[c.state,I.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||J.fetchState==="Error")return a.jsx(De,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(ut,{fallback:Y,children:a.jsxs(Le,{windowSize:o,children:[a.jsx(gt,{}),a.jsx(Ve,{}),a.jsx(bt,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:h,attachmentTitle:void 0,setShowConfirmationPopup:x,setPayload:U,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:G}),a.jsx($e,{windowSize:o,children:a.jsx(pt,{isNewBill:!0})})]})}):a.jsxs(Le,{windowSize:o,children:[o==="small"||q?null:a.jsx(ht,{children:a.jsx(ta,{onClick:Y,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Ve,{}):null,a.jsx(Gn,{}),a.jsx($e,{windowSize:o,children:a.jsx(pt,{isNewBill:n==null})})]});{const w=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(ut,{fallback:Y,children:a.jsxs(Le,{windowSize:o,children:[q&&o!=="small"?a.jsx(gt,{}):null,F?a.jsx(On,{titleComponent:a.jsx(xi,{children:Se.overwriteTitle}),descriptionComponent:a.jsx(Bi,{children:Se.overwriteDescription}),primaryButtonText:Se.buttons.yes,secondaryButtonText:Se.buttons.no,action:le,isEditPopup:!0}):null,o==="small"||q?null:a.jsx(ht,{children:a.jsx(Ii,{})}),o!=="small"?a.jsx(Ve,{}):null,a.jsx(bt,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:q,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:h,attachmentTitle:ki(u,J,B),setShowConfirmationPopup:x,setPayload:U,showActionButtons:vi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:w}),a.jsx($e,{windowSize:o,children:e})]})})}}function Ii(){const{triggerBack:e}=Zn();return a.jsx(ta,{onClick:e,"data-testid":"nav-bar-back-click"})}function ki(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(wi,{children:[a.jsx(Ci,{children:`${Se.recurringBill.recurringCycle}
2
- ${n}/${c}`}),a.jsx(Ai,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const ht=V.div`
3
- margin-bottom: 20px;
4
- margin-top: 20px;
5
- margin-left: ${E.sp5};
6
- position: absolute;
7
- display: flex;
8
- align-items: center;
9
- `,wi=V.div`
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- padding-top: 9px;
14
- gap: ${E.sp2};
15
- margin-bottom: -${E.sp2};
16
- `,Ci=V(Xe.StandardMedium)``,Ai=V(e=>f.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M3.35001 15L3.35001 10.125C3.35001 6.81129 6.0363 4.125 9.35001 4.125H16.475M16.475 4.125L13.85 1.5M16.475 4.125L13.85 6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M20.6 9V13.875C20.6 17.1887 17.9137 19.875 14.6 19.875H7.47501M7.47501 19.875L10.1 22.5M7.47501 19.875L10.1 17.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))`
17
- color: ${e=>e.theme.colors.hero};
18
- height: ${E.sp3};
19
- width: ${E.sp3};
20
- `,ta=V(e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M10 13L5 8L10 3",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})))`
21
- width: ${E.sp3};
22
- height: ${E.sp3};
23
- cursor: pointer;
24
- color: ${e=>e.theme.colors.champion};
25
- &:hover {
26
- color: ${e=>e.theme.colors.primary};
27
- }
28
- `,Le=V.div`
29
- display: flex;
30
- height: 100vh;
31
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
32
- background-color: ${e=>e.theme.colors.grey4};
33
- position: relative;
34
- &::after {
35
- content: "";
36
- position: absolute;
37
- top: 57px;
38
- left: 42%;
39
- width: 1px;
40
- height: calc(100% - 57px);
41
- background-color: ${e=>e.theme.colors.grey2};
42
- pointer-events: none;
43
- z-index: 3;
44
- display: ${e=>e.windowSize==="small"?"none":"block"};
45
- }
46
- `,Ve=V.div`
47
- position: absolute;
48
- top: 56px;
49
- left: 0;
50
- width: 42%;
51
- height: 1px;
52
- background-color: ${e=>e.theme.colors.grey2};
53
- z-index: 3;
54
- `,gt=V.div`
55
- position: fixed;
56
- top: 0;
57
- left: 0;
58
- right: 0;
59
- bottom: 0;
60
- background-color: ${Nn.overlayBackgroundBlack};
61
- z-index: 5;
62
- `,$e=V.div`
63
- display: flex;
64
- flex-direction: column;
65
- width: ${e=>`${fi.containerWidth.value(e.windowSize)}%`};
66
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
67
- `,xi=V(Xe.H6Regular)`
68
- margin-top: ${E.sp7};
69
- padding-left: ${E.sp8};
70
- padding-right: ${E.sp8};
71
- color: ${e=>e.theme.colors.primary};
72
- word-break: break-word;
73
- `,Bi=V(Xe.LargeRegularSp)`
74
- color: ${e=>e.theme.colors.hero};
75
- padding-left: ${E.sp8};
76
- padding-right: ${E.sp8};
77
- margin-bottom: 30px;
78
- margin-top: ${E.sp4};
79
- white-space: pre-line;
80
- `,Ei=X(function(e,t){return{billsReviewView:Ft(e),analytics:t.analytics}},function(e,t){return{onCloseOverlay:()=>{t.navigate("./"),e(ue())},onCloseReviewItem:l=>{e(wa(l))},onProceedForBulkActionClick:(l,n)=>{switch(l){case"send_for_approval":e(va());break;case"approve":case"review":e(ot("approved",n??""));break;case"reject":e(ot("rejected",n??""))}}}})(Hn);function Di(){const e=K(),t=k(n=>n.billsBulkActionViewState.bulkSubmissionFetchState.fetchState),{billsForReview:l}=k(n=>Ft(n));return f.useEffect(()=>{t!=="Completed"&&l.length!==0||e("./")},[t,l.length]),a.jsx(Ei,{navigate:e,analytics:j})}const ae=ja(),aa="bulk-operation-update",_e="bill-approval-rule-update",{spendManagement:ji,common:St}=Qe.getLocalizedStrings(),yt=ji.billPay.bulkActions,Ti=V.div`
81
- display: flex;
82
- min-height: 100%;
83
- width: 100%;
84
- flex: 1 1 auto;
85
- flex-direction: column;
86
- align-items: center;
87
- background-color: ${e=>e.theme.colors.grey4};
88
- `,Pi=X(function(e,t){const l=L.getSignedInUser(),n=je(l),c=Vt(e,ae,t.isBulkActionEnabled,l?.userId);let r=c.allSubTabs;t.isUserHasOnlyBillpayAccess&&t.roleMap&&c.currentTab==="pending_approval"&&(t.roleMap.bill_pay_analyst?r=r.filter(b=>b==="all"||b==="overdue"||b==="rejected"||b==="deleted"):t.roleMap.bill_pay_approver&&(r=r.filter(b=>b==="all"||b==="awaiting_my_approval"||b==="overdue"||b==="rejected"||b==="deleted"))),t.isShowDeletedBillsEnabled===!1&&(r=r.filter(b=>b!=="deleted"));const u=e.entityAutoCompleteState.autoCompleteText.common,o=We(e,"common"),s=e.tenantState.currentTenantId,i=Z(e),d=i?.companyName??"",p={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:s??""},h=e.billListState.downloadUIState.downloadState,g=c.fetchState,m=Ta(e);return{transactionList:t.isShowDeletedBillsEnabled?c.transactions:c.transactions.filter(b=>b.isDeleted===!1),currentTab:c.currentTab,currentSubTab:c.currentSubTab,approvalCount:c.approvalCount,allSubTabs:r,fetchState:g,analytics:j,botEmail:c.billPayBotEmail,searchText:c.searchText,filters:c.filters,vendorSearchAutoCompleteData:{autoCompleteText:u,entityAutoCompleteView:o},downloadParams:{authParams:p,companyName:d,timePeriod:ae,spendManagementEndPoint:`${Ke}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:h,isBulkActionAllowed:c.billListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:c.billListBulkActionInfo?.billsSelectedForBulkAction,allowedBulkActions:c.billListBulkActionInfo?.allowedBulkActions,isZeniUser:n,billPayApprovalRulesAffectedEntityIds:m.affectedEntityIds}},function(e,t){const{navigate:l,currentTenant:n,location:c,period:r}=t,{tenantEmailDomain:u}=n;return{updateTabToState:o=>{e(ue()),e(Rt(o))},onSubtabChange:o=>{e(ue()),e(Lt(o))},onTransactionClick:(o,s)=>{const i=Pe(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);l(i,{state:{pathnameStackToGoBack:d}})},onClickSetupIcon:()=>{const o=Ri(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);l(o,{state:{pathnameStackToGoBack:s}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;j?.trackBillPayNewBill();const s=`/${o}/bill/new`,i=D(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(s,{state:{pathnameStackToGoBack:i}})},onSearchTextChanged:o=>{e(_a(o))},onReloadTransactions:()=>{e(Me(r,!0,t.isShowDeletedBillsEnabled,t.isInternationalWireEnabled)),e(Ma(n.companyId,!0))},onNavigateToSettings:()=>{l("../bills/setup")},onBackClick:()=>{l("../",{relative:"path"})},onFiltersChange:o=>{e(Ua({filters:o})),o.categories.every(s=>s.field!=null&&s.values?.length!==0)&&j.trackSpendManagmentFilterChange("bill_pay",o.categories.map(s=>`${s.field}-${JSON.stringify(s.values)}`))},updateDownloadStateHandler:o=>{o==="In-Progress"&&j.trackSpendManagementDownloadClick("bill_pay"),e($a({uiState:{downloadState:o}}))},updateBulkActionList:o=>{e(Va(o))},removeAllTransactionsFromBulkActionList:()=>{e(ue())},onProceedForBulkActionClick:(o,s)=>{switch(o){case"delete":case"cancel":e(La(o,s??""));break;case"send_for_approval":e(lt("send_for_approval")),t.navigate("./bulk-review");break;case"approve":e(lt("approve")),t.navigate("./bulk-review");break;case"review":e(Ra()),t.navigate("./bulk-review")}},onBillPayApprovalRulesEventReceived:o=>{o.endsWith(_e)&&e(Fa(!1))},onEventReceived:o=>{o===aa&&e(Pa())},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(qe({searchString:o,entityType:"vendor",searchOrigin:"common"})):o.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}}}})(qn(Jn));function Fi(){const{isAiCfoOpen:e,setIsAiCfoOpen:t}=Je(),l=K(),n=re(),c=Q(),r=we(),u=c.state,o=ve(),[s,i]=f.useState(!1),[d,p]=f.useState(null),h=la("/:tenantEmailDomain/bills/bulk-review")!=null;f.useEffect(()=>(u?.tab!=null&&u?.subTab!=null&&(n(Rt(u?.tab)),n(Lt(u?.subTab))),()=>{n(ue())}),[]);const g=L.getSignedInUser(),m=k(P=>Z(P)),{areTenantIdsInSync:b}=Wn(),[A,T]=f.useState(!1),{useFeatureGate:I}=oe(),{isFeatureEnabled:v}=I(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:H}=I(S.isBillPayCommentingEnabled),{isFeatureEnabled:M}=I(S.isReimbursementCommentingEnabled),{isFeatureEnabled:_}=I(S.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:F}=I(S.isBillPayBulkActionEnabled),{isFeatureEnabled:x}=I(S.billPaySetupShowInternationalPaymentByWise),{isFeatureEnabled:$}=I(S.isBillPayDetectInsufficientFundsEnabled),U=k(P=>Vt(P,ae,F,g?.userId)),{isFeatureEnabled:B}=I(S.isDebitCardFeatureEnabled),O=U.fetchState,{isAiCfoAccessEnabled:W,onAskAiCfoClick:q}=tt({isAiCfoOpen:e,setIsAiCfoOpen:t,mobileExploreReferrer:"Bills List"});at({isDataReady:O==="Completed"});const J=!!m.companyBillPayInfo?.info?.isBillPayTOSAccepted,G=!!m.companyBillPayInfo?.info?.isBillPayEnabled,le=k(P=>Ca(P.companyState,m.companyId)),Y=le?.company.featuresActivationInfo.connectedAccountProvider;if(f.useEffect(()=>{!A&&G&&b&&(T(!0),n(Me(ae,!0,v,x)))},[A,ae,b,n]),g==null)throw Error("Can't access address page without signing in...");const w=(P,de)=>{n(Da({uiState:{sortKey:P,sortOrder:de},period:ae}))},se=$t(o?.loggedInUserRoleMap),Fe=pe(o?.loggedInUserRoleMap),Ce=P=>{i(P)},{billsProcessed:N,billsProcessing:Ae}=k(P=>Aa(P));f.useEffect(()=>{N===Ae&&d!=null&&(n(xa({messageSection:"bill_pay_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_bill_",variableValue:N>1?yt.bills:yt.bill},{variableName:"_has_",variableValue:N>1?St.texts.have:St.texts.has},{variableName:"_action_",variableValue:Ba(d)}]})),n(Ea()),setTimeout(()=>{n(Me(ae,!0,v,!0,x))},3e3),p(null))},[N,Ae]);const na={events:m.companyId!=null?[`private-${m.companyId}.${aa}`,`private-${m.companyId}.${_e}`]:[],eventCallback:(P,de,nt)=>{P.endsWith(_e)?nt.onBillPayApprovalRulesEventReceived?.(P):de?.entity_type==="bill"&&(p(de.operation_type),nt.onEventReceived(P))}},ia=Ut(B,m),oa=Mt(m);return c.pathname.endsWith("/bills/")||c.pathname.endsWith("/bills")||c.pathname.endsWith("/bills/bulk-review")?ia===!0||oa===!0?a.jsx(ea,{}):G?a.jsxs(a.Fragment,{children:[O==="Completed"?a.jsx(Te,{analytics:j,onLoad:P=>(de=>de.trackPageLoaded(Kt.Event.billPayHome))(P)}):null,a.jsxs(Ti,{windowSize:r,children:[a.jsx(Yt,{isAppContentDrawerOpen:s,handleDrawerToggle:Ce}),a.jsx(bi,{isOpen:h,drawerLeftMargin:new qt(0,0,300,600),onClose:()=>{l("./"),n(ue())},children:a.jsx(Li,{onClick:P=>P.stopPropagation(),children:a.jsx(Di,{})})}),a.jsx(Pi,{location:c,navigate:l,currentTenant:m,entity:"bill_pay",isBillPayCommentingEnabled:H,isReimbursementCommentingEnabled:M,period:ae,isAdmin:!1,uiState:U.uiState,onColumnSortConfigChanged:w,isUserHasOnlyBillpayAccess:se,isShowDeletedBillsEnabled:v,isShowDeletedReimbursementEnabled:_,isBulkActionEnabled:F,roleMap:o?.loggedInUserRoleMap,onClickMenuIcon:()=>{Ce(!0)},isDownloadEnabled:U.isDownloadEnabled,connectedAccountProvider:Y,bulkSubmissionLimit:U.billBulkSubmissionLimit,bulkSubmissionFetchState:U.billListBulkActionInfo.bulkSubmissionFetchState,isRecurringBillInBulkActionList:U.billListBulkActionInfo.isRecurringBillInBulkActionList,isInternationalWireEnabled:x,isDetectInsufficientFundsEnabled:$,isAiCfoAccessEnabled:W,onAskAiCfoClick:q,...na})]})]}):J===!0&&Fe===!0?a.jsx(ee,{to:"../setup"}):o!=null&&He(m,o.loggedInUserRoleMap)?a.jsx(ee,{to:"../promo"}):a.jsx(ce,{fetchState:O}):a.jsx(De,{})}const Ri=e=>`/${e}/bills/setup`,Li=V(di)`
89
- display: flex;
90
- min-height: 100%;
91
- flex-direction: column;
92
- `,{common:{currency:ye},spendManagement:{billPay:{billDetails:Vi}},appName:$i}=Qe.getLocalizedStrings(),Ui=X(function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=z(t.location.state?.pathnameStackToGoBack);let u=!0;r.poppedPathname?.includes("bills")===!0&&(u=!1);const o=e.entityAutoCompleteState.autoCompleteText.common,s=We(e,"common");let i=`${l?.firstName} ${l?.lastName}`;const d=je(l);t.billId!=null&&t.billDetailsView!=null&&(i=`${t.billDetailsView.createdBy?.firstName??$i} ${t.billDetailsView.createdBy?.lastName??""}`),d||!t.billDetailsView.createdBy?.email?.includes("zeni.ai")||(i="Zeni");const p=t.billDetailsView.editBillInitialDetails?.totalAmount?.amount,h=za(t.billDetailsView.paymentDetailsSection?.paymentType?.method),g=t.currentTenant.createTime,m=Ot(),b=t.sameDayAchDisablementConfig.newTenantTenureLimitMonths,A=g.add(b,"month").isAfter(m),T=!!(t.billDetailsView.billStage==="draft"&&h&&p!=null&&p>0)&&!Nt(p,t.billDetailsView.approvalRules.allApprovalRules,l),I=Z(e);return{billDetails:t.billDetailsView,isAccountingClassesEnabled:Dt(e),billId:t.billId,createdBy:i,createTime:t.billDetailsView?.createTime,authParams:c,transactionAttachmentEndpoint:`${Ke}/transaction_attachment`,analytics:j,showBackButton:u,isAdmin:t.isBillPayAdmin,isSuperAdmin:t.isSuperAdmin,connectedAccountProvider:I.company?.featuresActivationInfo.connectedAccountProvider??"",customerSearchAutoCompleteData:{autoCompleteText:o,entityAutoCompleteView:s},showMarkAsPaidInfo:T,isZeniUser:d,isNewUser:A,sameDayAchDisablementConfig:t.sameDayAchDisablementConfig}},function(e,t){const{billId:l,companyId:n,currentTenant:c,location:r,navigate:u,billDetailsView:o}=t,{tenantEmailDomain:s}=c;return{editVendor:i=>{e(st(i));const d=It(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},chooseNewVendor:i=>{const d=i??t.billDetailsView.addBillAutoFields.tentativeVendorName;d!=null&&e(Zt(d,!1)),e(Ht({localData:{vendorName:i??t.billDetailsView.addBillAutoFields.tentativeVendorName}})),e(st());const p=It(s,void 0,l),h=D(r.state?.pathnameStackToGoBack,r.pathname);u(p,{state:{pathnameStackToGoBack:h}})},onInvoiceUpload:i=>{i!=null&&e(Ze(i,t.isVendorRecommendationEnabled))},updateShowAutofill:i=>{e(ze(i))},onSaveChangesToLocalStore:(i,d,p,h,g)=>{const m=Oi(t.billDetailsView,{...i,paymentDetails:{...i?.paymentDetails,paymentDate:g}},p,d,t.isInternationalPaymentShaVsOurEnabled,h,t.vendor);e(Ya({billDetailLocalData:m,billId:l}))},saveBillDetails:()=>{e(Oe("draft",!1,!1,l)),e(ie("common"))},updateBillDetailSaveBillCode:()=>{e(zt("draft"))},reviewBillDetails:()=>{const i=Mi(s,l),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d,message:"coming_from_edit_page"}})},discardBillDetailsFromLocalStore:({billId:i})=>{e(Ie({billId:i}))},clearBillPayReviewLocalState:()=>e(Xa()),onClickDismiss:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},onClickDiscard:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);u(i,{state:{pathnameStackToGoBack:d}})},setBillDetailPageMode:i=>{if(i==="edit_bill"){let d=window.location.pathname;d=d.concat("/edit");const p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})}},redirectToACHScreen:i=>{e(fe(!1,i));const d=_i(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToWireScreen:i=>{e(fe(!1,i));const d=Gi(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToInternationalScreen:i=>{e(fe(!1,i));const d=Qt(s,l,i),p=D(r.state?.pathnameStackToGoBack,r.pathname);u(d,{state:{pathnameStackToGoBack:p}})},redirectToBillsScreen:()=>{const i=ne(s),d=D(r.state?.pathnameStackToGoBack,r.pathname);e(Ie({})),u(i,{state:{pathnameStackToGoBack:d}})},redirectToBillDetailPage:()=>{t.navigate("../")},deleteBill:()=>{l!=null&&e(Pt(l))},onAttachmentClick:(i,d)=>{const p=Pe(s,i,d);window.open(`${p}`,"_blank")},onBackClick:()=>{const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ne(s);u(d,{state:{pathnameStackToGoBack:i.newStack}})},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(qe({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},addVendorContactEmail(i,d){e(Qa(i,d,l))},onWiseVerifyClick:()=>{let i="";i=Yn()?"https://sandbox.transferwise.tech":"https://wise.com";const d=`${i}/login`;window.open(d,"_blank")},onVendorSelected:i=>{e(Ka(!0,i,l))},onSignUpAccountClick:()=>{t.hasZeniAccountsAdminAccess?window.open(`/${s}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{t.isZeniAccountsUser?window.open(`/${s}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onInternationalWireVerifyClick:()=>{window.open(`/${s}/bills/international-wire`)},onFetchLinkTokenClick:(i,d)=>{e(Ja("bill_pay_detail",i,d))},onEstablishConnectionClick:i=>{e(qa(i,n,"bill_pay_detail","bill_pay"))},onUpdatePaymentAccountStatus:(i,d,p)=>{e(Wa(i,d,"bill_pay","bill_pay_detail",p))},onEstablishConnectionSuccess:()=>{e(Za("bill_pay","bill_pay_detail")),e(Ha({billId:l,withdrawFromAccountId:o.newAddedBillPaymentAccountId,withdrawFromList:o.withdrawFromList}))}}})(Kn);function ft(){const e=K(),t=Q(),l=re(),{billId:n,tenantEmailDomain:c}=te(),{useFeatureGate:r,useDynamicConfig:u}=oe(),{isFeatureEnabled:o,isFeatureGateLoading:s}=r(S.isVendorMagicLinkFeatureEnabled),{isFeatureEnabled:i}=r(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:d}=r(S.isBillPayCommentingEnabled),{isFeatureEnabled:p}=r(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:h}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:g}=r(S.isRecurringBillsFeatureEnabled),{isFeatureEnabled:m}=r(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=r(S.isShaDisabled),{isFeatureEnabled:A}=r(S.isOurDisabled),{isFeatureEnabled:T}=r(S.isBillPayDetectInsufficientFundsEnabled),{configValue:I}=u(Ee.zeniAccountsConfig),v=Ga(I),{configValue:H}=u(Ee.sameDayAchDisablementConfig),M=Oa(H),_=L.getSignedInUser(),F=k(N=>Z(N)),x=k(N=>Ne(N,h,m,n)),$=Xt(F?.companyId,{clearParams:x.fetchState==="Completed"}),{isAiCfoOpen:U,setIsAiCfoOpen:B}=Je(),{isAiCfoAccessEnabled:O,onAskAiCfoClick:W}=tt({isAiCfoOpen:U,setIsAiCfoOpen:B,mobileExploreReferrer:"Bill Details"});at({isDataReady:x.fetchState==="Completed"});const q=F.companyId??L.getSignedInUserTenant(c)?.companyId,J=!!F.companyZeniAccountInfo?.info?.isZeniAccountEnabled,G=ve(),le=_t(G?.loggedInUserRoleMap),Y=Gt(G?.loggedInUserRoleMap),w=pe(G?.loggedInUserRoleMap),se=xt(F.userRole);if(f.useEffect(()=>{n!=null&&l(Bt(n))},[n]),_==null)throw Error("Can't access address page without signing in...");const Fe=k(N=>Na(N.accountState,N.accountListState,"billPayAccountList")),Ce={pathname:"../",search:t.search};return x.isDeleted===!0||x.billStage=="paid"||x.fetchState=="Not-Started"?a.jsx(ee,{to:Ce}):x.deleteStatus.fetchState==="In-Progress"||s?a.jsx(ce,{fetchState:x.deleteStatus.fetchState}):a.jsxs(a.Fragment,{children:[a.jsx(Te,{analytics:j,onLoad:N=>(Ae=>{n!=null&&x.deleteStatus.fetchState!=="Completed"&&Ae.trackBillPayEditBill(n,x.isRecurring)})(N)}),a.jsx(Ui,{initialOpenThreadRequest:$??void 0,location:t,navigate:e,currentTenant:F,billId:n,companyId:q,billDetailsView:x,isMagicLinkEnabled:o,isVendorRecommendationEnabled:h,isLocalCurrencyEnabled:p,uncategorizedAccounts:Fe,isInternationalPaymentShaVsOurEnabled:i,vendor:x.vendor,isBillPayCommentingEnabled:d,isShaDisabled:b,isOurDisabled:A,isRecurringBillsFeatureEnabled:g,isAccountsEnabled:J,hasZeniAccountsAdminAccess:le,isZeniAccountsUser:Y,isBillPayAdmin:w,isSuperAdmin:se,accountsPromoConfig:v,isDetectInsufficientFundsEnabled:T,sameDayAchDisablementConfig:M,isAiCfoAccessEnabled:O,onAskAiCfoClick:W})]})}const It=(e,t,l)=>{let n=`/${e}/bill/`;return l==null?n=t!=null?n.concat(`new/vendor/${encodeURIComponent(t)}/edit`):n.concat("new/vendor/create"):(n=n.concat(`${encodeURIComponent(l)}/edit/vendor/`),n=t!=null?n.concat(`${encodeURIComponent(t)}/edit`):n.concat("create")),n},Mi=(e,t)=>{let l=`/${e}/bill/`;return l=t===void 0?l.concat("new/review"):l.concat(`${t}/edit/review`),l},_i=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/ach`),n},Gi=(e,t,l)=>{let n=`/${e}/bill/`;return n=l!=null?n.concat(`${encodeURIComponent(l)}/edit/`):n.concat("new/"),n=n.concat(`vendor/${encodeURIComponent(t)}/edit/domestic`),n},R="paymentDetails",Oi=(e,t,l,n,c,r,u)=>{const o={invoiceNumber:t.whatFor.invoiceNumber,memo:t.whatFor.memo,invoiceDate:t.whatFor.invoiceDate?be(t.whatFor.invoiceDate.toString()):Ot(),billDueDate:t.whatFor.billDueDate?be(t.whatFor.billDueDate.toString()):void 0,currencyCode:t.whatFor.currency,recipientCurrencyCode:t.whatFor.recipientCurrency,isInvoiceDateAutoUpdated:t.whatFor.isInvoiceDateAutoUpdated},s={paymentDate:t[R]?.paymentDate?be(t[R].paymentDate.toString()):void 0,paymentType:t[R]?.paymentType!=null?t[R]?.paymentType:void 0,paymentTo:r?.id,withdrawFrom:e.withdrawFromList.find(b=>b.id===t[R]?.withdrawFrom?.selectedOption),internationalTransferFeeBearerPaymentMethod:t[R]?.paymentType?.method!=null&&t[R].paymentType.method.includes(en)&&u?.vendorCurrencyCode===ye.currencyCode&&c?t[R]?.internationalTransferFeeBearerPaymentMethod:void 0,conversionRate:e.paymentDetailsSection?.conversionRate},i=r?.type==="Contact"?r?.email:void 0,d=!!i,p=t[R]?.recurringPaymentType?.selectedOption===Vi.recurringBill.paymentTypeOptions[1],h={isActive:e.recurringConfig?.isActive??!1,currentInstance:e.recurringConfig?.currentInstance,isApprovalRequired:t[R]?.recurringPaymentDetails?.requireApproval?.selectedOption==="all",frequency:tn(t[R]?.recurringPaymentDetails?.frequency?.selectedOption),endDate:t[R]?.recurringPaymentDetails?.endDateSelector?.date!=null?be(t[R]?.recurringPaymentDetails?.endDateSelector.date.toString()):void 0,startDate:t[R]?.recurringPaymentDetails?.startDate?be(t[R]?.recurringPaymentDetails?.startDate.toString()):void 0,endDateSelectorOptionType:t[R]?.recurringPaymentDetails?.endDateSelector?.type,totalPaymentCycles:t[R]?.recurringPaymentDetails?.endDateSelector?.recurringCount??0,updateRecurringBills:t[R]?.recurringPaymentDetails?.updateRecurringBills},g=Ni(e.accountList.accounts,e.classList.classes,e.lineDetailSection,t.lineItems,n,l),m=Object.keys(g).length>0?Qn(g):e.editBillInitialDetails?.recipientTotalAmount;return{showVendorGptRecommendationText:e.showVendorGptRecommendationText,vendor:u,whatForSection:o,paymentDetailsSection:s,isCancelled:e.isCancelled,totalAmount:m,recipientTotalAmount:m,file:e.file,updatesByLineId:g,toAccountVendorEmail:i,isCollectToAccountInfoFromVendorContact:d,isRecurring:p,recurringConfig:h}},Ni=(e,t,l,n,c,r)=>{const u={};return n.forEach(o=>{let s,i;o.account.selectedOption!=null&&(s=e.find(p=>p.qboId===o.account.selectedOption||p.accountId===o.account.selectedOption)),o.class?.selectedOption!=null&&(i=t.find(p=>p.classId===o.class.selectedOption));const d=Xn(l[o.lineId],o,c,r);u[o.lineId]={...l[o.lineId],...o,platformLineDetailType:l[o.lineId]?.platformLineDetailType??"account_based_expense_line_detail",amount:{amount:o.amount??0,currencyCode:o.currency?.currencyCode??ye.currencyCode,currencySymbol:o.currency?.currencySymbol??ye.currencySymbol},recipientAmount:{amount:o.recipientAmount??0,currencyCode:o.recipientCurrency?.currencyCode??ye.currencyCode,currencySymbol:o.recipientCurrency?.currencySymbol??ye.currencySymbol},id:o.lineId,lineDescription:o.lineDescription??"",account:s,class:i,billable:o.billable?.selectedOption??"not_billable",customer:{id:d?.id??"",name:d?.name??"",qboId:d?.qboId,logo:d?.logo},type:"journal_entry_transaction_line",isCategoryMiscategorized:!1,isClassMiscategorized:!1}}),u},zi=V.div`
93
- display: flex;
94
- height: 100vh;
95
- width: 100%;
96
- flex: 1 1 auto;
97
- flex-direction: column;
98
- align-items: center;
99
- background-color: ${e=>e.theme.colors.grey4};
100
- box-shadow: ${e=>`0px 2px ${E.sp1} ${e.theme.colors.dropShadowNormal}`};
101
- `,Zi=X(function(e,t){const{vendorId:l,billId:n}=t,c=ke(e,l),r=Ne(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:c.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:c,file:r.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onFetchBankNameBySwift:s=>{e(ln(s))},onSaveHandler:()=>{e(on(t.bankAccountContext,r))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:i}=s;e(nn({data:i}))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??kt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(rt())},onAddressClick:s=>{const i=et(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(an({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??kt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(rt())}}})(ei);function Hi(){const e=K(),t=Q(),l=we(),{vendorId:n,billId:c}=te(),{useFeatureGate:r}=oe(),u=me(),o=L.getSignedInUser(),s=k(m=>Z(m)),i=z(t.state?.pathnameStackToGoBack),d=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",p=k(m=>ke(m,n)),{isFeatureEnabled:h}=r(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:g}=r(S.isDepositAccountsFeatureEnabled);if(o==null)throw Error("Can't access address page without signing in...");return d==="billDetail"&&p.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(ce,{fetchState:p.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${E.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(zi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(Zi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:d,isVendorRecommendationEnabled:h,isZeniAccountsFeatureEnabled:g})]})}const kt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},Wi=V.div`
102
- display: flex;
103
- height: 100vh;
104
- width: 100%;
105
- flex: 1 1 auto;
106
- flex-direction: column;
107
- align-items: center;
108
- background-color: ${e=>e.theme.colors.grey4};
109
- box-shadow: ${e=>`0px 2px ${E.sp1} ${e.theme.colors.dropShadowNormal}`};
110
- `,qi=X(function(e,t){const{vendorId:l}=t,n=ke(e,l),c=l!=null?n.editVendorState?.vendorDetailLocalData?.vendorType:n.newVendorState?.vendorDetailLocalData?.vendorType,r=rn(e,c||"international_business",t.billId),u=n.editVendorState??n.newVendorState,o=t.billId!=null?e.editBillDetailViewState.editBillStateById[cn(t.billId)].billDetailLocalData.recipientTotalAmount?.amount:e.editBillDetailViewState.newBillState.billDetailLocalData.recipientTotalAmount?.amount;return{internationalWireView:r,vendorViewDetails:n,bankAccountContext:t.bankAccountContext,vendorType:c||"international_business",addressType:"vendor_address",addressToEdit:u?.vendorNewAddressStatus?.addressToCreate,mailingAddress:u?.vendorAddress,billAmount:o??0}},function(e,t){const{billId:l,navigate:n,location:c,vendorId:r,currentTenant:u}=t,{tenantEmailDomain:o}=u;return{onSaveHandler:()=>{e(bn(t.bankAccountContext,r))},onAccountDetailsUpdated:(s,i,d,p)=>{e(pn(s)),p&&e(mn(i,d))},onCurrencyUpdated:(s,i,d)=>{e(un(s,i,d,!1))},onCancel:()=>{(()=>{const s=z(c.state?.pathnameStackToGoBack),i=s.poppedPathname??vt();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(ct())},onAddressClick:s=>{const i=et(o,s,l),d=D(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{e(dn({fetchState:"Not-Started"}));const s=z(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??vt(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}}),e(ct())}}})(ti);function Ji(){const e=K(),t=Q(),l=we(),{vendorId:n,billId:c}=te(),r=re(),u=me(),o=L.getSignedInUser(),s=k(v=>Z(v)),i=z(t.state?.pathnameStackToGoBack),[d,p]=f.useState(!1),h=k(v=>v.vendorViewState.newVendorState.fetchStatus.fetchState),g=k(v=>n!=null?v.vendorViewState.editVendorStateById[n]?.fetchStatus.fetchState??"Not-Started":"Not-Started"),m=n!==void 0?g:h;f.useEffect(()=>{d===!1&&m==="Not-Started"&&n!=null&&(r(fe(!1,n)),p(!0))},[d,m,n]);const[b,A]=f.useState(!1);f.useEffect(()=>{b||m==="In-Progress"||(A(!0),r(sn(c,n)))},[b,m,r]);const T=i.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail",I=k(v=>ke(v,n));if(o==null)throw Error("Can't access international wire page without signing in...");return T==="billDetail"&&I.editVendorState?.saveStatus.fetchState==="In-Progress"?a.jsx(ce,{fetchState:I.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:u.colors.grey5,boxShadow:`0px 2px ${E.sp1} ${u.colors.dropShadowNormal}`}}):a.jsxs(Wi,{windowSize:l,children:[a.jsx(Ye,{vendorId:n,billId:c}),a.jsx(qi,{location:t,navigate:e,billId:c,vendorId:n,currentTenant:s,bankAccountContext:T})]})}const vt=(e=2)=>{let t="../";for(let l=0;l<e;l++)t=`${t}../`;return t},wt=V.div`
111
- display: flex;
112
- height: 100vh;
113
- width: 100%;
114
- flex: 1 1 auto;
115
- flex-direction: column;
116
- align-items: center;
117
- background-color: ${e=>e.theme.colors.grey4};
118
- box-shadow: ${e=>`0px 2px ${E.sp1} ${e.theme.colors.dropShadowNormal}`};
119
- `,Ki=X(function(e,t){const l=L.getSignedInUser(),n=Wt(e,t.billId),c=gn(e),r=je(l),u=n.totalAmount.amount,o=n.billPayInfo?.stage.code!=="scheduled"&&c.allApprovalRules.length>0&&!Nt(u,c.allApprovalRules,l);return{billDetails:n,billId:t.billId,billpayApprovalView:c,analytics:j,isApprovalRequiredForMarkAsPaid:o,isZeniUser:r}},function(e,t){const{location:l,billId:n,currentTenant:c,navigate:r}=t,{tenantEmailDomain:u}=c;return{redirectToBillsScreen:()=>{const o=ne(c.tenantEmailDomain),s=D(l.state?.pathnameStackToGoBack,l.pathname);r(o,{state:{pathnameStackToGoBack:s}})},discardBillDetailsFromLocalStore:()=>{e(Ie({}))},saveBillDetails:(o,s)=>{o&&e(Tt({billId:n,data:s})),e(Oe(o?"paid":"pending_approval",o,!1,n))},discardOutsideZeniPaymentData:()=>{e(jt({billId:n}))},updateBillDetailSaveBillCode:()=>{e(zt("pending_approval"))},onClickEdit:()=>{t.navigate("../",{relative:"path"})},onAttachmentClick:(o,s)=>{const i=Pe(u,o,s);window.open(`${i}`,"_blank")},retryPayment:()=>{t.billId!=null&&e(Be(t.billId,"retry"))}}})(ni);function Ct(){const e=K(),t=re(),l=Q(),{billId:n}=te(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:u}=c(S.isBillPayDetectInsufficientFundsEnabled),o=we(),s=L.getSignedInUser(),{isFeatureEnabled:i}=c(S.isBillPayLocalCurrencyFeatureEnabled),{isFeatureEnabled:d}=c(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:p}=c(S.isBillPayCommentingEnabled),h=z(l.state?.pathnameStackToGoBack),{poppedPathname:g}=h,{isFeatureEnabled:m}=c(S.isRecurringBillsFeatureEnabled),b=k(I=>Z(I)),A=k(I=>Wt(I,n)),T=A.fetchState??"Not-Started";if(f.useEffect(()=>(window.onbeforeunload=function(){return e(l,{state:{message:""}}),!0},()=>{window.onbeforeunload=null}),[e]),f.useEffect(()=>{l.state?.message!=="coming_from_edit_page"&&e(`../${n}`)},[]),f.useEffect(()=>{const I=A.vendor?.name,v=A.vendor?.id,H=A.totalAmount.amount,M=A.recipientTotalAmount.amount,_=A.invoiceNumber;I&&v&&t(hn(I,v,H,M,_,n))},[]),g==null)return a.jsx(ee,{to:`../${n}`});if(s==null)throw Error("Can't access address page without signing in...");return T==="In-Progress"?a.jsx(wt,{windowSize:o,children:a.jsx(ai,{})}):a.jsx(wt,{windowSize:o,children:a.jsx(Ki,{location:l,navigate:e,currentTenant:b,billId:n,isBillPayCommentingEnabled:p,isLocalCurrencyEnabled:i,isVendorRecommendationEnabled:d,isInternationalPaymentShaVsOurEnabled:r,isRecurringBillsFeatureEnabled:m,isDetectInsufficientFundsEnabled:u})})}const Qi=X(function(e,t){const{vendorId:l}=t,n=e.entityAutoCompleteState.autoCompleteText.common,c=We(e,"common"),r=l!=null?"edit":"create",u=Z(e),o=L.getSignedInUser(),s=u.tenantId,i={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:s??""};return{vendorViewDetails:t.vendorViewDetails,screenType:r,filesEndPoint:`${Jt.fileMicroServiceBaseUrl}`,authParams:i,analytics:j,vendorSearchAutoCompleteData:{autoCompleteText:n,entityAutoCompleteView:c}}},function(e,t){const{billId:l,currentTenant:n,navigate:c,location:r,vendorId:u,themeState:o}=t,{tenantEmailDomain:s}=n;return{onSaveVendor:i=>{e(Dn(u??void 0,t.billId)),i!=null&&e(jn(i))},saveVendorDetailLocalData:i=>{e(Ht({vendorId:u,localData:i}))},saveContactsInVendorDetailLocalData:i=>{e(En({vendorId:u,contacts:i}))},resetVendorDetailLocalData:()=>{e(dt(u))},updateSelectedVendorForCreate:i=>{e(Bn(i))},navigateToBankDetailPage:(i,d)=>{let p;i==="wire"?p=d==="international"?Qt(s,t.billId,u):mi(s,t.billId,u):p=pi(s,t.billId,u);const h=D(r.state?.pathnameStackToGoBack,r.pathname);c(p,{state:{pathnameStackToGoBack:h}})},onRemoveBankAccount:(i,d)=>{e(d===!0?An(i,"vendor",u):xn(i,"vendor",u))},navigateToMailingAddressPage:i=>{const d=et(s,i,l),p=D(r.state?.pathnameStackToGoBack,r.pathname);c(d,{state:{pathnameStackToGoBack:p}})},updateFilesEntity:i=>{e(Cn({files:i}))},onEditFileName:(i,d)=>{e(wn(i,d.split(".")[0]))},handleZeniLogoClick:()=>{o.toggle()},updateSaveFetchState:()=>{u==null&&e(dt(t.vendorViewDetails.newVendorState?.vendorBasic?.id)),e(vn("Not-Started",u))},onVendorSelected:i=>{i!=null&&e(kn(i,!0))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,d)=>{i.trim().length>=2?e(qe({searchString:i,entityType:d,searchOrigin:"common"})):i.trim().length===0&&e(ie("common"))},onCancelAutoComplete:()=>{e(ie("common"))}},onBackClick:()=>{e(ie("common"));const i=z(t.location.state?.pathnameStackToGoBack),d=i.poppedPathname??ui(n.tenantEmailDomain,t.billId);c(d,{state:{pathnameStackToGoBack:i.newStack}})},onGetOtp:i=>{e(In(i,"BillPayVendor"))},onResendOtp:i=>{e(fn(i,"BillPayVendor"))},onVerifyOtp:(i,d)=>{e(yn(i,d,"BillPayVendor"))},onVerifyOtpSuccess:(i,d,p)=>{e(Sn(i,d,p))},onFetchAndUpdateVendorRecommendations:i=>{e(Zt(i,!1))}}})(si),xe=()=>{const e=K(),t=re(),l=ii(),n=Q(),{billId:c,vendorId:r}=te(),u=k(b=>Z(b)),{useFeatureGate:o}=oe(),{isFeatureEnabled:s}=o(S.isBillPayLocalCurrencyFeatureEnabled),[i,d]=f.useState(!1),p=k(b=>b.vendorViewState.newVendorState.fetchStatus.fetchState),h=k(b=>ke(b,r)),g=k(b=>r!==void 0?b.vendorViewState.editVendorStateById[r]?.fetchStatus??"Not-Started":"Not-Started"),m=r!==void 0?g:p;return f.useEffect(()=>{i===!1&&m==="Not-Started"&&r!=null&&(t(fe(!1,r)),d(!0))},[i,m,r]),h.fetchState==="Not-Started"||h.fetchState==="In-Progress"?a.jsx(oi,{}):m==="Error"?a.jsx(li,{onGoHome:()=>e("../",{replace:!0}),onReload:()=>window.location.reload()}):a.jsxs(a.Fragment,{children:[a.jsx(Ye,{vendorId:r,billId:c}),a.jsx(Qi,{navigate:e,location:n,themeState:l,currentTenant:u,vendorId:r,billId:c,vendorViewDetails:h,isLocalCurrencyEnabled:s})]})},Xi=X(function(e,t){const{companyId:l}=t;return{billPaySetupView:Tn(e,l),analytics:j,meetingUrl:"https://meetings.hubspot.com/snehals/demo-bill-pay?embed=true",videoUrl:"https://player.vimeo.com/video/787873426?h=9d9389b1dc&badge=0&autopause=0&player_id=0&app_id=58479"}},function(e,t){const{companyId:l,navigate:n}=t;return{onButtonClick:()=>{e(Pn(l))},onBackClick:()=>{n("../..",{relative:"path"})},onSetupBillPaySuccess:()=>{n("../bills/setup",{relative:"path"})}}})(ri),Yi=()=>{const e=K(),t=Q(),{tenantEmailDomain:l}=te(),[n,c]=f.useState(!1),r=me(),u=k(g=>Z(g)),o=u.companyId??L.getSignedInUserTenant(l)?.companyId,s=L.getSignedInUser(),i=ve(),d=!!u.companyBillPayInfo?.info?.isBillPayTOSAccepted,p=pe(i?.loggedInUserRoleMap),h=g=>{c(g)};if(s==null)throw Error("Can't access bill pay promo page without signing in...");return u.companyBillPayInfo?.info?.isBillPayEnabled===!0?a.jsx(ee,{to:"../../../bills"}):d===!0&&p===!0?a.jsx(ee,{to:"../../bills/setup"}):d===!1||i!=null&&He(u,i.loggedInUserRoleMap)?a.jsxs(a.Fragment,{children:[a.jsx(Te,{analytics:j,onLoad:g=>(m=>m.trackPageLoaded(Kt.Event.billPayPromoPage))(g)}),a.jsx(Yt,{isAppContentDrawerOpen:n,handleDrawerToggle:h}),a.jsx(Xi,{companyId:o,navigate:e,location:t,onClickMenuIcon:()=>{h(!0)}})]}):a.jsx(ce,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}})};function Fo(){const e=k(U=>Z(U)),t=ve(),l=pe(t?.loggedInUserRoleMap),n=me(),{useFeatureGate:c}=oe(),{isFeatureEnabled:r}=c(S.isBillPayLocalCurrencyFeatureEnabled),u=r===!0?Ji:Hi,{isFeatureEnabled:o}=c(S.isDebitCardFeatureEnabled),s=Ut(o,e),i=Mt(e),d=Q(),p=e?.userRole!=null&&At(e?.userRole),h=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!p)&&pe(t?.loggedInUserRoleMap),g=$t(t?.loggedInUserRoleMap),m=(e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!p)&&Fn(t?.loggedInUserRoleMap),{isFeatureEnabled:b}=c(S.isDepositAccountsFeatureEnabled),A=b&&!p&&_t(t?.loggedInUserRoleMap),{isFeatureEnabled:T}=c(S.isChargeCardFeatureEnabled),I=ci(e,T,o)&&!p&&Rn(t?.loggedInUserRoleMap),v=Ln(t?.loggedInUserRoleMap),H=Gt(t?.loggedInUserRoleMap),M=Vn(t?.loggedInUserRoleMap),_=$n(t?.loggedInUserRoleMap),F=Un(t?.loggedInUserRoleMap),x=Mn(t?.loggedInUserRoleMap),{tenantEmailDomain:$}=te();return a.jsxs(sa,{children:[d.pathname.includes("/bills")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"setup",element:a.jsx(Re,{isBillPayAdminLevelAccess:h,isUserHasOnlyBillPayAccess:g,isReimbursementAdminLevelAccess:m,isZeniAccountAdminLevelAccess:A,isChargeCardAdminLevelAccess:I,isUserHasOnlyCardAccess:v,productType:"bill_pay",type:"setup"})}),a.jsx(y,{path:"verification",element:a.jsx(Re,{isBillPayAdminLevelAccess:h,isUserHasOnlyBillPayAccess:g,isReimbursementAdminLevelAccess:m,isZeniAccountAdminLevelAccess:A,isChargeCardAdminLevelAccess:I,isUserHasOnlyCardAccess:v,productType:"bill_pay",type:"verification"})}),a.jsx(y,{path:"promo",element:a.jsx(Yi,{})}),a.jsx(y,{path:"approval-rules/*",element:h?a.jsx(hi,{}):a.jsx(gi,{isUserHasZeniAccountsAccess:H,isUserHasChargeCardAccess:_,isUserHasBillPayAccess:F,isUserHasReimbursementAccess:x,isUserHasTreasuryAccess:M,isTenantBankingOnly:s,tenantEmailDomain:$??""})}),a.jsx(y,{path:"international-wire",element:a.jsx(Re,{isBillPayAdminLevelAccess:h,isUserHasOnlyBillPayAccess:g,isReimbursementAdminLevelAccess:m,isZeniAccountAdminLevelAccess:A,isChargeCardAdminLevelAccess:I,isUserHasOnlyCardAccess:v,productType:"bill_pay",type:"international-wire"})}),e.companyBillPayInfo?.info?.isBillPayEnabled===!0&&a.jsx(y,{path:"*",element:a.jsx(Fi,{})}),(s===!0||i===!0)&&a.jsx(y,{path:"/*",element:a.jsx(ea,{})}),e.companyBillPayInfo?.info?.isBillPayTOSAccepted===!0&&l&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../setup"})}),t!=null&&He(e,t.loggedInUserRoleMap)&&a.jsx(y,{path:"*",element:a.jsx(ee,{to:"../promo"})})]}):d.pathname.includes("/bill")?a.jsxs(a.Fragment,{children:[a.jsx(y,{path:"new",element:a.jsx(C,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:":billId",element:a.jsx(C,{appContent:a.jsx(yi,{})})}),a.jsx(y,{path:":billId/edit",element:a.jsx(C,{appContent:a.jsx(ft,{})})}),a.jsx(y,{path:"new/review",element:a.jsx(C,{appContent:a.jsx(Ct,{})})}),a.jsx(y,{path:":billId/edit/review",element:a.jsx(C,{appContent:a.jsx(Ct,{})})}),a.jsx(y,{path:"/:billId/:addressType",element:a.jsx(C,{appContent:a.jsx(mt,{isSubPage:!0})})}),a.jsx(y,{path:"/new/:addressType",element:a.jsx(C,{appContent:a.jsx(mt,{isSubPage:!0})})}),a.jsx(y,{path:"new/vendor/create",element:a.jsx(C,{appContent:a.jsx(xe,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit",element:a.jsx(C,{appContent:a.jsx(xe,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/ach",element:a.jsx(C,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/domestic",element:a.jsx(C,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/:vendorId/edit/international",element:a.jsx(C,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"new/vendor/create/ach",element:a.jsx(C,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:"new/vendor/create/domestic",element:a.jsx(C,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:"new/vendor/create/international",element:a.jsx(C,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(C,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(C,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(C,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create",element:a.jsx(C,{appContent:a.jsx(xe,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit",element:a.jsx(C,{appContent:a.jsx(xe,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/ach",element:a.jsx(C,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/domestic",element:a.jsx(C,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/:vendorId/edit/international",element:a.jsx(C,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/ach",element:a.jsx(C,{appContent:a.jsx(he,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/domestic",element:a.jsx(C,{appContent:a.jsx(ge,{})})}),a.jsx(y,{path:":billId/edit/vendor/create/international",element:a.jsx(C,{appContent:a.jsx(u,{})})}),a.jsx(y,{path:"*",element:a.jsx(De,{})})]}):a.jsx(y,{path:"*",element:a.jsx(ce,{fetchState:"In-Progress",style:{backgroundColor:n.colors.grey5,boxShadow:`0px 2px ${E.sp1} ${n.colors.dropShadowNormal}`}})}),a.jsx(y,{path:"*",element:a.jsx(De,{})})]})}export{Fo as default};
@@ -1,9 +0,0 @@
1
- import{j as k}from"./liveblocks-BjW28Jor.js";import{a as V}from"./sentry-Cxwj7RZa.js";import{j as ae,u as ne,h as se,l as ie,g as C,N as oe,k as re}from"./core-DM1rowt8.js";import{A as ce,a as ue,aI as de,z as E,w as pe,e as M,aa as x,g as z,bt as le,ao as me,q as B,ap as P}from"./index-Cb73b08V.js";import{M7 as fe,eN as G,rx as ye,GI as Se,xe as ge,zX as Ie,Cu as he,D7 as be,E0 as De,Mu as Oe,Mv as Te,Mw as ke,Mx as Ce,My as Ve,J1 as we,Lw as Ae,Jd as Ne,k7 as _e,fA as Fe,fz as ve,fy as xe,pF as ze,pw as Ee,pt as Me,j$ as Be,rG as Pe,rE as R,bC as L,rS as j,ct as Re}from"./zeni-epic-state-CsIRSm_7.js";import{n as Le}from"./mui-D2eUyq0K.js";import{c as U}from"./routePaths-BlrSfedH.js";import{M as je}from"./MobileAppDrawer-DvG5gJ15.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="fb4644f3-defe-4924-bd08-0587642f1c9f",e._sentryDebugIdIdentifier="sentry-dbid-fb4644f3-defe-4924-bd08-0587642f1c9f")}catch{}})();const Ue=Le.div`
2
- display: flex;
3
- min-height: 100%;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},b=we(d.roleMap)&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=Ae(e.companyConfigState),s=Ne(e.userRoleConfigState);return{businessVerificationDetails:i,verficationDetailsFetchState:i.fetchState,isRefreshingViewInBackground:i.isRefreshingViewInBackground,allNationalityCountries:i.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:s.companyTitles}},function(e,d){const{companyId:i,productType:r,currentTenant:y,navigate:S,location:l}=d,{tenantEmailDomain:b}=y;return{onCompanyDetailsChanged:t=>{const{companyDescription:s,companyIndustry:p,companyIndustryType:O,companyLegalName:T,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:c,primaryContactName:n,primaryContactUserId:u,primaryContactSyncToken:D,syncToken:f,fileIds:a,incDate:o,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:_,countriesOfOperations:h,companySourceOfFunds:q,companySourceOfFundsDescription:$,transactionVolume:J,transactionVolumeDescription:Z,purposeOfAccount:W,purposeOfAccountDescription:X,regulatedStatus:H,regulatedStatusDescription:K,usNexus:Q,usNexusTypes:Y}=t,F=O?.selectedOption,ee={companyId:i,companyDescription:s,companyIndustry:p.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:T,taxIdOrEIN:g,website:m!=""&&m!=null?Re(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:o!=null?L(o?.toString()):o,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:_?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map(v=>v.length===2?v:P(v))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:$,transactionVolume:J?.selectedOption??"",transactionVolumeDescription:Z,purposeOfAccount:W?.selectedOption??"",purposeOfAccountDescription:X,regulatedStatus:H??"",regulatedStatusDescription:K,usNexus:Q,usNexusTypes:Y?.selectedOptions??[]},te={userId:u,firstName:n.firstName,lastName:n.lastName,email:c,syncToken:D};e(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:t=>{const s=t.map(p=>{const{officerType:O,userId:T,name:g,email:m,nationalityCountryCode:I,ssn:c,dob:n,phone:u,syncToken:D,selectDocument:f,role:a,ownership:o,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:_}=p;let h;return f.selectDocumentType==="driverLicense"?h="driving_license":f.selectDocumentType==="passport"?h="passport":f.selectDocumentType==="stateId"?h="id_document":f.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:O,userId:T,firstName:g.firstName,lastName:g.lastName,email:m,ssn:c,nationalityCountryCode:I?.selectedOption!=null?P(I.selectedOption):void 0,phone:u,birthday:n!=null?L(n?.toString()):n,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:o,documentTypeSelectedForVerification:h,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:_,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}});e(j({officers:s}))},onSaveDetailsClick:t=>{e(R(i,t,r))},onSendForVerificationClick:t=>{e(R(i,t,r,!0))},onAddressClick:t=>{const s=U(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:t=>{const s=U(b,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onBackClick:()=>{e(Pe({companyId:i})),S("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(Me(t))},onDeleteFileList:t=>{e(Ee(t))},onEditFileName:(t,s)=>{e(ze(t,s.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(ve(t,"SpendManagementSetup"))},onVerifyOtp:(t,s)=>{e(Fe(t,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,s)=>{e(_e({addressType:t,addressToCreate:s}))}}})(le),Qe=({productType:e})=>{const d=ae(),i=ne(),r=se(),[y,S]=V.useState(!1),[l,b]=V.useState(!1),{tenantEmailDomain:t}=ie(),s=ce(),{useDynamicConfig:p}=ue(),{configValue:O}=p(de.zeniAccountsConfig),T=fe(O),g=C(a=>{switch(e){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}}),m=C(a=>a.companyConfigState.fetchState),I=C(a=>a.userRoleConfigState.fetchState),c=C(a=>G(a)),n=c.companyId??E.getSignedInUserTenant(t)?.companyId;if(V.useEffect(()=>{m==="Not-Started"&&r(ye()),I==="Not-Started"&&r(Se(!0))},[m,I,r]),V.useEffect(()=>{if(!y&&g==="Not-Started"&&n!=null)switch(S(!0),e){case"zeni_accounts":r(De(n,!0));break;case"zeni_treasury":r(be(n,!0));break;case"reimbursement":r(he(n,!0));break;case"charge_cards":r(Ie(n,!0));break;default:r(ge(n,!0))}},[y,g,n,r]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let u;switch(e){case"zeni_accounts":u=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":u=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":u=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":u=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:u=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{b(a)},f=C(a=>{let o;switch(e){case"zeni_accounts":o=Ve(a,n);break;case"zeni_treasury":o=Ce(a,n);break;case"charge_cards":o=ke(a,n);break;case"reimbursement":o=Te(a,n);break;default:o=Oe(a,n)}return o});return u===!1?k.jsx(oe,{to:"../promo"}):k.jsxs(Ue,{children:[k.jsx(pe,{analytics:M,onLoad:a=>(o=>{switch(e){case"zeni_accounts":return o.trackPageLoaded(z.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return o.trackPageLoaded(z.Event.reimbursementBusinessVerification);default:return o.trackPageLoaded(z.Event.billPayBusinessVerification,x(i)?"Settings":void 0)}})(a)}),x(i)?k.jsx(je,{isAppContentDrawerOpen:l,handleDrawerToggle:D}):null,k.jsx(Ge,{businessVerificationDetails:f,navigate:d,location:i,companyId:n,analytics:M,currentTenant:c,productType:e,isSettings:x(i),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:T.maxInsuredAmount})]})};export{Qe as B};
@@ -1,71 +0,0 @@
1
- import{j as s}from"./liveblocks-BjW28Jor.js";import{j as ue,l as la,h as me,g as S,u as ye,k as ge,N as ya,q as mt,n as Qt,o as te}from"./core-DM1rowt8.js";import{eN as ie,bs as xe,N_ as _a,eR as Se,eS as Ie,eT as Ae,fP as Me,cq as ze,N$ as $e,O0 as $a,sM as Sa,jz as Ia,O1 as Aa,gD as ca,ze as aa,zg as Ga,zh as Ya,jp as Ct,O2 as Ge,z2 as pt,O3 as Xt,O4 as Jt,z5 as wa,O5 as en,Mr as Pa,qY as ht,zb as Za,gO as an,O6 as ft,O7 as Ye,bq as tn,O8 as nn,fA as Ta,fz as Fa,zL as rn,fy as va,M7 as sn,O9 as gt,cj as bt,cL as on,Mq as ua,Al as cn,Oa as rt,zX as Oa,Ob as yt,Am as dn,MR as ln,An as un,Bh as mn,s6 as Cn,Bb as pn,zw as St,zp as hn,Oc as fn,fR as gn,zF as It,zJ as At,fQ as bn,Od as yn,A7 as Et,Oe as Sn,Of as In,Og as An,zH as kt,zs as Dt,z8 as _t,zB as wt,zz as Pt,zD as En,zf as st,Oh as Tt,Oi as La,zU as Ea,J6 as Ft,cM as Ka,Oj as kn,Ok as Dn,Ol as _n,Om as wn,zR as Ha,Ae as Pn,Aa as Tn,zN as Fn,Ac as vn,A2 as On,A4 as Ln,On as vt,Ak as Ot,GE as xn,Oo as Bn,Op as Rn,Oq as Un,Or as Lt,Os as jn,AH as Nn,zW as xt,zQ as da,zV as Vn,Ot as Hn,Ou as Mn,y$ as zn,Ov as Bt,Ow as Rt,Ox as $n,z1 as Gn,z0 as ot,Oy as Yn,Oz as Zn,OA as Kn,J2 as Wn,OB as Wa,OC as qn,vC as Ut,k7 as Qn,gE as Xn,AM as Jn,OD as jt,OE as er,AN as ar,OF as tr,dc as nr,sG as rr,AC as sr,Aw as Le,bv as or,bD as ir,cv as cr,bE as dr,Il as lr}from"./zeni-epic-state-CsIRSm_7.js";import{z as J,A as Re,a as oe,d as Z,s as Ze,bX as xa,c6 as ur,p as ve,c7 as mr,c8 as Cr,Z as ma,aI as Fe,q as be,be as qa,c9 as pr,x as Ca,j as Ba,h as Qa,e as Q,D as Xa,ca as hr,G as Nt,al as Ja,bq as Je,cb as Ma,cc as fr,w as et,a1 as gr,cd as br,ao as Vt,N as za,H as Ht,g as Mt,ce as yr,cf as Sr,cg as Ir,ch as Ar,ci as Er,o as ka,cj as kr,ck as Dr,cl as ja,r as _r,cm as wr,cn as Pr,co as Tr,cp as Fr,a4 as vr}from"./index-Cb73b08V.js";import{n as _e,D as zt,S as Or}from"./mui-D2eUyq0K.js";import{a as c}from"./sentry-Cxwj7RZa.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Be,f as Ue,A as Lr,h as at,P as xr,i as tt,s as ea,j as Gt,k as He,l as Yt,m as Br,n as Zt,p as Rr,S as it}from"./SetupPagesScreen-EtV9_VSj.js";import Ra from"./NotFoundScreen-D9U9JdnM.js";import{M as ha}from"./MobileAppDrawer-DvG5gJ15.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-amkrtBpQ.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-gIKSMWV6.js";import{v as ct}from"./utils-DnmDUA9M.js";import{t as Ur}from"./AddressScreen-DHdHIQtB.js";import"./recharts-Boi6IWgf.js";import"./analytics-ZBaPMYvi.js";import"./plaid-BjrBUBaH.js";import"./dnd-C-Lnhdag.js";import"./stripe-DMRn4zHo.js";import"./lottie-Lcmd6dcO.js";import"./lexical-C5McV7XP.js";import"./pdf-CnfUruOo.js";import"./analyticsHelper-2PTnaCzY.js";import"./routePaths-BlrSfedH.js";import"./BusinessVerificationPageScreen-vJgUTiwv.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]="a82400aa-1a5f-4583-9ba8-efe4b09f9eea",e._sentryDebugIdIdentifier="sentry-dbid-a82400aa-1a5f-4583-9ba8-efe4b09f9eea")}catch{}})();function jr(){const e=ue(),{cardId:t}=la(),a=me(),r=J.getSignedInUser(),n=S(G=>ie(G)),u=Re(),m=xe(u?.loggedInUserRoleMap),{useFeatureGate:C}=oe();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=S(G=>_a(G).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const D=n.userRole.includes("charge_card_user"),{isFeatureEnabled:A}=C(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:x}=C(Z.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(x,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:x,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,B=S(G=>Me(G,n.companyId)),j=ze(B.controllers),{creditAccount:T,creditAccountRepayment:P}=S(G=>$e(G)),N=S(G=>G.classListState.fetchState),p=!D&&l&&f,d=S(G=>$a(G,t,p,l)),[_,F]=c.useState(!1),U=d.chargeCard,M=U?.cardCreatedByUser?.userId,W=S(G=>M!=null?Sa(G.userRoleState,M):void 0),y=W?.accountingClassIDs[0],O=S(G=>y!=null?Ia(G.classState,{classId:y,reportId:"class_list"}):void 0),$=U?.cardHolderUser?.userId,R=S(G=>$!=null?Sa(G.userRoleState,$):void 0),Y=R?.accountingClassIDs[0],E=S(G=>Y!=null?Ia(G.classState,{classId:Y,reportId:"class_list"}):void 0),q=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",K=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&q&&(o(!0),setTimeout(()=>{a(Aa()),K&&a(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,q,K]),c.useEffect(()=>{_||d.fetchState==="Completed"||d.fetchState==="In-Progress"||t==null||(F(!0),a(aa(t,p,!1)))},[_,d,t,a]),c.useEffect(()=>{if(d.fetchState==="Completed"&&(q===!1||q&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const G=fe(n.tenantEmailDomain,t,r,U,i);e(G)}},[d.fetchState,i,q]),c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&l&&f&&m&&a(Ya()),N!=="Completed"&&N!=="In-Progress"&&a(Ct())},[T.fetchState,P.fetchState,a,l,f,m,N]);const z=()=>{if(r!=null&&t!=null){a(Aa());const G=fe(n.tenantEmailDomain,t,r);e(G)}},Ce=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",ae=Be(l,g,w,f),L=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ze,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:L,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:N,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:O?.className,cardHolderRoles:R?.userRoles,cardHolderDepartmentName:E?.className})]})}const Nr=ge(function(e){const t=Ge(e);return{insightsData:t.insight,cashbackByPeriod:t.cashbackByPeriod,uiState:t.uiState,cashbackSummary:t.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(t,a)=>{e(Xt({uiState:{sortKey:t,sortOrder:a}}))}}})(Cr);function Vr(){const e=ue(),t=me(),a=ye(),r=J.getSignedInUser(),n=S(o=>ie(o)),[u,m]=c.useState(!1),C=S(o=>Ge(o)),I=c.useCallback(()=>{const o=ve(a.state?.pathnameStackToGoBack),i=o.poppedPathname??Hr(n.tenantEmailDomain);e(i,{state:{pathnameStackToGoBack:o.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{u||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(m(!0),t(pt()))},[u,C,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return C.fetchState==="In-Progress"?s.jsx(mr,{onBackClick:I}):C.cashbackSummary.cashbackEarned.amount===0&&C.fetchState==="Completed"?s.jsx(Ra,{}):s.jsx(Nr,{onBackClick:I})}const Hr=e=>`/${e}/cards`,Mr={containerWidth:new Ca(100,58)},zr=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m}=oe(),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,x]=c.useState(!1),v=J.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const k=S(E=>ie(E));if(n==null)throw Error("Empty card id is not valid...");const{configValue:h}=m(Fe.zeniCardsConfig),b=h.max_charge_card_activation_attempts_by_card_id,g=S(E=>Jt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:B}=oe(),{isFeatureEnabled:j}=B(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=B(Z.isDebitCardFeatureEnabled),P=Ae(T,k),N=Ee({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:P}),p=!!k.companyChargeCardInfo?.info?.isChargeCardEnabled,d=k.userRole.includes("charge_card_user"),_=Se(k),F=Ie(k),U=k.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,M=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:j,isBookKeepingTenant:F,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:U}),W=!d&&M&&p;c.useEffect(()=>{C===!1&&w!=="In-Progress"&&w!=="Completed"&&(a(wa()),I(!0)),o===!1&&g.fetchState==="Not-Started"&&(i(!0),a(aa(n,W,M)))},[o,g.fetchState,C,w]);const y=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(D===!1&&(y===!1||y&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==v.userId)){const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);r(E,{state:{pathnameStackToGoBack:q}})}else if(D&&g.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){a(en({chargeCardId:n}));const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(E,{state:{pathnameStackToGoBack:q}})}}},[g.fetchState,l?.type.code,D,g.isRefreshingViewInBackground]);const O=J.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Za(n,!0))};c.useEffect(()=>{g.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&D===!1&&(setTimeout(R,3e3),A(!0))},[g.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Y=E=>{x(E)};if(w!=="Completed"||l==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if($?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Y}),s.jsx($r,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:$.phone,signedInUser:v,isSandboxEnv:qa(),chargeCardDetailState:g,signedInUserToken:O,navigate:r,currentTenant:k,location:u,maxChargeCardActivationAttempts:b[n]!=null?b[n]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Y(!0)}}),e!=null?s.jsx(Gr,{windowSize:t,children:e}):null]})},$r=ge(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const u=an(e.addressState,a);if(u==null)throw Error("Can't access shippingAddress.");const m=ft(e,n),C=t.updateStatus,I=Ye(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(tn())||i,showMenuIcon:o,shippingAddress:u,vgsVaultId:Ba.cardVaultId,twoFAView:m,activationWaitStatus:C,isRefreshingViewInBackground:t.isRefreshingViewInBackground}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,chargeCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdatePhysicalChargeCardAttempt:o=>{e(rn(r,o))},onResendOtp:o=>{C!=null&&e(Fa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{C!=null&&e(Ta(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&J.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(nn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(pr),Gr=_e.div`
2
- display: flex;
3
- flex-direction: column;
4
- width: ${e=>`${Mr.containerWidth.value(e.windowSize)}%`};
5
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
6
- `,Yr=_e.div`
7
- display: flex;
8
- min-height: 100%;
9
- width: 100%;
10
- flex: 1 1 auto;
11
- flex-direction: column;
12
- align-items: center;
13
- background-color: ${e=>e.theme.colors.grey4};
14
- `,Da=Xa.getLocalizedStrings().dateFormat,Zr={overlayWidth:new Ca(100,100,58)},Kr=ge(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:ln(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:un(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:u,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:D,cashbackInformation:A,paymentSourceInformation:f,creditAccountInformation:x,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&Q.trackCardsPayEarlyFormClick(o,D,A,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:k?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:k?.format(Da.visual.MMMDCommaYYYYformat)},f,x,v),h==="cardPaymentHistory")t.closeDrawerHandler(!0),e(yt());else{const g=Ue(b);a(g)}},onUpdatePaymentAccountStatus:(g,l,w)=>{e(pn(g,l,"bill_pay","bill_pay_detail",w))},onEstablishConnectionSuccess:()=>{e(Oa(r.companyId,!0))},onFetchLinkTokenClick:g=>{e(Cn("external_account",g))},onEstablishConnectionClick:g=>{e(mn(g,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${b}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{u?window.open(`/${b}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(hr),nt=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:u,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:D,paymentInitiatedDate:A,retryRepayment:f})=>{const x=ue(),{useDynamicConfig:v}=oe(),{configValue:k}=v(Fe.zeniAccountsConfig),h=sn(k),b=S(z=>gt(z)),{creditAccount:g}=S(z=>$e(z)),l=S(z=>ie(z)),w=Qa(),B=ma(),j=me(),T=J.getSignedInUser(),P=Re(),[N,p]=c.useState(!1),[d,_]=c.useState(!1),{configValue:F}=v(Fe.zeniCardsConfig),U=F.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??F.default_credit_card_auto_pay_threshold??Lr,M=bt(P?.loggedInUserRoleMap),W=on(P?.loggedInUserRoleMap),y=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,O=S(z=>ua(z,l.companyId)),$=O.companyChargeCardInfo?.primaryFundingAccount,R=O.allFundingAccounts.find(z=>z.id===$?.accountId),Y=S(z=>Me(z,l.companyId)),E=ze(Y.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(L=>L.id===z);let ae;if(u==="cardPaymentHistory"&&f){const L=f.paymentAccountId!=null?b.transferFromAccounts.find(pe=>pe.id===f.paymentAccountId):void 0;ae={amount:f.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:L??Ce}}else ae={amount:{amount:g.balance.amount+g.hold.amount,currencyCode:g.balance.currencyCode,currencySymbol:g.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:Ce};j(rt(ae)),_(!0)}},[b.fetchState,d,u,f,b.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,g.balance.amount,g.balance.currencyCode,g.balance.currencySymbol,g.hold.amount,j]);const q={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:R?.accType==="depositAccount",creditCardPaymentSourceAccountName:R?.label,creditCardPaymentSourceAccountType:R?.accType,creditCardPaymentSourceLastFourDigits:R?.accountLast4,creditCardPaymentSourceBalance:R?.accountBalance?.available?.amount??0};if(c.useEffect(()=>{O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&j(Oa(l.companyId,!0))},[O.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&Q.trackCardsPayEarlyPayNowClick(E,n,I,b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:A?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:A?.format(Da.visual.MMMDCommaYYYYformat)},q,m,C)},[b.updateStatus,I,D,i,o,A]),c.useEffect(()=>{b.fetchState==="Completed"&&I!=null&&D&&i&&o&&!N&&e&&d&&I!=null&&(Q.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,N,e,d]),T==null)throw Error("Can't access invite people page without signing in...");const K=()=>{t(!0),j(yt())};return s.jsx(s.Fragment,{children:s.jsx(zt,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Zr.overlayWidth.valuePercentage(B),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:s.jsx(Wr,{onClick:z=>z.stopPropagation(),children:s.jsx(Kr,{closeDrawerHandler:t,navigate:x,paymentDetails:b,creditAccountSpentAmount:r,onTransferClick:()=>{D&&i&&o&&I!=null&&Q.trackCardsPayEarlyFormClick(E,n,I,"Pay Now",b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},q,m,C),j(dn({companyId:l.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:z=>{j(rt(z))},currentTenant:l,hasZeniAccountsAdminAccess:M,isZeniAccountsUser:W,isZeniAccountSetupEnabled:y,productInformation:n,sourcePage:u,controllerEmails:E,autoPayThreshold:U,paymentSourceInformation:q,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isCashbackInfoFetchStateCompleted:D,isCreditCardInfoFetchStateCompleted:i,isDebitCardInfoFetchStateCompleted:o,paymentInitiatedDate:A,maxInsuredAmount:h.maxInsuredAmount})})})})},Wr=_e(Or)`
15
- display: flex;
16
- min-height: 100%;
17
- flex-direction: column;
18
- `,qt="charge-card-transaction-update",Na=Xa.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=J.getSignedInUser(),C=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:C??""},o=$a(e,r,a,u),i=fn(e,r),D=gn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId:Ba.cardVaultId,transactionAttachmentsEndpointToFetch:`${za}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${za}/card_transaction_attachment`,authParams:I,isSnackbarOpen:D.isSnackbarOpen,cardsEndPoint:`${Vt.cardMicroServiceBaseUrl}`,signedInUserToken:o.twoFAView.token??n}},function(e,t){const{cardId:a,currentTenant:r,navigate:n,location:u,cardProviderId:m,includeCreditAccountInfo:C,setIsPaymentOpen:I,controllerEmails:o,productInformation:i,cashbackInformation:D,primaryFundingAccountDetails:A,creditAccountInformation:f,debitAccountInformation:x,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:k}=r;return{onEventReceived:h=>{h===qt&&(e(Za(a,!0)),e(st(a,null,null,!0)))},onReloadTransactions:()=>{e(aa(a,C,v))},onFetchChargeCardTransactionList:(h,b)=>{e(st(a,h,b))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{m!=null&&e(va(h,"ChargeCardHolder",a))},onResendOtp:h=>{m!=null&&e(Fa(h,"ChargeCardHolder",a))},onVerifyOtp:(h,b)=>{m!=null&&e(Ta(h,b,"ChargeCardHolder",a))},onVerifyOtpSuccess:h=>{h!=null&&J.saveZeniOtpTokenForCardHolder(h,a)},onColorCodeChange:h=>{e(En(a,h))},onLockChargeCard:(h,b)=>{e(Pt(h,a,b))},onUnlockChargeCard:h=>{e(wt(h,a))},onCloseChargeCard:h=>{e(_t(a,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Dt([a]))},updateChargeCardName:(h,b)=>{e(kt(h,a,b))},updateChargeCardTransactionAttachments:(h,b)=>{b!=null&&e(An({transactionId:h,data:b}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,b,g,l)=>{e(In({chargeCardId:b,transactionId:h,fetchState:g,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,b,g)=>{e(Sn({chargeCardId:b,transactionId:h,shouldShowTick:g}))},onChargeCardRevokeInviteClick:()=>{e(Et(a))},updateChargeCardTransactionIsViewReceiptClicked:(h,b,g)=>{e(yn({chargeCardId:b,transactionId:h,isViewReceiptClicked:g}))},onChargeCardTransactionRowClick:(h,b)=>{const g=be(u.state?.pathnameStackToGoBack,u.pathname);n(`../../transaction/${h}/${b}`,{state:{pathnameStackToGoBack:g}})},onBackClick:()=>{const h=ve(u.state?.pathnameStackToGoBack),b=Ue(k);n(b,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(bn())},onUpdateDebitCardPinAttempt:h=>{e(At(a,h)),h==="success"&&e(ca({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,b)=>{h?e(ca({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):b!=null&&e(ca({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b.message}]}))},updateSpendLimit(h,b,g,l){e(It(h,b,g.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&D!=null&&Q.trackCardsPayEarlyClick(o,i,D,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:A?.accType==="depositAccount",creditCardPaymentSourceAccountName:A?.label,creditCardPaymentSourceAccountType:A?.accType,creditCardPaymentSourceLastFourDigits:A?.accountLast4,creditCardPaymentSourceBalance:A?.accountBalance?.available?.amount??0},f,x),I(h)}}})(gr(br));function Qr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=J.getSignedInUser(),i=S(V=>ie(V)),D=S(V=>_a(V).firstViewAfterActivation),A=S(V=>V.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:x}=I(Fe.zeniCardsConfig),v=x.enable_card_controls_for_company_ids,k=x.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[h,b]=c.useState(!1),[g,l]=c.useState(!1),{useFeatureGate:w}=oe(),{isFeatureEnabled:B}=w(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=w(Z.isDebitCardFeatureEnabled),T=Ae(j,i),P=Ee({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:T}),{isFeatureEnabled:N}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Z.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:B,isBookKeepingTenant:d,isDebitCardProductVisible:P,chargeCardsCreditAccountLimit:F}),M=!!i.companyDebitCardInfo?.info?.isDebitCardEnabled,W=!!i.companyChargeCardInfo?.info?.isChargeCardEnabled,y=!i.userRole.includes("charge_card_user")&&U&&W;if(r==null)throw Error("Empty card id is not valid...");const O=S(V=>ua(V,i.companyId)),{creditAccount:$,creditAccountRepayment:R}=S(V=>$e(V)),Y=J.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,U)),{isAiCfoOpen:q,setIsAiCfoOpen:K}=Nt(),{isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce}=Kt({isAiCfoOpen:q,setIsAiCfoOpen:K,mobileExploreReferrer:"Card Detail"});Wt({isDataReady:E.fetchState==="Completed"});const ae=S(V=>Ge(V)),L=E.chargeCard,pe=Re(),G=xe(pe?.loggedInUserRoleMap),ce=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_virtual_debit_card",we=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_physical_credit_card",re=L?.type.code==="business_virtual_debit_card"||L?.type.code==="business_virtual_credit_card",ne=L?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),X=$t(ce,E),Ke=at(G,ae),je=Be(U,P,M,W),Pe=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",ee=S(V=>Me(V,i.companyId)),We=ze(ee.controllers),qe=S(V=>L?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,L?.cardCreatedByUser?.userId):void 0),fa=S(V=>qe?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:qe?.accountingClassIDs[0],reportId:"class_list"}):void 0),se=S(V=>L?.cardHolderUser?.userId!=null?Sa(V.userRoleState,L?.cardHolderUser?.userId):void 0),ta=S(V=>se?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:se?.accountingClassIDs[0],reportId:"class_list"}):void 0),le=i?.userRole,Oe=S(V=>Ye(V,!1,P,B).revokeCardInvite),na=Ja(Oe.saveStatus.fetchState);if(c.useEffect(()=>{if(na==="In-Progress"&&Oe.saveStatus.fetchState==="Completed"){const V=Ue(i.tenantEmailDomain);e(V)}},[na,Oe.saveStatus.fetchState,e,i.tenantEmailDomain]),c.useEffect(()=>{D&&n===!1&&re&&(u(!0),setTimeout(()=>{t(Aa()),ne&&t(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[D,n,re,ne]),c.useEffect(()=>{h||E.fetchState==="Completed"||E.fetchState==="In-Progress"||r==null||(b(!0),t(aa(r,y,U,!1)))},[h,E,r,t]),c.useEffect(()=>{!g&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ce&&Pe&&G&&(l(!0),t(St({depositAccountId:E.chargeCard?.connectedAccountId})))},[g,E,t,Pe,G]),c.useEffect(()=>{ae.fetchState!=="Completed"&&ae.fetchState!=="In-Progress"&&G&&t(pt()),A!=="Completed"&&A!=="In-Progress"&&t(Ct()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&t(hn({chargeCardId:r})),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&t(Oa(i.companyId,!0))},[ae.fetchState,t,G,A,E.transactionStatistics.fetchState,O.fetchState]),c.useEffect(()=>{if(!(E.fetchState!=="Completed"||U&&$.fetchState!=="Completed"||L==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=L.type.code.includes("physical"),he=V?L.cardActivationAttemptHistory[0]?.timestamp:L.createTime;Q.trackCardsCardDetailView(We,je,{cardId:r,cardName:L.cardName,cardType:L.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Je(L.limit.amount),cardLastFourDigits:L.accountLast4,cardStatus:L.status.code,cardAssignedDate:L.createTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:L.providerCardCreateTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:L.creditLimitFrequency.name,cardSpentAmount:Je(L.balance.amount),cardAvailableLimit:Je(L.available.amount),cardUtilizationPercent:L.limit.amount>0?Math.round((L.limit.amount-L.available.amount)/L.limit.amount*100):0,cardUtilizationAmount:Je(L.limit.amount-L.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:Ma(L.cardCreatedByUser,!1),cardIssuedByEmail:L.cardCreatedByUser?.email,cardIssuedByUserId:L.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(L.cardHolderUser,!1),cardholderEmail:L.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:L.cardHolderUser?.userId,cardholderDepartment:ta?.className},de,X)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,$.fetchState,G]),o==null)throw Error("Can't access card detail page without signing in...");const Qe=i.companyId??J.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Qe!=null?[`private-${Qe}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&L!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:Ne,frequency:Xe,cardColor:H}=Va(L),De=L.cardHolderUserId===o.userId;Q.trackCardsDetailPageViewed(r,V,he,Te,Ne,Xe,H,De)}};c.useEffect(()=>{if(E.fetchState==="Completed"){const V=E.chargeCard;if(V?.status.code==="inactive"||ce&&V?.isPinSet===!1||we&&D){const he=fe(i.tenantEmailDomain,r,o,L,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:Ne,utilisation:Xe,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;Q.trackCardsDetailPageClicked(r,Te,Ne,Xe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:Ne,utilisation:Xe,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;Q.trackCardsVerifyPopUpClick(r,Te,Ne,Xe,H,De,V,Ve,he)}},Ua=$.balance.amount+$.hold.amount,ga=i.companyChargeCardInfo?.info?.primaryFundingAccount,ba=O.allFundingAccounts.find(V=>V.id===ga?.accountId);return r==null||E.fetchState==="Error"?s.jsx(Ra,{}):E.fetchState==="In-Progress"||E.fetchState==="Not-Started"||Oe.saveStatus.fetchState==="In-Progress"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(fr,{}):s.jsxs(s.Fragment,{children:[s.jsx(xa,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:Q,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:je,creditAccountInformation:de,debitAccountInformation:X,cashbackInformation:Ke,creditAccountSpentAmount:Ua,isDebitCardInfoFetchStateCompleted:!ce||!G||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||$.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!G||ae.fetchState==="Completed",paymentInitiatedDate:R.initiatedRepaymentDate}):null,s.jsx(qr,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ia,onFireOnClickAnalytics:oa,isSandboxEnv:qa(),signedInUser:o,location:a,navigate:e,setIsPaymentOpen:C,cardIssuedByRoles:qe?.userRoles,cardIssuedByDepartmentName:fa?.className,cardHolderRoles:se?.userRoles,cardHolderDepartmentName:ta?.className,loggedInUserRole:le,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:P,isDebitCardSetupEnabled:M,isChargeCardSetupEnabled:W,isCardControlsEnabled:k,isEarlyPayEnabled:N,controllerEmails:We,chargeCardCashbackDetailState:ae,productInformation:je,creditAccountInformation:de,debitAccountInformation:X,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Y,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce,isCardsCommentingEnabled:p})]})}const Va=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,u=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:u,limit:n}},Xr=_e.div`
19
- display: flex;
20
- width: 100%;
21
- flex: 1 1 auto;
22
- flex-direction: column;
23
- align-items: center;
24
- background-color: ${e=>e.theme.colors.grey4};
25
- `,Jr=ge(function(e,t){const a=Ye(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:kn(e),bulkActionView:Dn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:u,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:C,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:A,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:x,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:B,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:N}=m;return{onChargeCardRowClick:(p,d)=>{const _=Yt(N,p);let F;_!=null&&((M=>{const W=M.limit.amount-M.available.amount,y=`${M.cardHolderUser?.firstName.toLowerCase()} ${M.cardHolderUser?.lastName.toLowerCase()}`,O=M.cardName,$=M.department?.className??"",R=M.limit.amount,Y=M.creditLimitFrequency.name;Q.trackCardsListRowClicked(y,O,$,W,R,Y,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&Q.trackCardsCardListRowClick(v,g,"Card Row Item","row_clicked",d+1,{cardOwner:Ma(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Je(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Je(_.limit.amount)},l,w,B)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Zt(P):fe(P,p,u,_);const U=be(n.state?.pathnameStackToGoBack,n.pathname);a(F,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:p=>{e(Dt(p))},onFetchDepositAccountLimit:p=>{e(St({depositAccountId:p}))},onChargeCardResendInviteClick:p=>{e(Ln(p))},onChargeCardRevokeInviteClick:p=>{e(Et(p))},onLockChargeCardList:(p,d)=>{e(On(p,d))},onUnlockChargeCardList:p=>{e(vn(p))},onCloseChargeCardList:(p,d)=>{e(Fn(p,d))},onRevokeChargeCardList:p=>{e(Tn(p))},updateChargeCardListSpendLimit(p,d,_){e(Pn(p,d,_.code))},onLockChargeCard:(p,d)=>{e(Pt(T,p,d))},onUnlockChargeCard:p=>{e(wt(T,p))},onCloseChargeCard:(p,d)=>{e(_t(p,d))},onUpdateSpendLimit(p,d,_,F){e(It(p,d,_.code,F))},updateChargeCardName:(p,d)=>{e(kt(T,p,d))},onClickSetupIcon:()=>{Q.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&Q.trackCardsSettingsClick(v,g,l,w,B);const p=Br(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{Q.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&Q.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,B);const p=es(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onColumnSortConfigChanged:(p,d)=>{He(D,A,k)&&l!=null&&Q.trackCardsCardListSortClick(v,g,l,"Sort Icon","sort",p,d==="ascending"?"ASC":"DESC","Cards List",w,B),e(Ha({uiState:{sortKey:p,sortOrder:d}}))},onSearchTextChanged:p=>{e(wn(p))},onReloadCards:()=>{e(Ea(C,D&&A,I&&i,!0))},onLetsGoClick:()=>{a("./onboard")},onBackClick:()=>{a("../../")},onTotalCashbackClick:()=>{He(D,A,k)&&l!=null&&Q.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,B),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&Q.trackCardsStatementsClick(v,g,l,w,B),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&Q.trackCardsNewCardClick(v,g,l,"Promo Banner","card_creation_initiated","Card List",w,B),a(`./new?cardType=${p}`)},onPromoCardClick:p=>{a(p==="debit"&&D&&!f||p==="credit"&&o&&!x?`../promo?cardPromoType=${p}`:"./setup")},navigateToCreditCardPaymentPage:(p,d)=>{b==="Completed"&&r.company!=null&&l!=null&&Q.trackCardsPayEarlyClick(v,g,l,"Card List",p,d,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},w,B);const _=as(P);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const p=ts(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},shouldShowPayNowInfoTooltip:j,onSetRowActionCardId:p=>{e(_n(p))},onSetBulkActionCardIds:p=>{e(Tt(p))}}})(yr);function dt({isPaymentDrawerOpen:e}){const t=ue(),a=me(),r=ye(),n=c.useCallback((H,De)=>{a(Tt([])),t(H,De)},[a,t]),[u,m]=c.useState(!1),[C,I]=c.useState(J.getPayNowInfoTooltip()??!1),o=H=>{J.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=J.getSignedInUser(),f=S(H=>ie(H)),[x,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=Nt(),{isAiCfoAccessEnabled:l,onAskAiCfoClick:w}=Kt({isAiCfoOpen:b,setIsAiCfoOpen:g,mobileExploreReferrer:"Cards"}),B=f.userRole.includes("charge_card_user"),j=!B,T=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:P,useDynamicConfig:N}=oe(),{isFeatureEnabled:p}=P(Z.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Z.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),O=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Y=ke({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=N(Fe.zeniCardsConfig),K=Re(),z=xe(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),L=q.charge_card_cashback_rate_per_transaction!=null?q.charge_card_cashback_rate_per_transaction:.0175,pe=q.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??q.default_credit_card_pay_now_threshold??xr,G=q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(q.enable_card_controls_for_company_ids)&&q.enable_card_controls_for_company_ids.includes(f.companyId),ce=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,we=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,ne=S(H=>gt(H)),de=Ja(ne.updateStatus),X=S(H=>Ye(H,j,y&&T,Y&&re)),Ke=X.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),je=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>La(H,je)),We=S(H=>ua(H,f.companyId)),qe=We.companyChargeCardInfo?.primaryFundingAccount,fa=We.allFundingAccounts.find(H=>H.id===qe?.accountId),se=X.fetchState,ta=X.creditAccount;Wt({isDataReady:se==="Completed"});const{creditAccountRepayment:le}=S(H=>$e(H)),Oe=S(H=>_a(H).firstViewAfterActivation),{areTenantIdsInSync:na}=Ht(),Qe=at(z,Pe),ra=pa(Y,re,z,ta,le),sa=tt(y,T,z,ee,X.debitCardSummary),oa=Be(Y,y,T,re),ia=X.creditAccount.balance.amount+X.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(J.getPayNowInfoTooltip()==null||ia<pe*X.creditAccount.limit.amount/100)&&o(!0)},[se,pe,ia,X.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&le.initiatedRepayments.amount===0&&le.fetchState==="Completed"||de==="In-Progress"&&ne.updateStatus==="Completed")o(!1),m(!0);else if(le.initiatedRepayments.amount>0&&le.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const H=Ue(f.tenantEmailDomain);n(H)}},[e,le.initiatedRepayments.amount,le.fetchState,de,ne.updateStatus,n,f.tenantEmailDomain]),c.useEffect(()=>{!x&&(re||T)&&na&&(v(!0),a(Ea(j,y&&T,Y&&re,!1)))},[x,j,a,na]),c.useEffect(()=>{Oe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[Oe,i]),c.useEffect(()=>{se==="Completed"&&B&&X.cards.length===1&&(X.cards[0].status.code==="inactive"&&X.cards[0].type.code==="business_physical_credit_card"?n(`./${X.cards[0].id}/activate`):X.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${X.cards[0].id}`)))},[se,B,r.state,n,X.cards]),c.useEffect(()=>{if(se==="Completed"&&B){const H=X.cards.length,De=X.cards.filter(Ve=>Ve.cardHolderUserId===A?.userId).filter(Ve=>Ve.status.code==="request_on_hold");De.length>0&&H===De.length&&n("./onboard")}},[se,X.cards,B,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Y&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||Q.trackCardsCardListView(ae,oa,Qe,ra,sa)},[se,ta,le.fetchState,ee.fetchState,z]),A==null)throw Error("Can't access charge card list page without signing in...");const Ua=S(H=>Ft(H.userState,H.userRoleState,H.userListViewState,"cardAdmin")),ga=Ka(K?.loggedInUserRoleMap),ba=H=>{h(H)},V=X.creditAccount.limit,he=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:Y,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),Ne=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:y,isTOSAccepted:we,isSetupEnabled:T,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga});return re||T?s.jsxs(s.Fragment,{children:[se==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:Q,onLoad:()=>{Q.trackPageLoaded(Mt.Event.cardsListPage),(Y&&!re||y&&!T)&&Q.trackCardsPromoView(ae,{isCreditCardOffered:Y,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Y&&!re?"Credit Card":"","Card List")}}),s.jsx(xa,{showConfetti:Oe})]}):null,u===!0?s.jsx(nt,{closeDrawerHandler:he,isPaymentDrawerOpen:u,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:ia,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Qe,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Y||le.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!z||Pe.fetchState==="Completed",paymentInitiatedDate:le.initiatedRepaymentDate}):null,s.jsxs(Xr,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:ba}),s.jsx(Jr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Y,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:E,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:C,creditCardPayNowThreshold:pe,signedInUser:A,chargeCardListState:X,location:r,admins:Ua.users,navigateAndClearBulkSelection:n,currentTenant:f,isCardControlsEnabled:G,companyChargeCardInfoCreditAccountLimit:f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:f.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:z,includeCreditAccountDebitSummaryAndCashbackInfo:j,onClickMenuIcon:()=>{ba(!0)},creditLimit:V,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:T,isEarlyPayEnabled:F,isChargeCardPaymentHistoryFeatureEnabled:U,cashbackRate:L,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Qe,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||Ne?s.jsx(ya,{to:"../promo"}):s.jsx(Ze,{fetchState:se})}const es=e=>`/${e}/cards/new`,as=e=>`/${e}/cards/payment`,ts=e=>`/${e}/cards/payment-history`,ns=ge(function(e){const t=J.getSignedInUser(),a=ie(e),r=e.tenantState.currentTenantId,n=vt(e),u={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",C=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:xn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:u,companyName:m,spendManagementEndPoint:`${za}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:C}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),u=n.poppedPathname??"..";r(u,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,u)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:u}}})},onFiltersChange:n=>{e(Rn({filters:n}))},onReloadPayments:()=>{e(Ot(!0))},onSearchTextChanged:n=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:n})},updateDownloadStateHandler:n=>{e(Bn({uiState:{downloadState:n}}))}}})(Sr);function rs(){const e=ue(),t=ye(),a=me(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=oe();if(J.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const u=S(K=>ie(K)),m=S(K=>vt(K)),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,x]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Z.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),B=Ie(u),j=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=ke({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:h,isBookKeepingTenant:B,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:j}),P=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,N=Re(),p=xe(N?.loggedInUserRoleMap),d=S(K=>Ye(K,v,l&&k,T&&P)),_=c.useMemo(()=>{const K=d.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(K.map(z=>z.connectedAccountId))]},[d.cards]),F=S(K=>Ge(K)),U=S(K=>La(K,_)),{creditAccountRepayment:M}=S(K=>$e(K)),W=c.useMemo(()=>at(p,F),[p,F]),y=c.useMemo(()=>pa(T,P,p,d.creditAccount,M),[T,P,p,d.creditAccount,M]),O=c.useMemo(()=>tt(l,k,p,U,d.debitCardSummary),[l,k,p,U,d.debitCardSummary]),$=c.useMemo(()=>Be(T,l,k,P),[T,l,k,P]),R=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Y=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{x(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),x(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{C||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(Ot()))},[C,a,m.fetchState]),c.useEffect(()=>{!o&&(P||k)&&r&&(i(!0),a(Ea(v,!1,T&&P,!1)))},[o,P,k,r,a,v,T]),s.jsxs(s.Fragment,{children:[D?s.jsx(nt,{closeDrawerHandler:q,isPaymentDrawerOpen:D,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:R,productInformation:$,creditAccountInformation:y,debitAccountInformation:O,cashbackInformation:W,isDebitCardInfoFetchStateCompleted:!(l&&k&&p)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!T||M.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!p||F.fetchState==="Completed",paymentInitiatedDate:M.initiatedRepaymentDate,retryRepayment:Y}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
26
- display: flex;
27
- height: 100vh;
28
- width: 100%;
29
- flex: 1 1 auto;
30
- flex-direction: column;
31
- overflow: auto;
32
- align-items: center;
33
- background-color: ${e=>e.theme.colors.grey4};
34
- `,ut=Xa.getLocalizedStrings().months;function ss(){const e=ue(),t=me(),a=ye(),{creditAccount:r,creditAccountRepayment:n}=S(y=>$e(y)),u=`${Vt.cardMicroServiceBaseUrl}/1.0/credit-accounts/${r.id}`,[m,C]=c.useState(!1),[I,o]=c.useState(!1),i=S(y=>Un(y)),{useFeatureGate:D}=oe(),A=S(y=>ie(y)),{isFeatureEnabled:f}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=D(Z.isDebitCardFeatureEnabled),v=Ae(x,A),k=Ee({isDebitCardFeatureEnabled:x,isBankingOnlyTenant:v}),h=Se(A),b=Ie(A),g=A.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=ke({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:f,isBookKeepingTenant:b,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:g}),w=!!A.companyDebitCardInfo?.info?.isDebitCardEnabled,B=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,j=S(y=>Me(y,A.companyId)),T=ze(j.controllers),P=S(y=>Lt(y)),N=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(N)],d=S(y=>La(y,p)),_=S(y=>jn(y));c.useEffect(()=>{I||r.fetchState==="Completed"||r.fetchState==="In-Progress"||(C(!0),t(Ga()))},[m,t,r.fetchState]),c.useEffect(()=>{I||r.fetchState!=="Completed"||r.id==null||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(o(!0),t(Nn(r.id)))},[I,t,r.fetchState,r.id,i.fetchState]),c.useEffect(()=>{d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&k&&w&&t(xt()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&t(da()),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&k&&w&&t(Vn()),n.fetchState!=="Completed"&&n.fetchState!=="In-Progress"&&l&&B&&t(Ya())},[d.fetchState,k,w,P.fetchState,_.fetchState,n.fetchState,l,B]),c.useEffect(()=>{if(i.fetchState==="Completed"&&r.fetchState==="Completed"&&n.fetchState==="Completed"&&P.fetchState==="Completed"&&(!k||!w||d.fetchState==="Completed"&&_.fetchState==="Completed")){let y="",O="";if(i.statements.length>0){const E=i.statements[i.statements.length-1].period,[q,K]=E.split("-"),z=i.statements[0].period,[Ce,ae]=z.split("-");y=`${ut[parseInt(K)-1]} ${q}`,O=`${ut[parseInt(ae)-1]} ${Ce}`}const $=Be(l,k,w,B),R=pa(l,B,!0,r,n),Y=tt(k,w,!0,d,_);Q.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:O},R,Y)}},[i.fetchState,r.fetchState,n.fetchState,d.fetchState,P.fetchState,_.fetchState]);const F=()=>{const y=ve(a.state?.pathnameStackToGoBack),O=y.poppedPathname??"..";e(O,{state:{pathnameStackToGoBack:y.newStack}})},U=S(y=>Ge(y)),M=J.getSignedInUser(),W={userId:M?.userId??"",sessionId:M?.zeniSessionId??"",tenantId:A.tenantId??""};if(M==null)throw Error("Can't access address page without signing in...");if(i.fetchState!=="Completed")return s.jsx(lt,{children:s.jsx(Ir,{onBackClick:F})});{const y=Be(l,k,w,B);return s.jsx(lt,{children:s.jsx(Ar,{currentTenantCompanyName:A.companyName,statementListView:i,productInformation:y,onBackClick:F,authParams:W,controllerEmails:T,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:B,chargeCardCashbackDetailState:U,creditAccount:r,creditAccountRepayment:n,depositAccountListWithDebitCardIssued:d,debitCardSummary:_,downloadEndPoint:u})})}}const os={containerWidth:new Ca(100,58)},is=({appContent:e})=>{const t=ma(),a=me(),r=ue(),n=ye(),{useDynamicConfig:u}=oe(),[m,C]=c.useState(!1),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[x,v]=c.useState(!1),[k,h]=c.useState(!1),b=J.getSignedInUser();if(b==null)throw Error("Can't access onboarding card page without signing in...");const g=S(R=>ie(R)),{configValue:l}=u(Fe.zeniCardsConfig),w=S(R=>Hn(R)),{tenantEmailDomain:B}=g,j=S(R=>R.settingsViewState.profile.fetchState),T=S(R=>R.chargeCardListState.fetchState),P=S(R=>R.settingsViewState.profile.userId),N=S(R=>R.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&j!=="In-Progress"&&j!=="Completed"&&(a(Mn()),C(!0)),I===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(wa()),o(!0)),i===!1&&T==="Not-Started"&&(D(!0),a(da()))},[m,i,T,I,N]),c.useEffect(()=>{j==="Completed"&&x===!1&&P!=null&&T==="Completed"&&w.cards.length>0&&(a(zn({userId:P})),a(Bt({cardId:w.cards[w.cards.length-1].id})),v(!0))},[j,x,P,T]),c.useEffect(()=>{if(!A&&w.fetchState==="Completed"&&w.cards.length===0){const R=ve(n.state?.pathnameStackToGoBack),Y=R.poppedPathname??Ue(B);r(Y,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Ja(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Z.isChargeCardFeatureEnabled),M=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!g.userRole.includes("charge_card_user")&&U&&M,y=S(R=>_!=null?Rt(R.chargeCardState,_):null),O=()=>{_!=null&&(a(aa(_,W,!0)),a(da()),f(!0))};c.useEffect(()=>{if(A&&_!=null&&y!=null&&y.status.code!=="request_on_hold"){const R=fe(g.tenantEmailDomain,_,b,y),Y=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Y},replace:!0})}},[A,y?.status.code]),c.useEffect(()=>{d==="In-Progress"&&p.updateStatus.fetchState==="Completed"&&setTimeout(O,3e3)},[d,p.updateStatus.fetchState]);const $=R=>{h(R)};if(!A&&T!=="Completed"||j!=="Completed"||w.cards.length===0)return s.jsx(Ze,{fetchState:"In-Progress"});if(P==null)throw Error("Can't access my userId.");return s.jsxs(ls,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:$}),s.jsx(cs,{chargeCardListView:w,cardUserOnboardingView:p,navigate:r,currentTenant:g,myUserId:P,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?s.jsx(ds,{windowSize:t,children:e}):null]})},cs=ge(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:u}=t,{tenantEmailDomain:m}=u;return{updateCardUserOnboardingLocalData:C=>{e(ot({localData:C}))},onGetOtp:C=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:C};e(ot({localData:I}))}e(va(C,"CardUserOnboarding"))},onResendOtp:C=>{e(Fa(C,"CardUserOnboarding"))},onVerifyOtp:(C,I)=>{e(Ta(C,I,"CardUserOnboarding"))},onVerifyOtpSuccess:C=>{e(Gn()),C!=null&&J.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Bt({cardId:C}))},onBackClick:()=>{const C=ve(n.state?.pathnameStackToGoBack),I=C.poppedPathname??Ue(m);a(I,{state:{pathnameStackToGoBack:C.newStack}})}}})(Er),ds=_e.div`
35
- display: flex;
36
- flex-direction: column;
37
- width: ${e=>`${os.containerWidth.value(e.windowSize)}%`};
38
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
39
- `,ls=_e.div`
40
- display: flex;
41
- min-height: 100%;
42
- width: 100%;
43
- flex: 1 1 auto;
44
- flex-direction: column;
45
- align-items: center;
46
- background-color: ${e=>e.theme.colors.grey4};
47
- `,us={containerWidth:new Ca(100,58)},ms=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m,useFeatureGate:C}=oe(),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[x,v]=c.useState(!1),k=J.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const h=S(O=>ie(O));if(n==null)throw Error("Empty card id is not valid...");const{configValue:b}=m(Fe.zeniCardsConfig),g=S(O=>Yn(O,n)),{isFeatureEnabled:l}=C(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Z.isDebitCardFeatureEnabled),B=Ae(w,h),j=Ee({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:B}),T=Se(h),P=Ie(h),N=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=ke({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:l,isBookKeepingTenant:P,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:N}),d=g.chargeCard,_=S(O=>O.chargeCardConfigState.fetchState);c.useEffect(()=>{I===!1&&_!=="In-Progress"&&_!=="Completed"&&(a(wa()),o(!0)),i===!1&&g.fetchState==="Not-Started"&&(D(!0),a(aa(n,!1,p)))},[i,g.fetchState,I,_]);const F=d?.type.code==="business_physical_debit_card"||d?.type.code==="business_virtual_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(A===!1&&(F===!1||F&&d.status?.code!=="active"||F&&d.status.code==="active"&&d.isPinSet||d.cardHolderUserId!==k.userId)){const O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);r(O,{state:{pathnameStackToGoBack:$}})}else if(A&&g.isRefreshingViewInBackground===!1&&d?.isPinSet===!0){a(Zn({chargeCardId:n}));const O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(O,{state:{pathnameStackToGoBack:$}})}}},[g.fetchState,d?.type.code,A,g.isRefreshingViewInBackground]);const U=J.getZeniOtpTokenForCardHolder(n),M=S(O=>ht(O.userState,k.userId)),W=()=>{d?.isPinSet!==!0&&a(Za(n,!0))};c.useEffect(()=>{g.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(W,3e3),f(!0))},[g.updateDebitCardPinAttemptFetchState.fetchState]);const y=O=>{v(O)};if(_!=="Completed"||d==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(M?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(hs,{children:[s.jsx(ha,{isAppContentDrawerOpen:x,handleDrawerToggle:y}),s.jsx(Cs,{cardId:n,card:d,phone:M.phone,signedInUser:k,isSandboxEnv:qa(),debitCardDetailState:g,signedInUserToken:U,navigate:r,currentTenant:h,location:u,chargeCardCashbackRatePerTransaction:b.charge_card_cashback_rate_per_transaction!=null?b.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{y(!0)}}),e!=null?s.jsx(ps,{windowSize:t,children:e}):null]})},Cs=ge(function(e,{debitCardDetailState:t,cardId:a}){const r=ft(e,a),n=t.updateStatus,u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{showMenuIcon:m,vgsVaultId:Ba.cardVaultId,twoFAView:r,setPinWaitStatus:n}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,debitCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdateDebitCardPinAttempt:o=>{e(At(r,o))},onResendOtp:o=>{C!=null&&e(Fa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{C!=null&&e(Ta(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&J.saveZeniOtpTokenForCardHolder(o,r)},onSetPinSuccess:()=>{e(Kn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("activate")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(kr),ps=_e.div`
48
- display: flex;
49
- flex-direction: column;
50
- width: ${e=>`${us.containerWidth.value(e.windowSize)}%`};
51
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
52
- box-shadow: ${e=>`${ka.sp0} 2px ${ka.sp1} ${e.theme.colors.dropShadowNormal}`};
53
- `,hs=_e.div`
54
- display: flex;
55
- min-height: 100%;
56
- width: 100%;
57
- flex: 1 1 auto;
58
- flex-direction: column;
59
- align-items: center;
60
- background-color: ${e=>e.theme.colors.grey4};
61
- box-shadow: ${e=>`${ka.sp0} 2px ${ka.sp1} ${e.theme.colors.dropShadowNormal}`};
62
- `,fs={overlayWidth:new Ca(ja[12],ja[12],ja[9])},gs=ge(function(e,t){const a=Wa(e,!1,!1),r=t.lineId,n=a.customAddress[r],u=a.customAddressStatus[r]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:t.googleAPIKey,customAddress:n,customAddressStatus:u,lineId:r}},function(e,t){const{newCustomAddressId:a,lineId:r,chargeCardTypeOption:n}=t;return{onSubmitHandler:u=>{a!=null&&e(Ut(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`));const m=Ur(u);e(Qn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Xn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(qn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Qa(),n=ma(),u=()=>{t()},m=S(C=>Wn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,C))?.newAddressId;return s.jsx(zt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(C,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&u(),children:s.jsx(gs,{googleAPIKey:Ba.googleMapsAPIKey,onDismissClick:u,lineId:e,chargeCardTypeOption:a,newCustomAddressId:m})})},ys=ge(function(e,t){const{isChargeCardFeatureEnabled:a,isDebitCardFeatureEnabled:r,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C}=t,I=Wa(e,a&&m,r&&C);return{companyName:t.companyName,signedInUser:t.signedInUser,issueChargeCards:I,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isDebitCardFeatureEnabled:r,isChargeCardFeatureEnabled:a,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C,cardHolderCandidates:I.userList.map(o=>o.user).filter(Boolean),allRoles:I.userList.map(o=>o.userRole),allAccountingClasses:I.allAccountingClasses,userList:I.userList}},function(e,t){return{onIssueCardClick:()=>{e(ar())},onSaveChangesToLocalStore:a=>{e(er(a))},onDismissClick:()=>{e(jt()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=J.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),x=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:k}),[b,g]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{b||(g(!0),a(Jn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,B=D.companyName,j=S(y=>Wa(y,h&&l,f&&w)),T=j.fetchState,P=j.issueCardStatus.fetchState,N=j.lastSelfIssuedDebitCardId,p=S(y=>N!=null?Rt(y.chargeCardState,N):void 0),[d,_]=c.useState(null),[F,U]=c.useState(null),M=()=>{_(null)},W=(y,O)=>{_(y),U(O)};return c.useEffect(()=>{if(P==="Completed"){if(N!=null&&p?.type.code==="business_virtual_debit_card"){let y;y=p?.status.code==="request_on_hold"&&e.userId===p.cardHolderUserId?Zt(D.tenantEmailDomain):fe(D.tenantEmailDomain,N,e,p),t(y)}else t("../");a(jt())}},[P,N]),T==="Completed"?s.jsxs(s.Fragment,{children:[d!==null&&F!==null?s.jsx(bs,{closeDrawerHandler:M,lineId:d,chargeCardTypeOption:F}):null,s.jsx(ys,{companyName:B,signedInUser:e,themeState:r,isIssuePhysicalCardEnabled:C,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:t,fetchState:j.fetchState,openAddAddressDrawerHandler:W,defaultCardType:u==="creditCard"||u==="debitCard"?u:void 0})]}):T==="Error"?s.jsx(Ra,{}):s.jsx(wr,{})}const Is=_e.div`
63
- display: flex;
64
- height: 100vh;
65
- width: 100%;
66
- flex: 1 1 auto;
67
- flex-direction: column;
68
- overflow: auto;
69
- align-items: center;
70
- background-color: ${e=>e.theme.colors.grey4};
71
- `,As=ge(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:u,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:C}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=Yt(I,o),D=fe(C,o,u,i),A=be(n.state?.pathnameStackToGoBack,n.pathname);a(D,{state:{pathnameStackToGoBack:A}})},onColumnSortConfigChanged:(o,i)=>{e(Ha({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(da())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Ha({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=ue(),t=me(),a=ye(),r=Qa(),[n,u]=c.useState(!1),m=S(F=>tr(F)),C=S(F=>ie(F)),I=S(F=>Me(F,C.companyId)),o=ze(I.controllers),{useFeatureGate:i}=oe(),{isFeatureEnabled:D}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Z.isDebitCardFeatureEnabled),f=Ae(A,C),x=Ee({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:f}),v=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,k=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Re(),b=Se(C),g=Ie(C),l=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=ke({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:D,isBookKeepingTenant:g,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:l}),B=xe(h?.loggedInUserRoleMap),j=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),N=S(F=>Lt(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(N)],d=S(F=>La(F,p));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),t(da()),t(wa()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&_!=null){const F=fe(C.tenantEmailDomain,m.cards[0].id,_,m.cards[0]);e(F,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const _=J.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&B&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&B&&t(Ya()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&x&&v&&B&&t(xt())},[T.fetchState,P.fetchState,t,d.fetchState,x,v,B,w,k]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(Ze,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const F=Be(w,x,v,k);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:C,signedInUser:_,productInformation:F,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:k,chargeCardCashbackDetailState:j,creditAccount:T,creditAccountRepayment:P,depositAccountListWithDebitCardIssued:d,controllerEmails:o,location:a})})}}const ks=ge(function(e,t){const{companyId:a,companyLegalName:r}=t;return{chargeCardSetupView:ua(e,a),admins:t.adminList,companyLegalName:r,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,t){const{navigate:a,companyId:r,isCompanyBusinessVerificationAndPaymentSetUpDone:n,isDebitCardSetupEnabled:u,isChargeCardSetupEnabled:m,signedInUser:C,location:I,productInformation:o,isEarlyPayEnabled:i,controllerEmails:D,chargeCardsCreditAccountLimit:A}=t;return{onSetupButtonClick:f=>{if(C!=null&&Q.trackCardsPromoPageClicked("enable cards"),n)switch(Q.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!0,"charge_cards",i,!1));break;case"debit":e(Le(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!0,"debit_cards",i,!0):Le(r,!0,"charge_cards__debit_cards",i,!1))}else switch(Q.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!1,"charge_cards",i,!1));break;case"debit":e(Le(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!1,"debit_cards",i,!0):Le(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let x=f.poppedPathname;x==null&&(x=u||m?"..":"../.."),a(x,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(sr(r))}}})(Fr),Ds=()=>{const e=ue(),{tenantEmailDomain:t}=la(),[a]=mt(),r=a.get("cardPromoType"),n=me(),{useDynamicConfig:u,useFeatureGate:m}=oe(),[C,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Z.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),x=S(ee=>Me(ee,f.companyId)),v=ze(x.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=J.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,B=Se(f),j=Ie(f),T=Ae(o,f),P=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,N=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:T}),p=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:P}),d=Gt({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j}),_=N&&p===!1,F=w?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||nr(l?.providerVerificationStatus?.code??"")),U=J.getSignedInUser(),M=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,W=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,y=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,O=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,$=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,R=ee=>{I(ee)},Y=S(ee=>ee.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Re(),q=xe(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,L]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Y!=="Not-Started"||b==null||(L(!0),n(Oa(b,!0)))},[ae,Y,b,n]);const ce=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:d,isTOSAccepted:W,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),we=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:N,isTOSAccepted:$,isSetupEnabled:O,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=N&&we&&d&&P>=0&&ce?"debit_and_credit":N&&we?"debit":"credit",ne=Rr(r,re),de=g?.chargeCardTermsDetails?.fetchStatus?.fetchState,X=c.useRef(null);c.useEffect(()=>{de==="In-Progress"?X.current=ne:de!=="Error"&&de!=="Not-Started"||(X.current=null)},[de,ne]);const Ke=de!=="In-Progress"&&de!=="Completed"||X.current==null?ne:X.current;c.useEffect(()=>{ne==="credit"&&(y||d===!1&&O)||ne==="debit"&&O||ne==="debit_and_credit"&&O&&y?e("../"):(ne==="debit_and_credit"&&W===!0&&$===!0||ne==="credit"&&(W===!0||d===!1&&$===!0)||ne==="debit"&&$===!0)&&q===!0&&e("../setup")},[F,y,O,ne,W,$]),c.useEffect(()=>{pe||(n(rr("cardAdmin")),G(!0))},[pe]);const je=S(ee=>Ft(ee.userState,ee.userRoleState,ee.userListViewState,"cardAdmin")),Pe=Be(d,N,O,y);return(ce||we)&&Y==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:Q,onLoad:()=>{if(Q.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!N&&!O||!!d&&!!N&&!O&&!y){const ee=_s({isDebitCardSetupEnabled:O,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:N});Q.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(xa,{showConfetti:z}),s.jsx(ha,{isAppContentDrawerOpen:C,handleDrawerToggle:R}),s.jsx(ks,{signedInUser:U,location:h,showEnableCardButton:F,isCompanyBusinessVerificationAndPaymentSetUpDone:F,isChargeCardSetupEnabled:y,isDebitCardSetupEnabled:O,companyLegalName:f.companyName,adminList:je.users,isCheckingEnabled:M,navigate:e,companyId:b,cardPromoType:Ke,controllerEmails:v,productInformation:Pe,isCreditCardProductVisible:p,isDebitCardFeatureEnabled:o,isEarlyPayEnabled:i,cashbackRate:k,chargeCardsCreditAccountLimit:P,onClickMenuIcon:()=>{R(!0)}})]}):s.jsx(Ze,{fetchState:"Not-Started"})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Qs(){const e=ye(),t=S(Y=>ie(Y)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),C=Ae(n,t),I=Ee({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:C}),o=vr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,A=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,x=Re(),v=xe(x?.loggedInUserRoleMap),k=Ka(x?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Z.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),B=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!w)&&ir(x?.loggedInUserRoleMap),j=cr(x?.loggedInUserRoleMap),T=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!w)&&dr(x?.loggedInUserRoleMap),{isFeatureEnabled:P}=a(Z.isDepositAccountsFeatureEnabled),N=P&&!w&&bt(x?.loggedInUserRoleMap),p=A&&!w,d=f&&!w,_=o&&!w&&xe(x?.loggedInUserRoleMap),F=lr(x?.loggedInUserRoleMap),U=Se(t),M=Ie(t),W=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=ke({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:r,isBookKeepingTenant:M,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:W}),O=t.companyChargeCardInfo?.info!=null&&ea({cardInfo:t.companyChargeCardInfo.info,isProductVisible:y,isTOSAccepted:i,isSetupEnabled:A,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),$=t.companyDebitCardInfo?.info!=null&&ea({cardInfo:t.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:D,isSetupEnabled:f,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),R=O||$;return s.jsxs(Qt,{children:[v?s.jsx(te,{path:"setup",element:s.jsx(it,{isBillPayAdminLevelAccess:B,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,isUserHasOnlyBillPayAccess:j,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(te,{path:"verification",element:s.jsx(it,{isBillPayAdminLevelAccess:B,isUserHasOnlyBillPayAccess:j,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,productType:"charge_cards",type:"verification"})}):null,s.jsx(te,{path:"promo",element:s.jsx(Ds,{})}),p||d?s.jsxs(s.Fragment,{children:[s.jsx(te,{path:"/",element:s.jsx(dt,{isPaymentDrawerOpen:!1})}),_&&u?s.jsx(te,{path:"payment",element:s.jsx(dt,{isPaymentDrawerOpen:!0})}):null,s.jsx(te,{path:"activate",element:s.jsx(Es,{})}),s.jsx(te,{path:"onboard",element:s.jsx(is,{})}),v?s.jsx(te,{path:"new",element:s.jsx(Ss,{})}):null,h&&g?s.jsx(te,{path:"cashback",element:s.jsx(Vr,{})}):null,l?s.jsx(te,{path:"statements",element:s.jsx(ss,{})}):null,_&&m&&A?s.jsx(te,{path:"payment-history",element:s.jsx(rs,{})}):null,s.jsx(te,{path:":cardId/activate",element:s.jsx(zr,{})}),s.jsx(te,{path:":cardId/setPin",element:s.jsx(ms,{})}),s.jsx(te,{path:":cardId/addToWallet",element:s.jsx(jr,{})}),s.jsx(te,{path:":cardId/*",element:s.jsx(Qr,{})}),s.jsx(te,{path:"*",element:s.jsx(Ra,{})})]}):(i||D)&&v?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../setup"})}):R?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../promo",state:e.state})}):s.jsx(te,{path:"*",element:null})]})}export{Qs as default};