@zeniai/web-app-ui 5.3.60-prod → 5.3.61-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/assets/{AccountMappingScreen-B0Up80xG.js → AccountMappingScreen-Dt4x9DJz.js} +1 -1
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-CzYXXSw6.js → ActualMatchingMatchDetailScreen-BfyrJWDJ.js} +1 -1
  3. package/dist/assets/AddressRoutes-DfkTMfYF.js +1 -0
  4. package/dist/assets/{AddressScreen-CPFzXmPm.js → AddressScreen-DvJ6yyMx.js} +1 -1
  5. package/dist/assets/{AiCfoScreen-Cv7c9o4z.js → AiCfoScreen-SBmgGufP.js} +1 -1
  6. package/dist/assets/{AppDrawer-LLG7NS4i.js → AppDrawer-D7FI4GcX.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-CAxeo7o_.js → BillPayApprovalRoutes-BxCZdf21.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-BULBPpY1.js → BillPayRoutes-07S7DRSx.js} +1 -1
  9. package/dist/assets/{BusinessVerificationPageScreen-By8favwl.js → BusinessVerificationPageScreen-B20TVwus.js} +1 -1
  10. package/dist/assets/{CardsAiCfoScreen-BrkEHuKq.js → CardsAiCfoScreen-DkokQGnk.js} +1 -1
  11. package/dist/assets/{ChargeCardRoutes-1jpypzK8.js → ChargeCardRoutes-BO6dVldC.js} +1 -1
  12. package/dist/assets/{CompanyPassportScreen-CQnk6tjR.js → CompanyPassportScreen-BEG9__1k.js} +1 -1
  13. package/dist/assets/{ConnectionAuthScreen-CQuOukce.js → ConnectionAuthScreen-C_s5VCbI.js} +1 -1
  14. package/dist/assets/CustomerOnboardingAuthScreen-DFMNQmWy.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-JfYCGYxK.js → CustomerOnboardingRoutes-BFFEQyjG.js} +1 -1
  16. package/dist/assets/{DashboardRoutes-B3BRkxur.js → DashboardRoutes-B4NxbMLL.js} +1 -1
  17. package/dist/assets/{DefaultTenantHome-YRLGu4dU.js → DefaultTenantHome-CMvE7WXj.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-ClWh6m7n.js → DomesticWireDetailScreen-B2YgkOu5.js} +1 -1
  19. package/dist/assets/{DrawerScreen-CTiS9I26.js → DrawerScreen-I5-Ak-b_.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-B6ULNpPb.js → EntityDetailRoutes-BPqa4e5a.js} +1 -1
  21. package/dist/assets/{ExpenseAutomationRoutes-DopkS3Tt.js → ExpenseAutomationRoutes-BW9gVxz9.js} +1 -1
  22. package/dist/assets/{FeaturePreviewScreen-DWE_gGH1.js → FeaturePreviewScreen-v5dVXn4p.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-CcyYFpte.js → HubSpotOAuthCallbackScreen-CsqGaYGM.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-DGY6o5Vb.js → InboxNotificationsProvider-B4UF_uUg.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-CxKyyTQc.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-CeFzdzdQ.js → MagicLinkRoutes-DDza_62u.js} +1 -1
  27. package/dist/assets/{MagicLinkSignInScreen-Duur8xD5.js → MagicLinkSignInScreen-DGzxNaiE.js} +1 -1
  28. package/dist/assets/{MobileAppDrawer-DKGu0lT3.js → MobileAppDrawer-0TaE2Qid.js} +1 -1
  29. package/dist/assets/NotFoundScreen-BatgS8le.js +1 -0
  30. package/dist/assets/{NotificationRoutes-2gq4kBeF.js → NotificationRoutes-i3qnEWcR.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-DcWSKE9a.js → OAuthConsentScreen-CRExXXMv.js} +1 -1
  32. package/dist/assets/{PandLWithForecastRoutes-C39KvHnh.js → PandLWithForecastRoutes-DiipWbFp.js} +1 -1
  33. package/dist/assets/{PaymentLinkScreen-BU4WB3iV.js → PaymentLinkScreen-D0Hr5oRB.js} +1 -1
  34. package/dist/assets/{PeopleRoutes-BBh1-5QD.js → PeopleRoutes-CypmG1ct.js} +1 -1
  35. package/dist/assets/{PerformanceRoutes-iQchHbAg.js → PerformanceRoutes-eA0QwQYt.js} +1 -1
  36. package/dist/assets/{Preview-BhqYfLP1.js → Preview-Co3i0Xrb.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-Bwrvt4Wr.js → QBOConnectionScreen-BiN0lu_W.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-DMYbzKql.js → ReimbursementApprovalRoutes-ryr0mHPH.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-D73F6Uir.js → ReimbursementApprovalRuleDetailScreen-CRU8C8RZ.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-DGEn1YkJ.js → ReimbursementRoutes-B8NK1spY.js} +1 -1
  41. package/dist/assets/{ReportsRoutes-bN4Yml9k.js → ReportsRoutes-DRBiAxJk.js} +1 -1
  42. package/dist/assets/{RewardsRoutes-DKCIvRS5.js → RewardsRoutes-DqoIHOPS.js} +1 -1
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-X0qdbxgL.js → ScheduleDetailsPrepaidExpensesScreen-UKD1lb2-.js} +1 -1
  44. package/dist/assets/{ScreenRoutes-QEJ2cM0D.js → ScreenRoutes-6zCS0eXm.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-BCzvWJdP.js → SettingsRoutes-Bh4g9wCj.js} +1 -1
  46. package/dist/assets/{SetupPagesScreen-DQajoHqZ.js → SetupPagesScreen-CdpIgBzw.js} +1 -1
  47. package/dist/assets/{SignInScreen-B0S_eTlz.js → SignInScreen-C5RNgyDG.js} +1 -1
  48. package/dist/assets/{SignOutScreen-7tzMUG9r.js → SignOutScreen-BZdppeCA.js} +1 -1
  49. package/dist/assets/{TaskListScreen-BDVdSCyo.js → TaskListScreen-h6ryhshy.js} +1 -1
  50. package/dist/assets/{TaskRoutes-ypsBC7BH.js → TaskRoutes-BiQOVouS.js} +1 -1
  51. package/dist/assets/TransactionDetailRoutes-L8u6TmTF.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-B7aagNFt.js → TransactionDetailScreen-KBMzz0Xq.js} +1 -1
  53. package/dist/assets/{TransactionListRoutes-Bd-_O83J.js → TransactionListRoutes-CKeYxgtl.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-DZ64pgse.js → TreasuryRoutes-DsNk_W1Q.js} +1 -1
  55. package/dist/assets/{VendorsRoutes-BxURmsXb.js → VendorsRoutes-C9tsCt7G.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-CXOTG5K8.js → WiseConfirmationScreen-XbaBW0oW.js} +1 -1
  57. package/dist/assets/{ZeniAccountRoutes-BeAfPFmk.js → ZeniAccountRoutes-Bgi1019U.js} +1 -1
  58. package/dist/assets/{ZeniAccountStatementScreen-Bkc530dM.js → ZeniAccountStatementScreen-L3XK5pKW.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-Mpz5AA-4.js → accountMappingHelper-Ci74NLEW.js} +1 -1
  60. package/dist/assets/{analytics-aFpUj4gs.js → analytics-8lQ_GaR7.js} +1 -1
  61. package/dist/assets/{analyticsHelper-I16kGxOb.js → analyticsHelper-C6SU-53H.js} +1 -1
  62. package/dist/assets/{core-DWK-yy-f.js → core-B-8b0iz9.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-vftzpe4R.js → decodeURIComponentSafe-hAviH84T.js} +1 -1
  64. package/dist/assets/{dnd-BQcaJ1VA.js → dnd-CtOxA7uX.js} +1 -1
  65. package/dist/assets/{empty-eSeT5naV.js → empty-CyiOIGJw.js} +1 -1
  66. package/dist/assets/{empty-L_7q6YD9.js → empty-ZUR8mjP1.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-B_2Bil8G.js → emptyVideoElement-Dch9mr3K.js} +1 -1
  68. package/dist/assets/{epic-BUfkaLvQ.js → epic-C_YIXfJm.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-DzkVKD6z.js → expenseAutomationHelper-BzOPc0En.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-gphiv_jN.js → getLocaleForTenant-D57C4sYC.js} +1 -1
  71. package/dist/assets/{index-BbsabDnc.js → index-BUsi93tT.js} +2 -2
  72. package/dist/assets/{index-DZ8wWaVs.js → index-Ce-G0Vp2.js} +1 -1
  73. package/dist/assets/{index-DS_EsQOR.js → index-CgYr_9vs.js} +1 -1
  74. package/dist/assets/{index-CvWJGZtQ.js → index-CzpjeHcU.js} +1 -1
  75. package/dist/assets/{index-Bh2HxktJ.js → index-DeS-5gfC.js} +1 -1
  76. package/dist/assets/{index-B6CDEkoa.js → index-DuxR1XDX.js} +10 -10
  77. package/dist/assets/{index-BAGTnDG5.js → index-b65XjN06.js} +1 -1
  78. package/dist/assets/{index-C2042L2L.js → index-haVo7C6B.js} +1 -1
  79. package/dist/assets/{lexical-D0wtImar.js → lexical-BVt4M34U.js} +1 -1
  80. package/dist/assets/{liveblocks-Oqbhz69O.js → liveblocks-BjcYyeQ6.js} +1 -1
  81. package/dist/assets/{lottie-BLloBrVp.js → lottie-BdAYiWcR.js} +1 -1
  82. package/dist/assets/{mui-CXd5PBjh.js → mui-C33Oegsm.js} +1 -1
  83. package/dist/assets/{pathToGoBack-CMbLg1sX.js → pathToGoBack-Bgu6njoM.js} +1 -1
  84. package/dist/assets/{pdf-B7YVgnpS.js → pdf-BkfulyEw.js} +3 -3
  85. package/dist/assets/{pdf-lib-DzE-mOjV.js → pdf-lib-D8o-uP9K.js} +1 -1
  86. package/dist/assets/{plaid--nk7zPNe.js → plaid-Bt28AVCt.js} +1 -1
  87. package/dist/assets/{pusher--PypbzYW.js → pusher-BWEmmbE9.js} +1 -1
  88. package/dist/assets/{react-6UxkQDrW.js → react-B7GqIpoL.js} +1 -1
  89. package/dist/assets/{react-DFLY8vee.js → react-BAH__mX9.js} +1 -1
  90. package/dist/assets/{react-Sh3vsnSc.js → react-CIEK2Ei-.js} +1 -1
  91. package/dist/assets/{react-BT1dOlTR.js → react-DT9gMpbF.js} +1 -1
  92. package/dist/assets/{react-BuOjVnjn.js → react-Dqb011PB.js} +1 -1
  93. package/dist/assets/{react-BChMyOid.js → react-Ls8UDl46.js} +1 -1
  94. package/dist/assets/{recharts-BTQwLLFS.js → recharts-DkYxIsLi.js} +1 -1
  95. package/dist/assets/{routePaths-C8QqLxFB.js → routePaths-B1syYHWh.js} +1 -1
  96. package/dist/assets/{sentry-DaOZuZWH.js → sentry-DZ9rNYfw.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-AHDw7hZv.js → stripSplatSuffix-Te2Zqy4u.js} +1 -1
  98. package/dist/assets/{url-DlysUiEV.js → url-BjdrSaU1.js} +1 -1
  99. package/dist/assets/{url-C25LBXwb.js → url-DY2r7CPa.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-zhZcmvn_.js → useActualMatchingMatchDetail-DZnxtuQj.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Bqb_1s-5.js → useAiCfoDashboardSuggestedQuestionsChips-SBKf0Pu3.js} +1 -1
  102. package/dist/assets/{useAskAiCfoHostNavButtonProps-BSGTY8mB.js → useAskAiCfoHostNavButtonProps-CvEN7QS-.js} +1 -1
  103. package/dist/assets/{useChargeCardPusherEvents-DoaTdQfx.js → useChargeCardPusherEvents-DmcXit2D.js} +1 -1
  104. package/dist/assets/{useDeviceId-DqbeMLtN.js → useDeviceId-gFU5q5zf.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-CxfuikLi.js → useEmailConnectResultRefresh-BwFVhfcX.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-zQQSgVed.js → useInitialThreadRequest-Chu-ipGI.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-BrYDFvXq.js → useTaskManagerAccess-ECD0Ec-b.js} +1 -1
  108. package/dist/assets/{useTaskManagerPusherEvents-BYlEPB1C.js → useTaskManagerPusherEvents-BnGLCsCG.js} +1 -1
  109. package/dist/assets/{utils-wj3imWq2.js → utils-D3rZq_G4.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-CwmhFH4y.js → withTransactionSidePanel-qep2Sc8k.js} +1 -1
  111. package/dist/assets/{zeni-epic-state-BHC2ac1c.js → zeni-epic-state-95zxmizy.js} +3 -3
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -4
  114. package/dist/assets/AddressRoutes-wiOHxKnp.js +0 -1
  115. package/dist/assets/CustomerOnboardingAuthScreen-CO2rse9H.js +0 -1
  116. package/dist/assets/InvoicingRoutes-DQDlW9Lb.js +0 -2
  117. package/dist/assets/NotFoundScreen-CjtnHhJo.js +0 -1
  118. package/dist/assets/TransactionDetailRoutes-DvnHpdlK.js +0 -1
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-Oqbhz69O.js";import{a as g}from"./sentry-DaOZuZWH.js";import{h as w,u as k,g as x,i as T,j as O,l as E}from"./core-DWK-yy-f.js";import{z as D,bt as F,a9 as P,k as V,V as j,q as C,bu as L,af as A,aH as U,p as B}from"./index-B6CDEkoa.js";import{fF as h,gI as M,BE as _,gD as z,c8 as R,Yh as Y,bn as G,uX as H,uL as q,mz as X,o8 as S,Yi as Z,bE as $,cE as N,oj as J,ot as K}from"./zeni-epic-state-BHC2ac1c.js";import"./mui-CXd5PBjh.js";import{d as Q}from"./routePaths-C8QqLxFB.js";import{M as W}from"./MobileAppDrawer-DKGu0lT3.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new a.Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="c040309f-0673-4771-af4e-a61af5c5187f",a._sentryDebugIdIdentifier="sentry-dbid-c040309f-0673-4771-af4e-a61af5c5187f")}catch{}})();const ee=E((function(a){const n=z(a),i=D.getSignedInUser(),p=h(a),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&n.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(a.companyConfigState),t=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:n.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:n,allIndustries:e.companyIndustries??[],allNationalityCountries:t,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:G(i)}}),(function(a,n){const{companyId:i,currentTenant:p,navigate:c,location:l}=n,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let t=e.href;t.includes("http")||(t="https://".concat(t)),window.open(t,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const t=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(t,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:t,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=t,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...t,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:t.industry.selectedOption,companyIndustryType:t.companyIndustryType?.selectedOption??void 0,companySubIndustry:t.companySubIndustry?.selectedOption??void 0,businessModel:t.businessModel.selectedOption??"",companySourceOfFunds:t.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:t.companySourceOfFundsDescription??void 0,countriesOfOperations:t.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:t.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:t.transactionVolumeDescription??void 0,regulatedStatus:t.regulatedStatus??void 0,regulatedStatusDescription:t.regulatedStatusDescription??void 0,usNexus:t.usNexus??void 0,usNexusTypes:t.usNexusTypes?.selectedOptions??[],purposeOfAccount:t.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:t.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(X({files:e}))},onDeleteFile:e=>{a(q(e))},onEditFileName:(e,t)=>{a(H(e,t.split(".")[0]))}}}))(L);function de(){const a=w(),n=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),t=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>h(s))),d=r.companyId??D.getSignedInUserTenant(p)?.companyId;if(D.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||t!=="Not-Started"||d==null||(l(!0),n(M(d)))}),[c,t,d,n]),g.useEffect((()=>{o==="Not-Started"&&n(_())}),[o,n]);const u=s=>{e(s)},y=t==="Not-Started"||t==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&t==="Error"?m.jsx(F,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-BjcYyeQ6.js";import{a as g}from"./sentry-DZ9rNYfw.js";import{h as w,u as k,g as x,i as T,j as O,l as E}from"./core-B-8b0iz9.js";import{z as D,bt as F,a9 as P,k as V,V as j,q as C,bu as L,af as A,aH as U,p as B}from"./index-DuxR1XDX.js";import{fF as h,gI as M,BE as _,gD as z,c8 as R,Yh as Y,bn as G,uX as H,uL as q,mz as X,o8 as S,Yi as Z,bE as $,cE as N,oj as J,ot as K}from"./zeni-epic-state-95zxmizy.js";import"./mui-C33Oegsm.js";import{d as Q}from"./routePaths-B1syYHWh.js";import{M as W}from"./MobileAppDrawer-0TaE2Qid.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new a.Error().stack;n&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[n]="c040309f-0673-4771-af4e-a61af5c5187f",a._sentryDebugIdIdentifier="sentry-dbid-c040309f-0673-4771-af4e-a61af5c5187f")}catch{}})();const ee=E((function(a){const n=z(a),i=D.getSignedInUser(),p=h(a),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&n.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Y(a.companyConfigState),t=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:n.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:n,allIndustries:e.companyIndustries??[],allNationalityCountries:t,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:G(i)}}),(function(a,n){const{companyId:i,currentTenant:p,navigate:c,location:l}=n,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let t=e.href;t.includes("http")||(t="https://".concat(t)),window.open(t,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const t=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(t,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:t,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=t,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...t,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:t.industry.selectedOption,companyIndustryType:t.companyIndustryType?.selectedOption??void 0,companySubIndustry:t.companySubIndustry?.selectedOption??void 0,businessModel:t.businessModel.selectedOption??"",companySourceOfFunds:t.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:t.companySourceOfFundsDescription??void 0,countriesOfOperations:t.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:t.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:t.transactionVolumeDescription??void 0,regulatedStatus:t.regulatedStatus??void 0,regulatedStatusDescription:t.regulatedStatusDescription??void 0,usNexus:t.usNexus??void 0,usNexusTypes:t.usNexusTypes?.selectedOptions??[],purposeOfAccount:t.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:t.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(X({files:e}))},onDeleteFile:e=>{a(q(e))},onEditFileName:(e,t)=>{a(H(e,t.split(".")[0]))}}}))(L);function de(){const a=w(),n=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),t=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>h(s))),d=r.companyId??D.getSignedInUserTenant(p)?.companyId;if(D.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||t!=="Not-Started"||d==null||(l(!0),n(M(d)))}),[c,t,d,n]),g.useEffect((()=>{o==="Not-Started"&&n(_())}),[o,n]);const u=s=>{e(s)},y=t==="Not-Started"||t==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&t==="Error"?m.jsx(F,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as I}from"./liveblocks-Oqbhz69O.js";import{a as o}from"./sentry-DaOZuZWH.js";import{u as H,h as P,g as R,j as C,N as w}from"./core-DWK-yy-f.js";import{TX as q,fF as z,gl as G,pS as M,gM as A,gk as Q,gi as V,Ul as X,gh as O}from"./zeni-epic-state-BHC2ac1c.js";import{u as B,z as E,L as D,G as J,H as K}from"./index-B6CDEkoa.js";import{n as W}from"./mui-CXd5PBjh.js";import{P as b,a as _}from"./AccountMappingScreen-B0Up80xG.js";import{t as Y}from"./getLocaleForTenant-gphiv_jN.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-Bwrvt4Wr.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";import"./MobileAppDrawer-DKGu0lT3.js";import"./InboxNotificationsProvider-DGY6o5Vb.js";import"./useTaskManagerAccess-BrYDFvXq.js";import"./accountMappingHelper-Mpz5AA-4.js";import"./empty-eSeT5naV.js";import"./pdf-lib-DzE-mOjV.js";import"./index-DS_EsQOR.js";import"./url-DlysUiEV.js";import"./index-CvWJGZtQ.js";import"./decodeURIComponentSafe-vftzpe4R.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="b647cbd5-d06d-49e2-92c1-b25bfe928448",t._sentryDebugIdIdentifier="sentry-dbid-b647cbd5-d06d-49e2-92c1-b25bfe928448")}catch{}})();const te=W.div`
1
+ import{j as I}from"./liveblocks-BjcYyeQ6.js";import{a as o}from"./sentry-DZ9rNYfw.js";import{u as H,h as P,g as R,j as C,N as w}from"./core-B-8b0iz9.js";import{TX as q,fF as z,gl as G,pS as M,gM as A,gk as Q,gi as V,Ul as X,gh as O}from"./zeni-epic-state-95zxmizy.js";import{u as B,z as E,L as D,G as J,H as K}from"./index-DuxR1XDX.js";import{n as W}from"./mui-C33Oegsm.js";import{P as b,a as _}from"./AccountMappingScreen-Dt4x9DJz.js";import{t as Y}from"./getLocaleForTenant-D57C4sYC.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-BiN0lu_W.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./MobileAppDrawer-0TaE2Qid.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-ECD0Ec-b.js";import"./accountMappingHelper-Ci74NLEW.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="b647cbd5-d06d-49e2-92c1-b25bfe928448",t._sentryDebugIdIdentifier="sentry-dbid-b647cbd5-d06d-49e2-92c1-b25bfe928448")}catch{}})();const te=W.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-BjcYyeQ6.js";import{z as m}from"./index-DuxR1XDX.js";import{g as n}from"./QBOConnectionScreen-BiN0lu_W.js";import"./sentry-DZ9rNYfw.js";import{g as p,N as a}from"./core-B-8b0iz9.js";import"./zeni-epic-state-95zxmizy.js";import"./recharts-DkYxIsLi.js";import"./mui-C33Oegsm.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.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]="a1205b81-d106-415b-bd92-85aeae53ace3",t._sentryDebugIdIdentifier="sentry-dbid-a1205b81-d106-415b-bd92-85aeae53ace3")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),s=m.getSignedInUser()?.userId??"";if(f(o,r,e,s)===!0){const d=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(a,{to:d})}return i.jsx(a,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-Oqbhz69O.js";import{t as Tt,A as $e}from"./AddressScreen-CPFzXmPm.js";import wt from"./NotFoundScreen-CjtnHhJo.js";import{a as d,t as Me}from"./sentry-DaOZuZWH.js";import{h as _e,g as Ee,u as se,i as xe,j as T,N as Q,q as At,l as it,n as Pt,o as H}from"./core-DWK-yy-f.js";import{fF as Y,d_ as Te,dZ as we,bq as Dt,Uc as jt,bR as Bt,pQ as Ft,Bo as Vt,Br as Ut,Vz as Rt,VA as Lt,lu as Oe,lx as ct,UP as Nt,b$ as Gt,c8 as fe,BS as Ae,BD as $t,VB as me,BT as dt,Sm as Mt,mH as ut,di as lt,VC as Qt,VD as Kt,uE as zt,UC as Ce,hV as qt,UB as be,hS as Ht,Gh as Jt,uI as Zt,hK as Wt,hN as Qe,VE as pt,VF as Xt,M7 as Yt,VG as en,Mb as tn,Bu as nn,VH as an,VI as on,ls as sn,lv as rn,C3 as cn,BF as mt,BR as dn,bE as Ke,cE as un,C2 as ze,uX as ln,uL as pn,mz as mn,gG as gn,gF as fn,gE as yn,VJ as hn,Bx as Cn,C4 as bn,C7 as Sn,Ca as In,Cg as kn,dj as On}from"./zeni-epic-state-BHC2ac1c.js";import{z,o as Pe,S as W,Q as vn,p as q,a9 as re,k as g,aF as _n,aj as gt,a2 as En,O as ft,K as yt,j as X,_ as ge,V as ve,aG as xn,H as qe,v as He,af as Tn,aH as Je,aI as wn,aJ as An}from"./index-B6CDEkoa.js";import{n as De}from"./mui-CXd5PBjh.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-Bwrvt4Wr.js";import{u as jn,a as Bn}from"./useEmailConnectResultRefresh-CxfuikLi.js";import{u as Fn}from"./useChargeCardPusherEvents-DoaTdQfx.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";import"./empty-eSeT5naV.js";import"./pdf-lib-DzE-mOjV.js";import"./index-DS_EsQOR.js";import"./url-DlysUiEV.js";import"./index-CvWJGZtQ.js";import"./decodeURIComponentSafe-vftzpe4R.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="09b704f6-a5a7-48b8-a0a7-e1cf9cff639c",e._sentryDebugIdIdentifier="sentry-dbid-09b704f6-a5a7-48b8-a0a7-e1cf9cff639c")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vn=()=>{const e=_e(),l=Ee(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),t=z.getSignedInUser(),{useFeatureGate:n}=Pe(),{isFeatureEnabled:C}=n(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=n(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=n(W.isDebitCardFeatureEnabled),k=vn(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(w,O),b=we(O),D=[],U=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Dt(O?.userRole),E=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),E===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=T((S=>{const V=[];C===!1&&V.push("accounts_payable_aging"),o===!1&&V.push("accounts_receivable_aging"),V.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&V.push("rewards_card"),k===!1&&V.push("expense_automation_card");const J=jt(S,V);return Bt(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Ft(t.userId,F,O.tenantId,!0,!1,D)))}),[a,P,m,b,t,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_n,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
1
+ import{j as s}from"./liveblocks-BjcYyeQ6.js";import{t as Tt,A as $e}from"./AddressScreen-DvJ6yyMx.js";import wt from"./NotFoundScreen-BatgS8le.js";import{a as d,t as Me}from"./sentry-DZ9rNYfw.js";import{h as _e,g as Ee,u as se,i as xe,j as T,N as Q,q as At,l as it,n as Pt,o as H}from"./core-B-8b0iz9.js";import{fF as Y,d_ as Te,dZ as we,bq as Dt,Uc as jt,bR as Bt,pQ as Ft,Bo as Vt,Br as Ut,Vz as Rt,VA as Lt,lu as Oe,lx as ct,UP as Nt,b$ as Gt,c8 as fe,BS as Ae,BD as $t,VB as me,BT as dt,Sm as Mt,mH as ut,di as lt,VC as Qt,VD as Kt,uE as zt,UC as Ce,hV as qt,UB as be,hS as Ht,Gh as Jt,uI as Zt,hK as Wt,hN as Qe,VE as pt,VF as Xt,M7 as Yt,VG as en,Mb as tn,Bu as nn,VH as an,VI as on,ls as sn,lv as rn,C3 as cn,BF as mt,BR as dn,bE as Ke,cE as un,C2 as ze,uX as ln,uL as pn,mz as mn,gG as gn,gF as fn,gE as yn,VJ as hn,Bx as Cn,C4 as bn,C7 as Sn,Ca as In,Cg as kn,dj as On}from"./zeni-epic-state-95zxmizy.js";import{z,o as Pe,S as W,Q as vn,p as q,a9 as re,k as g,aF as _n,aj as gt,a2 as En,O as ft,K as yt,j as X,_ as ge,V as ve,aG as xn,H as qe,v as He,af as Tn,aH as Je,aI as wn,aJ as An}from"./index-DuxR1XDX.js";import{n as De}from"./mui-C33Oegsm.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-BiN0lu_W.js";import{u as jn,a as Bn}from"./useEmailConnectResultRefresh-BwFVhfcX.js";import{u as Fn}from"./useChargeCardPusherEvents-DmcXit2D.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="09b704f6-a5a7-48b8-a0a7-e1cf9cff639c",e._sentryDebugIdIdentifier="sentry-dbid-09b704f6-a5a7-48b8-a0a7-e1cf9cff639c")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vn=()=>{const e=_e(),l=Ee(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),t=z.getSignedInUser(),{useFeatureGate:n}=Pe(),{isFeatureEnabled:C}=n(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=n(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=n(W.isDebitCardFeatureEnabled),k=vn(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(w,O),b=we(O),D=[],U=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Dt(O?.userRole),E=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),E===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=T((S=>{const V=[];C===!1&&V.push("accounts_payable_aging"),o===!1&&V.push("accounts_receivable_aging"),V.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&V.push("rewards_card"),k===!1&&V.push("expense_automation_card");const J=jt(S,V);return Bt(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Ft(t.userId,F,O.tenantId,!0,!1,D)))}),[a,P,m,b,t,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_n,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${e=>e.theme.colors.grey4};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-Oqbhz69O.js";import{i as q,j as S,g as H,u as z,h as J,l as oe,k as oa,n as ft,o as O,N as In}from"./core-DWK-yy-f.js";import{fF as L,VV as Je,bE as sa,br as Te,Xh as En,ka as Tn,Xi as Vt,Xj as xn,kd as gt,Xk as Ze,Xl as wn,ki as Dn,Xm as Gt,Xn as Pn,km as bt,Xo as We,Xp as Fn,Xq as On,Wd as jn,lo as Rn,Xr as Mn,bn as et,Xs as ra,WT as ue,bc as ia,lC as ca,ll as la,WV as me,WU as ne,fE as da,ga as Bn,gq as Ct,Xt as Un,Xu as Ln,Xv as ua,Xw as Oe,D$ as Ue,E0 as Le,Eo as xe,Ei as pe,E4 as Ye,Xx as Yn,b$ as Ve,Xy as Vn,Xz as Gn,XA as ma,XB as je,XC as Nn,ei as tt,Aa as pa,XD as Xn,XE as ha,XF as $n,XG as zn,XH as Kn,XI as _t,UR as kt,ua as we,l$ as De,Ey as yt,Ah as qn,Ao as Qn,XJ as Zn,XK as Wn,E1 as Nt,XL as Hn,Ad as Ie,A8 as fa,XM as be,XN as Xt,XO as Jn,XP as vt,UQ as At,Cl as ga,XQ as eo,XR as ba,XS as to,XT as ao,XU as no,XV as It,CA as oo,CH as so,XW as ro,XX as io,E3 as $t,XY as co,Cj as Ca,XZ as Ce,X_ as zt,X$ as lo,bq as Sa,ED as _a,Y0 as uo,Y1 as ka,Y2 as mo,Y3 as po,Y4 as ho,Y5 as Et,Ev as fo,Ex as go,Y6 as bo,Y7 as Co,E2 as Kt,Y8 as So,EB as ya,Y9 as Se,Ya as qt,Yb as _o,Yc as ko,Yd as va,lQ as Aa,pX as Ia,lV as Ea,pV as Ta,pU as xa,pT as wa,BI as yo,dc as vo,pQ as Ao,Uc as Io,q5 as Eo,Ye as To,Yf as xo,Yg as wo,b5 as Tt,p$ as Do,ic as Po,gI as Fo,p_ as Oo,le as jo,pY as Ro,pW as Mo,d_ as Bo,dZ as Uo}from"./zeni-epic-state-BHC2ac1c.js";import{z as Y,aw as se,p as j,k as x,G as Q,bc as Lo,at as Ge,a9 as Ne,bd as Da,V as X,be as Yo,bf as Pa,E as Vo,bg as Go,bh as No,a as Fa,a2 as Oa,d as ja,as as Xo,bi as $o,ap as zo,o as Pe,bj as Ra,x as ce,bk as Ma,bl as Ba,av as Ua,bm as Ko,aj as Xe,K as $e,S as V,bn as qo,X as Qo,bo as Zo,Q as Wo,j as Ho,a5 as Jo,ar as es,bp as ts,bq as as,br as ns,bs as Ee}from"./index-B6CDEkoa.js";import{n as xt}from"./mui-CXd5PBjh.js";import{a as b}from"./sentry-DaOZuZWH.js";import{w as La}from"./withTransactionSidePanel-CwmhFH4y.js";import{c as Ya,t as Fe,f as he,b as wt,a as Dt,v as os}from"./routePaths-C8QqLxFB.js";import{u as re}from"./useAskAiCfoHostNavButtonProps-BSGTY8mB.js";import Be from"./NotFoundScreen-CjtnHhJo.js";import{u as Pt}from"./useInitialThreadRequest-zQQSgVed.js";import{t as Va}from"./analyticsHelper-I16kGxOb.js";import{C as ss}from"./CompanyPassportScreen-CQnk6tjR.js";import{u as rs}from"./useAiCfoDashboardSuggestedQuestionsChips-Bqb_1s-5.js";import{F as is}from"./FeaturePreviewScreen-DWE_gGH1.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";import"./TransactionDetailScreen-B7aagNFt.js";import"./decodeURIComponentSafe-vftzpe4R.js";import"./expenseAutomationHelper-DzkVKD6z.js";import"./stripSplatSuffix-AHDw7hZv.js";import"./MobileAppDrawer-DKGu0lT3.js";import"./InboxNotificationsProvider-DGY6o5Vb.js";import"./useTaskManagerAccess-BrYDFvXq.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="503449d8-8de9-45ac-b135-3c7d46b6400e",e._sentryDebugIdIdentifier="sentry-dbid-503449d8-8de9-45ac-b135-3c7d46b6400e")}catch{}})();const cs=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=q(),s=Y.getSignedInUser(),i=S((E=>E.tenantState.currentTenantId)),l=S((E=>L(E))),{tenantEmailDomain:m}=q(),p=H(),h=l?.companyName??"",f={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo((()=>({authParams:f,companyName:h,downloadEndPoint:`${se}/agingDetailedReport`,timezone:Je()})),[]),u=b.useMemo((()=>r!=null?sa(r):Te()),[r]),C=z(),g=J(),k=S((E=>En(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(Tn(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),_=b.useCallback(((E,P)=>{C(Vt({sortKey:E,sortOrder:P}))}),[]),T=b.useCallback((E=>{C(Vt({downloadState:E}))}),[]),B=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const P=Ya({id:E.transactionId,type:E.transactionType},m);g(P);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(P,{state:{pathnameStackToGoBack:y}})}}),[m,e]),D=b.useCallback((()=>{k.vendor!=null&&x.trackApAgingDetail("AP Aging",u.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&D()}),[D,k.fetchState]),d.jsx(Lo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:x,onTransactionClick:B,onReload:I,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=z(),a=J(),t=S((_=>xn(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=re({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=Y.getSignedInUser(),s=S((_=>_.tenantState.currentTenantId)),i=S((_=>L(_))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${se}/agingReport`,timezone:Je()})),[]),h=t.apAgingUIState.selectedDate??Te(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((_=>{e(Ze({searchString:_}))}),[]),C=b.useCallback(((_,T)=>{e(Ze({sortKey:T,sortOrder:_}))}),[]),g=b.useCallback((_=>{a(`./${_}/${h.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((_=>{e(Ze({downloadState:_}))}),[]),I=b.useCallback(((_,T)=>{}),[]),v=b.useCallback(((_,T)=>{e(Ze({selectedDate:_,agingDateSelectionType:T})),e(gt(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ne,{analytics:x,onLoad:_=>_.trackPageLoaded(X.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:x,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ds=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=q(),s=Y.getSignedInUser(),i=S((D=>L(D))),{tenantEmailDomain:l}=q(),m=H(),p=i.companyName,h={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},f=b.useMemo((()=>({authParams:h,companyName:p,downloadEndPoint:`${se}/agingDetailedReport`,timezone:Je()})),[]),c=b.useMemo((()=>r!=null?sa(r):Te()),[r]),u=z(),C=J(),g=S((D=>wn(D,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Dn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((D,E)=>{u(Gt({sortKey:D,sortOrder:E}))}),[]),_=b.useCallback((D=>{u(Gt({downloadState:D}))}),[]),T=b.useCallback((D=>{if(e)e(D.transactionId,D.transactionType);else if(l!=null){const E=Ya({id:D.transactionId,type:D.transactionType},l);C(E);const P=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:P}})}}),[l,e]),B=b.useCallback((()=>{g.customer!=null&&x.trackArAgingDetail("AR Aging",c.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&B()}),[g.fetchState,B]),d.jsx(Yo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:x,onTransactionClick:T,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),us=()=>{const e=z(),a=J(),t=S((v=>Pn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=re({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=Y.getSignedInUser(),s=S((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${se}/agingReport`,timezone:Je()})),[]),p=t.arAgingUIState.selectedDate??Te(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(We({searchString:v}))}),[]),u=b.useCallback(((v,_)=>{e(We({sortKey:_,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(We({downloadState:v}))}),[]),k=b.useCallback(((v,_)=>{e(We({selectedDate:v,agingDateSelectionType:_})),e(bt(v))}),[]),I=b.useCallback(((v,_)=>{e(Fn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ne,{analytics:x,onLoad:v=>v.trackPageLoaded(X.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:x,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=jn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Fe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Rn(n,o))}}}const ms=oe((function(e){const a=On(e).accountsInOrder.map(((t,n)=>Ga(t,n)));return{sectionTitle:Q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:x}}),Na)(Pa),ps=oe((function(e){const a=Mn(e).accountsInOrder.map(((o,r)=>Ga(o,r))),t=Y.getSignedInUser(),n=et(t);return{sectionTitle:Q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:x}}),Na)(Pa);function hs(){const e=J(),a=H(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(ms,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function fs(){const e=J(),a=H(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(ps,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const gs=xt.div`
1
+ import{j as d}from"./liveblocks-BjcYyeQ6.js";import{i as q,j as S,g as H,u as z,h as J,l as oe,k as oa,n as ft,o as O,N as In}from"./core-B-8b0iz9.js";import{fF as L,VV as Je,bE as sa,br as Te,Xh as En,ka as Tn,Xi as Vt,Xj as xn,kd as gt,Xk as Ze,Xl as wn,ki as Dn,Xm as Gt,Xn as Pn,km as bt,Xo as We,Xp as Fn,Xq as On,Wd as jn,lo as Rn,Xr as Mn,bn as et,Xs as ra,WT as ue,bc as ia,lC as ca,ll as la,WV as me,WU as ne,fE as da,ga as Bn,gq as Ct,Xt as Un,Xu as Ln,Xv as ua,Xw as Oe,D$ as Ue,E0 as Le,Eo as xe,Ei as pe,E4 as Ye,Xx as Yn,b$ as Ve,Xy as Vn,Xz as Gn,XA as ma,XB as je,XC as Nn,ei as tt,Aa as pa,XD as Xn,XE as ha,XF as $n,XG as zn,XH as Kn,XI as _t,UR as kt,ua as we,l$ as De,Ey as yt,Ah as qn,Ao as Qn,XJ as Zn,XK as Wn,E1 as Nt,XL as Hn,Ad as Ie,A8 as fa,XM as be,XN as Xt,XO as Jn,XP as vt,UQ as At,Cl as ga,XQ as eo,XR as ba,XS as to,XT as ao,XU as no,XV as It,CA as oo,CH as so,XW as ro,XX as io,E3 as $t,XY as co,Cj as Ca,XZ as Ce,X_ as zt,X$ as lo,bq as Sa,ED as _a,Y0 as uo,Y1 as ka,Y2 as mo,Y3 as po,Y4 as ho,Y5 as Et,Ev as fo,Ex as go,Y6 as bo,Y7 as Co,E2 as Kt,Y8 as So,EB as ya,Y9 as Se,Ya as qt,Yb as _o,Yc as ko,Yd as va,lQ as Aa,pX as Ia,lV as Ea,pV as Ta,pU as xa,pT as wa,BI as yo,dc as vo,pQ as Ao,Uc as Io,q5 as Eo,Ye as To,Yf as xo,Yg as wo,b5 as Tt,p$ as Do,ic as Po,gI as Fo,p_ as Oo,le as jo,pY as Ro,pW as Mo,d_ as Bo,dZ as Uo}from"./zeni-epic-state-95zxmizy.js";import{z as Y,aw as se,p as j,k as x,G as Q,bc as Lo,at as Ge,a9 as Ne,bd as Da,V as X,be as Yo,bf as Pa,E as Vo,bg as Go,bh as No,a as Fa,a2 as Oa,d as ja,as as Xo,bi as $o,ap as zo,o as Pe,bj as Ra,x as ce,bk as Ma,bl as Ba,av as Ua,bm as Ko,aj as Xe,K as $e,S as V,bn as qo,X as Qo,bo as Zo,Q as Wo,j as Ho,a5 as Jo,ar as es,bp as ts,bq as as,br as ns,bs as Ee}from"./index-DuxR1XDX.js";import{n as xt}from"./mui-C33Oegsm.js";import{a as b}from"./sentry-DZ9rNYfw.js";import{w as La}from"./withTransactionSidePanel-qep2Sc8k.js";import{c as Ya,t as Fe,f as he,b as wt,a as Dt,v as os}from"./routePaths-B1syYHWh.js";import{u as re}from"./useAskAiCfoHostNavButtonProps-CvEN7QS-.js";import Be from"./NotFoundScreen-BatgS8le.js";import{u as Pt}from"./useInitialThreadRequest-Chu-ipGI.js";import{t as Va}from"./analyticsHelper-C6SU-53H.js";import{C as ss}from"./CompanyPassportScreen-BEG9__1k.js";import{u as rs}from"./useAiCfoDashboardSuggestedQuestionsChips-SBKf0Pu3.js";import{F as is}from"./FeaturePreviewScreen-v5dVXn4p.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./TransactionDetailScreen-KBMzz0Xq.js";import"./decodeURIComponentSafe-hAviH84T.js";import"./expenseAutomationHelper-BzOPc0En.js";import"./stripSplatSuffix-Te2Zqy4u.js";import"./MobileAppDrawer-0TaE2Qid.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-ECD0Ec-b.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="503449d8-8de9-45ac-b135-3c7d46b6400e",e._sentryDebugIdIdentifier="sentry-dbid-503449d8-8de9-45ac-b135-3c7d46b6400e")}catch{}})();const cs=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=q(),s=Y.getSignedInUser(),i=S((E=>E.tenantState.currentTenantId)),l=S((E=>L(E))),{tenantEmailDomain:m}=q(),p=H(),h=l?.companyName??"",f={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo((()=>({authParams:f,companyName:h,downloadEndPoint:`${se}/agingDetailedReport`,timezone:Je()})),[]),u=b.useMemo((()=>r!=null?sa(r):Te()),[r]),C=z(),g=J(),k=S((E=>En(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(Tn(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),_=b.useCallback(((E,P)=>{C(Vt({sortKey:E,sortOrder:P}))}),[]),T=b.useCallback((E=>{C(Vt({downloadState:E}))}),[]),B=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const P=Ya({id:E.transactionId,type:E.transactionType},m);g(P);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(P,{state:{pathnameStackToGoBack:y}})}}),[m,e]),D=b.useCallback((()=>{k.vendor!=null&&x.trackApAgingDetail("AP Aging",u.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&D()}),[D,k.fetchState]),d.jsx(Lo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:x,onTransactionClick:B,onReload:I,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=z(),a=J(),t=S((_=>xn(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=re({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=Y.getSignedInUser(),s=S((_=>_.tenantState.currentTenantId)),i=S((_=>L(_))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${se}/agingReport`,timezone:Je()})),[]),h=t.apAgingUIState.selectedDate??Te(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((_=>{e(Ze({searchString:_}))}),[]),C=b.useCallback(((_,T)=>{e(Ze({sortKey:T,sortOrder:_}))}),[]),g=b.useCallback((_=>{a(`./${_}/${h.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((_=>{e(Ze({downloadState:_}))}),[]),I=b.useCallback(((_,T)=>{}),[]),v=b.useCallback(((_,T)=>{e(Ze({selectedDate:_,agingDateSelectionType:T})),e(gt(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ne,{analytics:x,onLoad:_=>_.trackPageLoaded(X.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:x,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ds=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=q(),s=Y.getSignedInUser(),i=S((D=>L(D))),{tenantEmailDomain:l}=q(),m=H(),p=i.companyName,h={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},f=b.useMemo((()=>({authParams:h,companyName:p,downloadEndPoint:`${se}/agingDetailedReport`,timezone:Je()})),[]),c=b.useMemo((()=>r!=null?sa(r):Te()),[r]),u=z(),C=J(),g=S((D=>wn(D,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Dn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((D,E)=>{u(Gt({sortKey:D,sortOrder:E}))}),[]),_=b.useCallback((D=>{u(Gt({downloadState:D}))}),[]),T=b.useCallback((D=>{if(e)e(D.transactionId,D.transactionType);else if(l!=null){const E=Ya({id:D.transactionId,type:D.transactionType},l);C(E);const P=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:P}})}}),[l,e]),B=b.useCallback((()=>{g.customer!=null&&x.trackArAgingDetail("AR Aging",c.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&B()}),[g.fetchState,B]),d.jsx(Yo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:x,onTransactionClick:T,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),us=()=>{const e=z(),a=J(),t=S((v=>Pn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=re({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=Y.getSignedInUser(),s=S((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${se}/agingReport`,timezone:Je()})),[]),p=t.arAgingUIState.selectedDate??Te(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(We({searchString:v}))}),[]),u=b.useCallback(((v,_)=>{e(We({sortKey:_,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(We({downloadState:v}))}),[]),k=b.useCallback(((v,_)=>{e(We({selectedDate:v,agingDateSelectionType:_})),e(bt(v))}),[]),I=b.useCallback(((v,_)=>{e(Fn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ne,{analytics:x,onLoad:v=>v.trackPageLoaded(X.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:x,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=jn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Fe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Rn(n,o))}}}const ms=oe((function(e){const a=On(e).accountsInOrder.map(((t,n)=>Ga(t,n)));return{sectionTitle:Q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:x}}),Na)(Pa),ps=oe((function(e){const a=Mn(e).accountsInOrder.map(((o,r)=>Ga(o,r))),t=Y.getSignedInUser(),n=et(t);return{sectionTitle:Q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:x}}),Na)(Pa);function hs(){const e=J(),a=H(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(ms,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function fs(){const e=J(),a=H(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(ps,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const gs=xt.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-Oqbhz69O.js";import{a as u}from"./sentry-DaOZuZWH.js";import{u as y,j as b,l as w,g as A,N}from"./core-DWK-yy-f.js";import{TX as U,fF as _,gl as k,TY as L,pS as R,TZ as z}from"./zeni-epic-state-BHC2ac1c.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-B6CDEkoa.js";import"./mui-CXd5PBjh.js";import{t as P}from"./getLocaleForTenant-gphiv_jN.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb",t._sentryDebugIdIdentifier="sentry-dbid-c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,x)=>l||i.split("/").find((D=>D===x))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const F=$(c,p);return v.jsx(N,{to:F,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(k(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(i))&&t(R(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-BjcYyeQ6.js";import{a as u}from"./sentry-DZ9rNYfw.js";import{u as y,j as b,l as w,g as A,N}from"./core-B-8b0iz9.js";import{TX as U,fF as _,gl as k,TY as L,pS as R,TZ as z}from"./zeni-epic-state-95zxmizy.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-DuxR1XDX.js";import"./mui-C33Oegsm.js";import{t as P}from"./getLocaleForTenant-D57C4sYC.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb",t._sentryDebugIdIdentifier="sentry-dbid-c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,x)=>l||i.split("/").find((D=>D===x))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const F=$(c,p);return v.jsx(N,{to:F,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(k(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(i))&&t(R(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-Oqbhz69O.js";import{h as w,g as C,j as h,l as E,i as V}from"./core-DWK-yy-f.js";import{YW as k,Z1 as Y,gG as _,gF as L,gE as Q,kP as X,WU as q,uO as J,fF as B,Yt as D,kN as F,YX as S,Z4 as T,kL as G,l6 as j}from"./zeni-epic-state-BHC2ac1c.js";import{bO as K,a2 as N,o as R,z as U,E as O,a5 as p,S as v,a8 as Z,bP as M,H,bQ as ee,p as te}from"./index-B6CDEkoa.js";import{n as z}from"./mui-CXd5PBjh.js";import"./sentry-DaOZuZWH.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]="23e8f956-33b5-4531-ad31-2ad7f63a97ec",e._sentryDebugIdIdentifier="sentry-dbid-23e8f956-33b5-4531-ad31-2ad7f63a97ec")}catch{}})();const ae=E(null,(function(e,t){return{onSaveVendor:a=>{e(X(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(q("common")),a!=null&&e(J(a))},onGetOtp:a=>{e(Q(a,"BillPayVendor"))},onResendOtp:a=>{e(L(a,"BillPayVendor"))},onVerifyOtp:(a,n)=>{e(_(a,n,"BillPayVendor"))},onVerifyOtpSuccess:(a,n,o)=>{e(Y(a,n,o))}}}))(K);function W({vendorId:e,billId:t,isExpressPayPage:a}){const n=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ae,{location:o,navigate:n,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:a??!1})}const ne=z.div`
1
+ import{j as l}from"./liveblocks-BjcYyeQ6.js";import{h as w,g as C,j as h,l as E,i as V}from"./core-B-8b0iz9.js";import{YW as k,Z1 as Y,gG as _,gF as L,gE as Q,kP as X,WU as q,uO as J,fF as B,Yt as D,kN as F,YX as S,Z4 as T,kL as G,l6 as j}from"./zeni-epic-state-95zxmizy.js";import{bO as K,a2 as N,o as R,z as U,E as O,a5 as p,S as v,a8 as Z,bP as M,H,bQ as ee,p as te}from"./index-DuxR1XDX.js";import{n as z}from"./mui-C33Oegsm.js";import"./sentry-DZ9rNYfw.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]="23e8f956-33b5-4531-ad31-2ad7f63a97ec",e._sentryDebugIdIdentifier="sentry-dbid-23e8f956-33b5-4531-ad31-2ad7f63a97ec")}catch{}})();const ae=E(null,(function(e,t){return{onSaveVendor:a=>{e(X(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(q("common")),a!=null&&e(J(a))},onGetOtp:a=>{e(Q(a,"BillPayVendor"))},onResendOtp:a=>{e(L(a,"BillPayVendor"))},onVerifyOtp:(a,n)=>{e(_(a,n,"BillPayVendor"))},onVerifyOtpSuccess:(a,n,o)=>{e(Y(a,n,o))}}}))(K);function W({vendorId:e,billId:t,isExpressPayPage:a}){const n=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ae,{location:o,navigate:n,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:a??!1})}const ne=z.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-Oqbhz69O.js";import{a2 as d,ac as f,E as l}from"./index-B6CDEkoa.js";import{D as b}from"./mui-CXd5PBjh.js";import"./sentry-DaOZuZWH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff",e._sentryDebugIdIdentifier="sentry-dbid-c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff")}catch{}})();const p={drawerLeftMargin:new f(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:n,onClose:t}=e,a=d(),s=o?.valuePx(a)??p.drawerLeftMargin.valuePx(a),i=l();return c.jsx(b,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:n})}export{h as D};
1
+ import{j as c}from"./liveblocks-BjcYyeQ6.js";import{a2 as d,ac as f,E as l}from"./index-DuxR1XDX.js";import{D as b}from"./mui-C33Oegsm.js";import"./sentry-DZ9rNYfw.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff",e._sentryDebugIdIdentifier="sentry-dbid-c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff")}catch{}})();const p={drawerLeftMargin:new f(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:n,onClose:t}=e,a=d(),s=o?.valuePx(a)??p.drawerLeftMargin.valuePx(a),i=l();return c.jsx(b,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:n})}export{h as D};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-Oqbhz69O.js";import{a as d}from"./sentry-DaOZuZWH.js";import{h as B,u as A,g as G,i as F,j as l,N as q,l as $,n as N,o as O}from"./core-DWK-yy-f.js";import{WZ as _,fF as M,We as R,m$ as V,Sf as b,X2 as Y,WT as z,l$ as U,Sg as S,Wj as X,Wk as Z,WV as H,WU as J}from"./zeni-epic-state-BHC2ac1c.js";import{b9 as K,k as L,a5 as Q,p as tt}from"./index-B6CDEkoa.js";import"./mui-CXd5PBjh.js";import{d as k}from"./decodeURIComponentSafe-vftzpe4R.js";import{w as et}from"./withTransactionSidePanel-CwmhFH4y.js";import{f as at,c as nt}from"./routePaths-C8QqLxFB.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";import"./useAskAiCfoHostNavButtonProps-BSGTY8mB.js";import"./TransactionDetailScreen-B7aagNFt.js";import"./useInitialThreadRequest-zQQSgVed.js";import"./expenseAutomationHelper-DzkVKD6z.js";import"./stripSplatSuffix-AHDw7hZv.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="2f66b6e9-a790-460e-89c6-eaab7fd60429",a._sentryDebugIdIdentifier="sentry-dbid-2f66b6e9-a790-460e-89c6-eaab7fd60429")}catch{}})();const ot=$((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:L,isAccountingClassesEnabled:U(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(X()),a(Z()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Q(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(K),it=et((function({entityType:a,...t}){const e=B(),o=A(),c=G(),[m,T]=d.useState(!1),[h,g]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:W,entityNameEncoded:j}=F(),r=k(W??""),p=k(j??""),f=rt(r,p),w=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},D=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),x=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>R(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(V(i)))}),[m,f,i]);const E=l((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??D,v=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,D);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(g(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:x,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),g(!1)},...t}):s.jsx(q,{to:I(w.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function xt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{xt as EntityDetailRoutes,xt as default};
1
+ import{j as s}from"./liveblocks-BjcYyeQ6.js";import{a as d}from"./sentry-DZ9rNYfw.js";import{h as B,u as A,g as G,i as F,j as l,N as q,l as $,n as N,o as O}from"./core-B-8b0iz9.js";import{WZ as _,fF as M,We as R,m$ as V,Sf as b,X2 as Y,WT as z,l$ as U,Sg as S,Wj as X,Wk as Z,WV as H,WU as J}from"./zeni-epic-state-95zxmizy.js";import{b9 as K,k as L,a5 as Q,p as tt}from"./index-DuxR1XDX.js";import"./mui-C33Oegsm.js";import{d as k}from"./decodeURIComponentSafe-hAviH84T.js";import{w as et}from"./withTransactionSidePanel-qep2Sc8k.js";import{f as at,c as nt}from"./routePaths-B1syYHWh.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./useAskAiCfoHostNavButtonProps-CvEN7QS-.js";import"./TransactionDetailScreen-KBMzz0Xq.js";import"./useInitialThreadRequest-Chu-ipGI.js";import"./expenseAutomationHelper-BzOPc0En.js";import"./stripSplatSuffix-Te2Zqy4u.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="2f66b6e9-a790-460e-89c6-eaab7fd60429",a._sentryDebugIdIdentifier="sentry-dbid-2f66b6e9-a790-460e-89c6-eaab7fd60429")}catch{}})();const ot=$((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:L,isAccountingClassesEnabled:U(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(X()),a(Z()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Q(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(K),it=et((function({entityType:a,...t}){const e=B(),o=A(),c=G(),[m,T]=d.useState(!1),[h,g]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:W,entityNameEncoded:j}=F(),r=k(W??""),p=k(j??""),f=rt(r,p),w=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},D=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),x=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>R(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(V(i)))}),[m,f,i]);const E=l((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??D,v=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,D);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(g(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:x,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),g(!1)},...t}):s.jsx(q,{to:I(w.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function xt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{xt as EntityDetailRoutes,xt as default};
@@ -1,4 +1,4 @@
1
- import{j as b}from"./liveblocks-Oqbhz69O.js";import{u as he,h as nt,g as be,j as _,i as Oe,t as Yn,l as Hn,n as Kn,o as He,N as Xn}from"./core-DWK-yy-f.js";import{fF as ke,a14 as Qn,q0 as _e,Ue as Zn,A3 as es,a15 as ts,a16 as as,a17 as ns,a18 as gt,a19 as Xe,gh as bt,a1a as ca,eW as ss,g0 as os,a1b as ia,a1c as Qe,qT as cs,uR as is,gS as ls,gQ as rs,a1d as ds,r4 as us,rd as ms,qb as ps,qp as wa,gP as re,gR as hs,a1e as Ss,qL as Ra,re as gs,qm as Cs,qh as fs,uX as Is,gO as Me,a1f as tt,Cd as Da,MA as Fa,a1g as _a,Fy as Ma,a1h as ks,eZ as bs,e$ as Ts,sS as Tt,W_ as la,X0 as Ps,m2 as ys,X1 as vs,m9 as Es,dl as As,Dw as Pt,a1i as xs,a1j as ws,fm as yt,sG as ra,WT as Rs,a1k as Ds,a1l as Fs,mb as _s,a1m as Ms,Rg as Us,ma as Os,l$ as Bs,qE as Ua,rj as at,tt as Oa,tP as Vs,U4 as Ba,ri as da,rl as Va,rn as js,bE as Ls,ny as zs,nv as $s,rm as Ze,rk as pe,a1n as Gs,rE as ua,a1o as Ns,a1p as qs,sK as Js,sL as Ws,WP as Ys,VV as Hs,a0y as Ks,a1q as Xs,WV as ma,WU as Ke,a1r as pa,mq as Qs,a1s as Zs,a1t as eo,a1u as to,a1v as ao,qz as no,a1w as so,a1x as oo,a1y as co,ru as io,md as lo,m4 as ro,a1z as uo,mc as ha,Xb as mo,a1A as po,a1B as ho,us as So,u3 as go,u2 as Ct,a1C as Co,a1D as fo,a1E as Io,a1F as ko,nJ as bo,br as To,nE as Sa,nq as Po,a1G as yo,g$ as vo,nB as Eo,sU as Ao,sW as xo,sD as wo,VY as Ro,VZ as Do,F0 as Fo,E$ as _o,Fg as Mo,a1H as ga,sJ as Uo,a1I as Oo,rU as Bo,r_ as Vo,s9 as jo,rX as Lo,a1J as zo,s8 as $o,sP as Go,a1K as No,t0 as qo,sx as Jo,t6 as Wo,sC as Yo,rF as Ho,a1L as Ko,qX as Xo,qv as Qo,qC as Ca,rp as Zo,a1M as ec,a1N as tc,a1O as ac,a1P as nc,a1Q as sc,a1R as oc,a1S as cc,ta as ic,a1T as lc,a1U as rc,a1V as fa,uD as dc,tW as uc,tL as Ia,tJ as mc,a1W as pc,ty as hc,td as Sc,tM as gc,a1X as Cc,a1Y as fc,tj as Ic,a1Z as kc,te as bc,ti as Tc,tg as Pc,tS as yc}from"./zeni-epic-state-BHC2ac1c.js";import ja from"./NotFoundScreen-CjtnHhJo.js";import{a as s,R as La}from"./sentry-DaOZuZWH.js";import{n as Te,S as vc}from"./mui-CXd5PBjh.js";import{o as Be,S as H,k as Q,p as te,ar as za,at as $a,dP as Ec,dQ as Ac,M as Ga,z as st,dR as xc,dS as wc,dT as Rc,af as Ue,dU as Dc,dV as ka,bb as ba,dW as Fc,a8 as Na,dX as _c,j as et,a as Mc,dY as Uc,dZ as Oc,O as Bc,K as Vc,d_ as jc,d$ as Lc,e0 as zc,b5 as $c,bt as Gc,ac as Nc,b6 as qc,b7 as Jc,G as Wc,w as Yc,e1 as Hc,aw as Ta,e2 as Kc}from"./index-B6CDEkoa.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-BSGTY8mB.js";import{g as Pa,b as Xc,c as Qc,h as Zc,a as ei,i as ti,r as ai,C as ni}from"./TransactionDetailScreen-B7aagNFt.js";import{u as si}from"./useActualMatchingMatchDetail-zhZcmvn_.js";import{d as oi}from"./decodeURIComponentSafe-vftzpe4R.js";import{m as Ja,a as Wa}from"./expenseAutomationHelper-DzkVKD6z.js";import{u as Ya,a as Ha,w as ci}from"./withTransactionSidePanel-CwmhFH4y.js";import{b as ii,S as li,a as ri,J as di}from"./ScheduleDetailsPrepaidExpensesScreen-X0qdbxgL.js";import{s as ya,i as Ka,h as ui,v as mi,c as pi}from"./routePaths-C8QqLxFB.js";import{a as ft}from"./accountMappingHelper-Mpz5AA-4.js";import{D as hi}from"./DrawerScreen-CTiS9I26.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";import"./useInitialThreadRequest-zQQSgVed.js";import"./stripSplatSuffix-AHDw7hZv.js";import"./pathToGoBack-CMbLg1sX.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="2d219bb3-5491-47a2-a5be-6037b8ad0589",t._sentryDebugIdIdentifier="sentry-dbid-2d219bb3-5491-47a2-a5be-6037b8ad0589")}catch{}})();const Si=()=>{const t=he(),n=nt(),f=be(),I=_((C=>ke(C))),{useFeatureGate:k}=Be(),{isFeatureEnabled:o}=k(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(H.aiAuditScorePercentage),E=_((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=_((C=>Qn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=qa({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,L=!1)=>{t(_e({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:L}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(Zn(I.tenantId,C))}),[I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),g=E[I.tenantId],u=s.useCallback((()=>{const C=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(g.month,g.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,C??null),x(g,I.tenantId,!0)}),[x,g,I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=te(f.state?.pathnameStackToGoBack,f.pathname),A=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&g!=null){const C=l.monthEndCloseChecks.monthEndCloseCheckList.find((h=>h.progress<100));if(C!=null)return void n(`./${C.id}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=za();return $a({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{g!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&x(g,I.tenantId)}),[x,g,l.fetchState,I.tenantId,p]),s.useEffect((()=>{g!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(es(g))}),[g,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const C=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(C)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const C=f.state?.referrer;Q.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,C??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),b.jsx(gi,{children:b.jsx(Ec,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},gi=Te.div`
1
+ import{j as b}from"./liveblocks-BjcYyeQ6.js";import{u as he,h as nt,g as be,j as _,i as Oe,t as Yn,l as Hn,n as Kn,o as He,N as Xn}from"./core-B-8b0iz9.js";import{fF as ke,a14 as Qn,q0 as _e,Ue as Zn,A3 as es,a15 as ts,a16 as as,a17 as ns,a18 as gt,a19 as Xe,gh as bt,a1a as ca,eW as ss,g0 as os,a1b as ia,a1c as Qe,qT as cs,uR as is,gS as ls,gQ as rs,a1d as ds,r4 as us,rd as ms,qb as ps,qp as wa,gP as re,gR as hs,a1e as Ss,qL as Ra,re as gs,qm as Cs,qh as fs,uX as Is,gO as Me,a1f as tt,Cd as Da,MA as Fa,a1g as _a,Fy as Ma,a1h as ks,eZ as bs,e$ as Ts,sS as Tt,W_ as la,X0 as Ps,m2 as ys,X1 as vs,m9 as Es,dl as As,Dw as Pt,a1i as xs,a1j as ws,fm as yt,sG as ra,WT as Rs,a1k as Ds,a1l as Fs,mb as _s,a1m as Ms,Rg as Us,ma as Os,l$ as Bs,qE as Ua,rj as at,tt as Oa,tP as Vs,U4 as Ba,ri as da,rl as Va,rn as js,bE as Ls,ny as zs,nv as $s,rm as Ze,rk as pe,a1n as Gs,rE as ua,a1o as Ns,a1p as qs,sK as Js,sL as Ws,WP as Ys,VV as Hs,a0y as Ks,a1q as Xs,WV as ma,WU as Ke,a1r as pa,mq as Qs,a1s as Zs,a1t as eo,a1u as to,a1v as ao,qz as no,a1w as so,a1x as oo,a1y as co,ru as io,md as lo,m4 as ro,a1z as uo,mc as ha,Xb as mo,a1A as po,a1B as ho,us as So,u3 as go,u2 as Ct,a1C as Co,a1D as fo,a1E as Io,a1F as ko,nJ as bo,br as To,nE as Sa,nq as Po,a1G as yo,g$ as vo,nB as Eo,sU as Ao,sW as xo,sD as wo,VY as Ro,VZ as Do,F0 as Fo,E$ as _o,Fg as Mo,a1H as ga,sJ as Uo,a1I as Oo,rU as Bo,r_ as Vo,s9 as jo,rX as Lo,a1J as zo,s8 as $o,sP as Go,a1K as No,t0 as qo,sx as Jo,t6 as Wo,sC as Yo,rF as Ho,a1L as Ko,qX as Xo,qv as Qo,qC as Ca,rp as Zo,a1M as ec,a1N as tc,a1O as ac,a1P as nc,a1Q as sc,a1R as oc,a1S as cc,ta as ic,a1T as lc,a1U as rc,a1V as fa,uD as dc,tW as uc,tL as Ia,tJ as mc,a1W as pc,ty as hc,td as Sc,tM as gc,a1X as Cc,a1Y as fc,tj as Ic,a1Z as kc,te as bc,ti as Tc,tg as Pc,tS as yc}from"./zeni-epic-state-95zxmizy.js";import ja from"./NotFoundScreen-BatgS8le.js";import{a as s,R as La}from"./sentry-DZ9rNYfw.js";import{n as Te,S as vc}from"./mui-C33Oegsm.js";import{o as Be,S as H,k as Q,p as te,ar as za,at as $a,dP as Ec,dQ as Ac,M as Ga,z as st,dR as xc,dS as wc,dT as Rc,af as Ue,dU as Dc,dV as ka,bb as ba,dW as Fc,a8 as Na,dX as _c,j as et,a as Mc,dY as Uc,dZ as Oc,O as Bc,K as Vc,d_ as jc,d$ as Lc,e0 as zc,b5 as $c,bt as Gc,ac as Nc,b6 as qc,b7 as Jc,G as Wc,w as Yc,e1 as Hc,aw as Ta,e2 as Kc}from"./index-DuxR1XDX.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-CvEN7QS-.js";import{g as Pa,b as Xc,c as Qc,h as Zc,a as ei,i as ti,r as ai,C as ni}from"./TransactionDetailScreen-KBMzz0Xq.js";import{u as si}from"./useActualMatchingMatchDetail-DZnxtuQj.js";import{d as oi}from"./decodeURIComponentSafe-hAviH84T.js";import{m as Ja,a as Wa}from"./expenseAutomationHelper-BzOPc0En.js";import{u as Ya,a as Ha,w as ci}from"./withTransactionSidePanel-qep2Sc8k.js";import{b as ii,S as li,a as ri,J as di}from"./ScheduleDetailsPrepaidExpensesScreen-UKD1lb2-.js";import{s as ya,i as Ka,h as ui,v as mi,c as pi}from"./routePaths-B1syYHWh.js";import{a as ft}from"./accountMappingHelper-Ci74NLEW.js";import{D as hi}from"./DrawerScreen-I5-Ak-b_.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./useInitialThreadRequest-Chu-ipGI.js";import"./stripSplatSuffix-Te2Zqy4u.js";import"./pathToGoBack-Bgu6njoM.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="2d219bb3-5491-47a2-a5be-6037b8ad0589",t._sentryDebugIdIdentifier="sentry-dbid-2d219bb3-5491-47a2-a5be-6037b8ad0589")}catch{}})();const Si=()=>{const t=he(),n=nt(),f=be(),I=_((C=>ke(C))),{useFeatureGate:k}=Be(),{isFeatureEnabled:o}=k(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(H.aiAuditScorePercentage),E=_((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=_((C=>Qn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=qa({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,L=!1)=>{t(_e({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:L}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(Zn(I.tenantId,C))}),[I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),g=E[I.tenantId],u=s.useCallback((()=>{const C=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(g.month,g.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,C??null),x(g,I.tenantId,!0)}),[x,g,I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=te(f.state?.pathnameStackToGoBack,f.pathname),A=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&g!=null){const C=l.monthEndCloseChecks.monthEndCloseCheckList.find((h=>h.progress<100));if(C!=null)return void n(`./${C.id}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=za();return $a({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{g!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&x(g,I.tenantId)}),[x,g,l.fetchState,I.tenantId,p]),s.useEffect((()=>{g!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(es(g))}),[g,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const C=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(C)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const C=f.state?.referrer;Q.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,C??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),b.jsx(gi,{children:b.jsx(Ec,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},gi=Te.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-Oqbhz69O.js";import{a as r}from"./sentry-DaOZuZWH.js";import{ax as l,ay as p,R as m,a5 as b}from"./index-B6CDEkoa.js";import"./mui-CXd5PBjh.js";import f from"./NotFoundScreen-CjtnHhJo.js";import{h as c,g as u}from"./core-DWK-yy-f.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="84290e3a-b5eb-4a67-b663-116401857d00",e._sentryDebugIdIdentifier="sentry-dbid-84290e3a-b5eb-4a67-b663-116401857d00")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=b(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:m(o),onDemoClick:t,onGoBack:i}):s.jsx(f,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
1
+ import{j as s}from"./liveblocks-BjcYyeQ6.js";import{a as r}from"./sentry-DZ9rNYfw.js";import{ax as l,ay as p,R as m,a5 as b}from"./index-DuxR1XDX.js";import"./mui-C33Oegsm.js";import f from"./NotFoundScreen-BatgS8le.js";import{h as c,g as u}from"./core-B-8b0iz9.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="84290e3a-b5eb-4a67-b663-116401857d00",e._sentryDebugIdIdentifier="sentry-dbid-84290e3a-b5eb-4a67-b663-116401857d00")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=b(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:m(o),onDemoClick:t,onGoBack:i}):s.jsx(f,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -1 +1 @@
1
- import{a as r}from"./sentry-DaOZuZWH.js";import{u as l,h as f,g as m}from"./core-DWK-yy-f.js";import{hY as p,UB as g,UC as _}from"./zeni-epic-state-BHC2ac1c.js";import{u as b,L as h,z as y}from"./index-B6CDEkoa.js";import"./liveblocks-Oqbhz69O.js";import"./recharts-BTQwLLFS.js";import"./mui-CXd5PBjh.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2a93d830-e3af-449b-98b3-7756e027ec7c",e._sentryDebugIdIdentifier="sentry-dbid-2a93d830-e3af-449b-98b3-7756e027ec7c")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
1
+ import{a as r}from"./sentry-DZ9rNYfw.js";import{u as l,h as f,g as m}from"./core-B-8b0iz9.js";import{hY as p,UB as g,UC as _}from"./zeni-epic-state-95zxmizy.js";import{u as b,L as h,z as y}from"./index-DuxR1XDX.js";import"./liveblocks-BjcYyeQ6.js";import"./recharts-DkYxIsLi.js";import"./mui-C33Oegsm.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2a93d830-e3af-449b-98b3-7756e027ec7c",e._sentryDebugIdIdentifier="sentry-dbid-2a93d830-e3af-449b-98b3-7756e027ec7c")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -1 +1 @@
1
- import{n as s}from"./liveblocks-Oqbhz69O.js";import{j as d}from"./core-DWK-yy-f.js";import{fF as a}from"./zeni-epic-state-BHC2ac1c.js";import"./sentry-DaOZuZWH.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]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
1
+ import{n as s}from"./liveblocks-BjcYyeQ6.js";import{j as d}from"./core-B-8b0iz9.js";import{fF as a}from"./zeni-epic-state-95zxmizy.js";import"./sentry-DZ9rNYfw.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]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -0,0 +1,2 @@
1
+ import{j as a}from"./liveblocks-BjcYyeQ6.js";import{a as r}from"./sentry-DZ9rNYfw.js";import{u as L,h as A,i as R,j as C,t as G,l as O,s as H,g as Z,N as B,n as ie,o as x}from"./core-B-8b0iz9.js";import{a9 as nt,k as S,ar as _,V as m,cd as tt,ce as it,cf as ot,cg as at,ch as st,ci as ct,cj as rt,ck as lt,cl as dt,cm as ut,cn as gt,co as mt,p as W,cp as vt,cq as pt,af as se,cr as St,cs as ft,z as ye,ct as ht,cu as It,cv as Ct,cw as Et,cx as kt,cy as yt,cz as xt,cA as bt,K as jt,aj as dn,cB as Dt,cC as Lt,cD as At,cE as Pt,cF as $t,cG as Ft,cH as wt,cI as Rt,cJ as _t,cK as Tt,cL as Ot,t as He,j as Pe,cM as Mt,cN as Nt,cO as Ut,cP as Bt,cQ as Vt,cR as Ht,cS as qt}from"./index-DuxR1XDX.js";import"./mui-C33Oegsm.js";import{A as Q}from"./AddressScreen-DvJ6yyMx.js";import M from"./NotFoundScreen-BatgS8le.js";import{ZQ as zt,ZR as Qt,vp as qe,ZS as K,vS as ce,ZT as $e,ZU as re,wt as xe,wA as Kt,wF as un,ZV as Fe,wx as gn,y7 as ze,vR as Qe,ZW as Gt,ZX as mn,wQ as be,ZY as le,wU as Zt,ZZ as Wt,Z_ as vn,wX as pn,z2 as Xt,Z$ as pe,_0 as Ke,_1 as Sn,vP as Jt,_2 as Yt,vJ as ei,_3 as ni,yk as ti,_4 as fn,yt as Ge,_5 as ii,yq as oi,_6 as we,gh as ai,_7 as ne,_8 as te,xa as si,vX as Ze,w0 as hn,v_ as ci,vU as ri,x3 as li,w2 as di,xc as ui,_9 as je,xl as In,xj as X,xh as de,xg as gi,_a as Cn,yz as We,_b as mi,vQ as En,_c as Re,wb as De,w8 as Le,wl as kn,wk as _e,w5 as vi,we as yn,wn as oe,fF as Te,VC as xn,vT as Oe,wi as pi,wj as Si,wh as fi,_d as hi,wV as Ii,wR as bn,_e as jn,vD as Xe,_f as Ci,vz as Ei,_g as ki,yF as yi,yJ as q,yE as xi,xN as Se,_h as bi,_i as Dn,yS as Je,_j as ji,yP as Di,_k as Ln,xQ as Li,xR as V,xU as Ai,_l as An,y2 as Ce,_m as Pi,xb as Pn,U8 as $n,_n as $i,yc as Fi,_o as Fn,_p as wi,_q as Ri,_r as _i,zH as Ti,_s as Oi,_t as wn,yZ as Rn,_u as _n,zF as Ee,_v as Mi,zC as Ni,_w as Ui,_x as Bi,_y as Vi,_z as Hi,_A as qi,_B as Ye,_C as zi,eg as Qi,zL as Ki,_D as Me,xv as Gi,xq as Zi,_E as ue,xG as Tn,xy as ge,xx as Wi,xB as On,_F as Xi,xw as Ji,_G as Mn,z3 as Nn,zu as en,zp as Yi,_H as eo,z4 as no,_I as to,zv as io,zz as oo,_J as Ne,wv as Un,zg as ao,ww as so,_K as co,_L as Bn,c8 as ro,ms as lo,mt as uo,_M as nn,wu as me,gl as go,mz as mo,zm as Vn,zX as vo,zj as Hn,uX as po,zU as tn,uL as So,zR as on,hS as fo,UB as an,UC as ho,Gh as qn,hK as Io,_N as Co,Vr as Eo,_O as ko,A0 as ke,A1 as yo,_P as xo,_Q as zn,z_ as bo,_R as jo,_S as Do,yg as Lo,_T as Ao}from"./zeni-epic-state-95zxmizy.js";import{M as Po}from"./MobileAppDrawer-0TaE2Qid.js";import{q as ve}from"./QBOConnectionScreen-BiN0lu_W.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-ECD0Ec-b.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e6c826c0-a044-4093-86f3-4705657846f0",t._sentryDebugIdIdentifier="sentry-dbid-e6c826c0-a044-4093-86f3-4705657846f0")}catch{}})();const $=({event:t,isReady:e=!0})=>e?a.jsx(nt,{analytics:S,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function $o(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:f,items:p,nextCursor:h,auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b}=C(zt),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${n??""}/invoicing`,I=r.useCallback(((P,U)=>{const T=Qt(y,P,U,D);T!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:P,entityId:U,fromScreen:"audit_log"}),e(T))}),[D,e,y]);r.useEffect((()=>{const P=setTimeout((()=>d(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,t]);const j=g==="Not-Started"||g==="In-Progress"&&p.length===0,E=g==="In-Progress"&&p.length>0,F=g==="Completed";return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:F}),a.jsx(tt,{auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b,entries:p,hasMore:f,isLoading:j,isLoadingMore:E,searchValue:s,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{f&&h!=null&&t(qe({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function fe(t,e=!1){const n=L(),i=C((c=>K(c).productNextCursor!=null)),s=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&s!=null&&n(ce({cursor:s,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,s])}function J(t,e,n,i){const[s,o]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),o((v=>v+1)))}),[c,e]),s}const Fo=new Set(["plan"]),wo=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?s=>{i!==""&&t(gn({action:s,id:i}))}:void 0,onEditChange:s=>{i!==""&&t(Fe({id:i,localData:s}))},onSaveEdit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(un({id:i}))},onSubFamilyLifecycleAction:(s,o)=>{i!==""&&t(Kt({action:o,id:s,parentItemId:i}))}}}))(it);function Ro(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=(d=s.get("kind"))!=null&&Fo.has(d)?d:"plan";var d;const l=C((k=>$e(k,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(re({id:n})),()=>{t(re({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:c}))}),[o,n,c,t]);const g=r.useCallback((k=>t(xe({cacheOverride:!0,id:k,kind:c}))),[t,c]),f=J(l.fetchState,l.isFormLoading,n,g),p=u==="Completed"&&!l.isFormLoading;fe(o,!0);const[h,D]=r.useState(p?n:void 0);r.useEffect((()=>{n!=null&&p&&D(n)}),[n,p]);const b=h!==n&&(u==="Not-Started"||u==="In-Progress"||l.isFormLoading);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:p}),a.jsx(wo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:b,view:l},f)]})}const _o=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=$e(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:s}=e,o=s!=null?`${n}/catalog/${encodeURIComponent(s)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(re({id:s})),e.navigate(`${n}/catalog`)},onChange:c=>{t(Fe({id:s,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(un({id:s}))}}}))(ot);function Mo(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=n!=null,d=s.get("type"),l=d!=null&&_o.has(d)?d:void 0,v=(u=s.get("kind"))!=null&&To.has(u)?u:"plan";var u;const g=C((f=>$e(f,n)));return fe(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:v}))}),[o,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(Fe({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const f=g.savedItemId??n,p=f!=null?`/${i}/invoicing/catalog/${encodeURIComponent(f)}`:`/${i}/invoicing/catalog`;e(p),t(re({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),a.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",s=e.activeTab==="all",o=i?n.plans:s?[...n.plans,...n.products]:n.products,c=i||s&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:s&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",s=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=No[e.activeTab];S.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(gn({action:Gt(d),id:c}))},onLoadMore:()=>{if(s)return e.planNextCursor!=null&&t(Qe({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Qe({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(at);function Bo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),f=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),p=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:p,type:"plan"})),[p]),D=r.useMemo((()=>({search:p,type:"addon|charge"})),[p]),b=C((P=>K(P))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",F=b.runningActionId??null;return r.useEffect((()=>{const P=setTimeout((()=>v(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[i,t,h,D,f]),r.useEffect((()=>{i&&(p!==k||f?.field!==y?.field||f?.dir!==y?.dir)&&t(ze({cacheOverride:!0,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[k,y,i,t,h,D,p,f]),N(b.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),a.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:s,sortState:u,planFilters:h,productFilters:D,sort:f,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:F,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Vo=O((function(t,e){const n=mn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(le({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(Wt({id:i,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:s}),t(Zt({id:i}))}}}))(st);function Ho(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,savedCouponId:c}=C((d=>mn(d,n)));return r.useEffect((()=>{s&&t(be({id:n}))}),[s,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(le({id:n}))}}),[o,c,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCouponFormPage}),a.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=vn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:s=>{e(Sn(s))},onSubmit:()=>{const s=Yt(t.localData);S.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:s.customer_id,lineItemCount:s.line_items?.length}),e(ei(s))}}}))(rt);function zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),[i]=G(),{areTenantIdsInSync:s}=_(),o=i.get("customerId"),c=C((I=>vn(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(pn),g=C((I=>Xt(I))),f=C(pe),p=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,D=p||h,b=g.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(t(Ke()),()=>{t(Ke())})),[t]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,t(Sn({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{s&&t(Jt({cacheOverride:!1}))}),[s,t]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(j)}}),[d,v,e,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),D?a.jsx(ct,{}):a.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(lt);function Ko(){const t=L(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>ni(d,n??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&n!=null&&t(ti({id:n}))}),[s,n,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),a.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=fn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(dt);function Zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,creditNoteListFetchState:b}=C((y=>{const I=fn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Ge({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ge({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),a.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ii(y)),onSortChange:v})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:s=>{t(je({id:i,localData:s}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(X(de)),t(gi({id:i}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",de,i),o=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(je({id:i,localData:s})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:s=>t(ui({cacheOverride:s,customerId:i})),onSendPaymentLink:(s,o,c)=>t(di({body:c,customerId:i,email:s,subject:o})),onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)}}}))(mt);function Xo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((T=>we(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[v,u]=r.useState(!1),[g,f]=r.useState(!1),[p,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const D=p===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const T=c.record.sendLinkState.fetchState;E.current!=="Error"&&T==="Error"&&t(ai({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=T}),[t,c.record.sendLinkState.fetchState]);const F=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ne()),t(te()),()=>{t(ne()),t(te())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(si({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&j&&t(Ze({customerId:i}))}),[o,i,t,j]);const P=r.useCallback((T=>t(hn({id:T}))),[t]),U=J(c.fetchState,c.isFormLoading,i,P);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),a.jsx(Wo,{customerId:i??"",editView:c,hasLoadedRecord:D,location:n,navigate:e,tenantEmailDomain:s,onAddPaymentMethod:()=>{t(ne()),i!=null&&j&&t(Ze({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(te()),f(!0)}},U),a.jsx(ut,{errorMessage:F,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&t(ri({customerId:i}))},onClose:()=>{u(!1),t(ne())},onSavePaymentMethod:T=>{i!=null&&t(ci({customerId:i,data:T}))}}),a.jsx(gt,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{f(!1),t(te())},onSubmit:({amount:T,description:ee})=>{i!=null&&t(li({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const Jo=O((function(t,e){const n=we(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(Cn({id:i})),t(X(de)),e.navigate(`${n}/customers`)},onChange:c=>{t(je({id:i,localData:c}))},onOpenAddress:()=>{const c=Qn(e.tenantEmailDomain??"",de,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:s}),t(In({id:i}))}}}))(vt);function Yo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),{fetchState:c,savedCustomerId:d}=C((l=>we(l,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${s}/invoicing/customers/${encodeURIComponent(l)}`:`/${s}/invoicing/customers`;e(v),t(Cn({id:i}))}}),[c,d,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerFormPage}),a.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:s})]})}const ea=O((function(t){const e=pe(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,s)=>{switch(s){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(En({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function na(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,customerListFetchState:b}=C((y=>{const I=pe(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(We({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),a.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(mi(y)),onSortChange:v})]})}const Ae=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{filters:n,sessionId:i,view:s}=e,o=i==null?void 0:s.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:n,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Ae(s,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:s,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Ae(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",f=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>s(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&t(Le({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&t(_e(o))},onRollback:f?()=>{o!=null&&t(kn(o))}:void 0}}))(St);function ia(){const t=L(),e=A(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),[o,c]=r.useState({}),d=C(Re),l=Ae(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{s&&n!=null&&t(De(n))}),[s,t,n]),r.useEffect((()=>{if(!s||n==null)return;const p=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(p)}),[s,t,o,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!s||n==null||!u)return;const p=setInterval((()=>{t(De(n)),t(Le({...o,sessionId:n}))}),3e3);return()=>clearInterval(p)}),[s,t,o,u,n]);const g=r.useMemo((()=>{if(n==null)return;const p=new URLSearchParams;o.moduleId!=null&&p.set("module_id",o.moduleId),o.level!=null&&p.set("level",o.level),o.outcome!=null&&p.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&p.set("search",o.search.trim());const h=p.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),f=v?.fetch.fetchState??"Not-Started";return N(f)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&f!=="Not-Started"}),a.jsx(ta,{downloadUrl:g,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Kn=t=>`invoicing_active_migration:${t}`,ae=(t,e)=>{if(t!=null&&t!=="")try{const n=Kn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:s,statusRows:o}=e.view;return{isLoading:!(s.fetchState!=="Not-Started"&&s.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,s=o=>{const c=o??null;t(oe(c)),ae(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),s(o)},onNewImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),s()},onRetrySession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(_e(o)),s(o)},onRollbackSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(ft);function aa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(Re);r.useEffect((()=>{i&&(t(vi()),t(yn()))}),[i,t]);const o=s.statusFetch.fetchState==="Completed"&&s.sessionsFetch.fetchState==="Completed";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),a.jsx(oa,{navigate:e,tenantEmailDomain:n,view:s})]})}const sa=O((function(t,e){const{activeId:n,integrationsView:i,settings:s,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:s?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:s?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:s}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{S.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(fi())},onGoToIntegrations:()=>{i(`/${s}/invoicing/settings`)},onGoToOverview:()=>i(`/${s}/invoicing/overview`),onRetry:()=>{n!=null&&t(_e(n))},onSaveLater:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(Si(n))},onUpload:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(pi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${s}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ht);function ca(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(pn),o=C(Te).companyId??ye.getSignedInUserTenant(n??"")?.companyId,c=C((p=>xn(p,o))),d=C(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((p=>p.id===v)):void 0;r.useEffect((()=>{i&&(t(Oe()),t(yn()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const p=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Kn(h))}catch{return null}})(n);p!=null&&t(oe(p))}),[l,t,n]),r.useEffect((()=>{ae(n,l)}),[l,n]);const g=u?.status,f=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!f)return;const p=setInterval((()=>{t(De(v))}),3e3);return()=>clearInterval(p)}),[i,v,f,t]),r.useEffect((()=>{g==="done"&&(t(oe(null)),ae(n,null))}),[t,g,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportMigratePage}),a.jsx(sa,{activeId:v,integrationsView:c,navigate:e,settings:s,tenantEmailDomain:n,view:d,onBack:()=>{t(oe(null)),ae(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ra=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:s=>{t(bn({action:s,id:i}))},onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(Ii({data:s,id:i}))}}}))(It);function la(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((h=>hi(h,n))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[n,t]),r.useEffect((()=>{s&&t(be({id:n}))}),[s,n,t]);const f=r.useCallback((h=>t(be({cacheOverride:!0,id:h}))),[t]),p=J(o.fetchState,o.isFormLoading,n,f);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),a.jsx(ra,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},p)]})}const da=O((function(t){const e=jn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,s)=>{t(bn({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Ei({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ct);function ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=jn(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),a.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>t(Ci(I)),onSortChange:v})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,s=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCancel:s?()=>t(q({action:"cancel",id:i})):void 0,onResolve:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(kt);function ma(){const t=L(),e=A(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((E=>ki(E,n??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[f,p]=r.useState(),[h,D]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),p(void 0),D(!1)}),[]),k=r.useCallback((()=>{if(n==null)return;t(yi({id:n})),v("idle"),g(!1);const E=o.emailPreview.preview;p(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),D(!0)}),[n,t,o.emailPreview.preview]),y=r.useCallback((E=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:E,id:n})))}),[n,t,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{s&&n!=null&&t(xi({id:n}))}),[s,n,t]),r.useEffect((()=>{s&&d!=null&&t(Se({invoiceId:d}))}),[s,d,t]),r.useEffect((()=>{v("idle"),g(!1),p(void 0),D(!1)}),[n]),r.useEffect((()=>{s||(v("idle"),g(!1),p(void 0),D(!1))}),[s]),r.useEffect((()=>{h&&f==null&&o.emailPreview.preview!=null&&p({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,f,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(n!=null&&t(bi({id:n})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,b,t,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),a.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:j,onSendEmail:k}),a.jsx(Et,{initialDraft:f,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const va=O((function(t){const e=Dn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{s!=="retry"&&s!=="resume"&&s!=="resolve"&&s!=="cancel"||t(q({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(yt);function pa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,dunningCaseListFetchState:b}=C((y=>{const I=Dn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),a.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ji(y)),onSortChange:v})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Ai({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
+ `).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))}}}))(xt);function fa(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((p=>Ln(p,n??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;r.useEffect((()=>{s&&n!=null&&t(Li({invoiceId:n}))}),[s,n,t]);const g=r.useCallback((p=>t(Se({invoiceId:p}))),[t]),f=J(o.actionState.fetchState,o.fetchState==="In-Progress",n,g);return N(c)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o},f)]})}const ha=O((function(t){const e=An(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{switch(s){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,s)=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))},onLoadMore:()=>{e.nextCursor!=null&&t(Pn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function Ia(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=An(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(Ce({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ce({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),a.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{t(Pi(I)),t(Ce({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function sn(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=jt(),s=dn(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C($n),v=$i(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=f=>{c(f)};return l==="completed"?a.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?a.jsx(B,{to:`${u}/settings`,replace:!0}):a.jsxs(a.Fragment,{children:[a.jsx(Po,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),a.jsx(Dt,{analytics:S,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:s("invoicing_promo"),onAcceptClick:()=>{t(Fi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Ca=O((function(t,e){const n=Fn(t,e.invoiceId),{invoice:i,localData:s,reasonCodeOptions:o,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:s,reasonCodeOptions:o,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:s=>{t(Oi({localData:s}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ti())}}}))(Lt);function Ea(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((p=>Fn(p,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(wi()),g.current=null}),[t,n]),r.useEffect((()=>{s&&n!=null&&t(Se({invoiceId:n}))}),[s,t,n]),r.useEffect((()=>{c!=null&&n!=null&&o==="Completed"&&g.current!==n&&(g.current=n,t(Ri({localData:_i(c)})))}),[t,o,c,n]);const f=r.useRef(v.fetchState);return r.useEffect((()=>{const p=f.current;f.current=v.fetchState,p!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ka=O((function(t){return{invoicingOverview:wn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Rn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(At);function ya(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>wn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Rn(s))}),[i,t,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),a.jsx(ka,{navigate:e,selectedPeriod:s,tenantEmailDomain:n})]})}const xa=O((function(t){const e=_n(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Pt);function ba(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:f,appliedSearch:p,appliedSort:h,nextCursor:D,transactionListFetchState:b,transactions:k}=C((F=>{const P=_n(F);return{activeType:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,transactionListFetchState:P.fetchState,transactions:P.transactions}}),H),y=b==="Completed",I=`/${n}/invoicing`,j=r.useCallback((F=>{const P=k.find((T=>T.id===F)),U=P?.linkedInvoices?.[0]?.invoiceID??P?.invoiceID;U!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((F=>{const P=k.find((U=>U.id===F))?.customerID;P!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:P,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(P)}`))}),[e,I,k]);return r.useEffect((()=>{const F=setTimeout((()=>d(s)),300);return()=>clearTimeout(F)}),[s]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ee({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),a.jsx(xa,{navigate:e,tenantEmailDomain:n,activeType:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onTypeChange:F=>{t(Mi(F)),t(Ee({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const ja=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function cn(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=n!=null&&n!=="",c=C(pe),d=C((E=>Ui(E))),l=C(Bi),v=C((E=>Ln(E,n??""))),u=v.invoice,g=`/${i}/invoicing`,f=r.useRef(null),p=r.useRef("");r.useEffect((()=>{t(Vi()),f.current=null,p.current=""}),[t,n]),r.useEffect((()=>{s&&t(o&&n!=null?Se({invoiceId:n}):En({filters:{},keepExistingListItems:!1}))}),[s,t,n,o]),r.useEffect((()=>{o&&u!=null&&n!=null&&v.fetchState==="Completed"&&f.current!==n&&(f.current=n,t(Hi({contextInvoiceId:n,localData:qi(u)})))}),[t,u,n,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==p.current&&(p.current=E,t(Pn({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(Ye({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[t,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const D=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:ja(E)})))),[c.customers]),b=C((E=>zi(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(F=E.amountDue,P=Qi.currencySymbol,wt("0,0.00",F,P)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var F,P}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",F=u.amountDue?.amount??0;return{amountDue:$t("0,0.00",u.amountDue),amountDueValue:F,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),a.jsx(Ft,{customers:D,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{t(Ye({localData:E}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Ki(o?n??void 0:void 0))}})]})}const Gn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Da=O((function(t,e){const{editView:n}=e,i=n.subscription,s=i?.status,o=s!=null&&e.commercialEditAllowedFromStatuses.includes(s);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=="",o=(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(On({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ue({id:i,localData:c}))},onChangeTermEnd:s?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(X(ge)),t(Wi({id:i}))},onOpenAddress:()=>{const c=Gn(e.tenantEmailDomain??"",ge,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ue({id:i,localData:c})),t(Tn({id:i}))},onCancelSubscription:s?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:s?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Rt);function La(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((k=>Me(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed"&&!c.isFormLoading,[f,p]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&p(i)}),[i,g]);const h=f===i;fe(o),r.useEffect((()=>{o&&i!=null&&t(Gi({id:i}))}),[o,i,t]);const D=r.useCallback((k=>t(Zi({id:k}))),[t]),b=J(c.fetchState,c.isFormLoading,i,D);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),a.jsx(Da,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:s},b)]})}const Aa=O((function(t,e){const n=Me(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=null?"edit":"create";return{onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Mn({id:i})),t(X(ge)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(ue({id:i,localData:o}))},onOpenAddress:()=>{const o=Gn(e.tenantEmailDomain??"",ge,i),c=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:s}),t(Tn({id:i}))}}}))(_t);function Pa(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),[o]=G(),{areTenantIdsInSync:c}=_(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((f=>Xi(f,i))),u=C((f=>Me(f,i).localData));fe(c),r.useEffect((()=>{c&&t(Ji({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(ue({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const f=v??i,p=f!=null?`/${s}/invoicing/subscriptions/${encodeURIComponent(f)}`:`/${s}/invoicing/subscriptions`;e(p),t(Mn({id:i}))}}),[l,v,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),a.jsx(Aa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:s})]})}const $a=O((function(t){const e=Nn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(s,o,c)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:s}),t(On({action:o,id:s,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(s,o)=>{const c=o?.trim()??"";c!==""&&i(s,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(s,o,c)=>{o!=="pause"?i(s,o):i(s,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(s,o)=>{i(s,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:s}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(no({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tt);function Fa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Nn(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),H),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(s)),300);return()=>clearTimeout(j)}),[s]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(en({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&t(Yi())}),[k,i,t]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),a.jsx($a,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>t(eo(j)),onSortChange:v})]})}const wa=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onInvoiceClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onCapture:i!==""?()=>{S.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(oo({action:"capture",id:i}))}:void 0}}))(Ot);function Ra(){const t=L(),e=A(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>to(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&i!=null&&t(io({id:i}))}),[s,i,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),a.jsx(wa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Zn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:s=!1}=t,o=L(),{areTenantIdsInSync:c}=_(),d=C(Ne),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(s&&v!=="Not-Started"||o(Un()),n&&o(ao()))}),[c,o,e,n,s]),r.useEffect((()=>{e&&c&&l&&i&&o(so())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const _a={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function Y(t){const e=L(),{areTenantIdsInSync:n}=_(),{tenantEmailDomain:i}=R(),{fetchState:s,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(co),{configError:u,configFetchState:g,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:p,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D}=C(Bn),b=C(Ne);Zn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Te),y=t==="dunning"||t==="quickbooks",I=k.companyId??ye.getSignedInUserTenant(i??"")?.companyId,j=C((w=>xn(w,I))),E=ro(k.userRole??[]),F=k.tenantId??"",P=ye.getSignedInUser(),U={userId:P?.userId??"",sessionId:P?.zeniSessionId??"",tenantId:F},T=c?.fileId,ee=C((w=>T!=null&&T!==""?lo(w,T):void 0)),Ue=C((w=>T!=null&&T!==""?uo(w,T):void 0)),Wn=T!=null&&T!==""&&ee!=null?{[T]:ee}:{},Xn=T!=null&&T!==""&&Ue!=null?{[T]:Ue}:{};r.useEffect((()=>(e(nn()),()=>{e(nn())})),[e]),r.useEffect((()=>{n&&(s!=="Not-Started"&&s!=="Error"||e(Oe()))}),[n,e,s]),r.useEffect((()=>{n&&y&&g==="Not-Started"&&e(me())}),[n,e,g,y]),r.useEffect((()=>{if(!n)return;const w=P?.userId;w!=null&&w!==""&&F!==""&&He.shouldFetchActiveTenant(F)&&(He.markActiveTenantFetchStarted(F),e(go(w,F,P?.zeniSessionId)))}),[n,e,P?.userId,P?.zeniSessionId,F]);const Jn=f.length>0||p.length>0,Yn=s==="Not-Started"||s==="In-Progress"&&l==null||y&&!Jn&&(g==="Not-Started"||g==="In-Progress"),et=s==="Completed"&&(!y||g==="Completed"),Be=j.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,he=se?.invoicingMicroServiceBaseUrl,Ve=he!=null&&he.length>0?`${he}/1.0/webhooks/stripe`:"",Ie={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:w=>e(on(w)),onDisconnect:(w,z)=>{F!==""&&e(Io(F,w,an(z)))},onDisconnectStripe:()=>e(tn()),onReconnectQBO:()=>{const w=k.tenantEmailDomain??i??"";ve.init("/connection/auth",w),ve.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(qn())},onSaveChargeBeeCredentials:(w,z)=>{Be!=null&&F!==""&&e(fo(F,Be,an("revenue"),ho("chargebee"),{api_key:w,site:z}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve};return{authParams:U,deleteFileStatusById:Wn,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:Ie,isInvoicingPageReady:et,isLoading:Yn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:p,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve,updateFileStatusById:Xn,onConnectStripe:w=>e(on(w)),onDeleteFile:w=>e(So(w,F)),onDisconnectStripe:()=>e(tn()),onEditFileName:(w,z)=>e(po(w,z.split(".")[0],F)),onReconnectQBO:Ie.onReconnectQBO,onRefreshQBO:Ie.onRefreshQBO,onRetryQboSyncTask:w=>e(Hn(w)),onSave:w=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(vo({settings:w,snackbarSection:_a[t??""]}))},onStartQboBackfill:w=>e(Vn(w)),updateFilesEntity:w=>{S.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(mo({files:w}))}}}function rn({appContent:t}){const e=A(),n=Z(),i=L(),{tenantEmailDomain:s}=R(),o=Y("branding"),c=C((v=>Co(v))),d=C((v=>Eo(ke,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(ko()),i(X(ke)))}),[c.saveState.fetchState,i]);const l=Pe(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Mt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(xo({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${s}/invoicing/settings/branding/${ke}/`,u=W(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(yo()),updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=A(),e=Y("dunning");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Nt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=A(),e=Y("integrations");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Ut,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=A(),e=Y("payment-destination");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Bt,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const Na=O((function(t){const e=zn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(Do({localData:e}))},onReset:()=>{t(jo())},onRetryTask:e=>{t(Hn(e))},onSave:()=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(bo())},onStartBackfill:e=>{t(Vn(e))}}}))(Vt);function Ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=C(Te),{configFetchState:s,saveState:o,settingsFetchState:c}=C(zn),d=Pe(o.fetchState);return r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&e("..")}),[e,d,o.fetchState]),r.useEffect((()=>{c!=="Not-Started"&&c!=="Error"||t(Oe())}),[t,c]),r.useEffect((()=>{s==="Not-Started"&&t(me())}),[s,t]),Zn({fetchSyncHealth:!0,loadAccountingPickers:!0}),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage}),a.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{ve.init("/connection/auth",i.tenantEmailDomain??n??""),ve.handleClick()},onRefresh:()=>t(qn())})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=dn(),e=L(),n=A(),[i,s]=G(),o=Y(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Bn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const f=Ba[g];s({},{replace:!0}),f!=null&&n(f,{replace:!0})}),[g,n,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Ht,{analytics:S,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Lo())}})]})}function ln(){return a.jsxs(ie,{children:[a.jsx(x,{index:!0,element:a.jsx(Va,{})}),a.jsx(x,{path:"payment-destination",element:a.jsx(Ma,{})}),a.jsx(x,{path:"branding",element:a.jsx(rn,{})}),a.jsx(x,{path:"branding/:addressType",element:a.jsx(rn,{appContent:a.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),a.jsx(x,{path:"integrations",element:a.jsx(Oa,{})}),a.jsx(x,{path:"dunning",element:a.jsx(Ta,{})}),a.jsx(x,{path:"quickbooks",element:a.jsx(Ua,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:"..",replace:!0})})]})}function Ss(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),{enableState:s,fetchState:o,status:c}=C($n),d=Pe(s.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=C((g=>Ne(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,t(me({cacheOverride:!1}))):t(me({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&u==="Not-Started"&&t(Un())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&s.fetchState==="Completed"&&(e(`${l}/catalog`),t(Ao()))}),[d,s.fetchState,l,t,e]),c==null&&o!=="Error"?a.jsx(qt,{fetchState:"In-Progress"}):c==="not_started"?a.jsxs(ie,{children:[a.jsx(x,{path:"promo",element:a.jsx(sn,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?a.jsxs(ie,{children:[a.jsx(x,{path:"promo",element:a.jsx(sn,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(ln,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/settings`,replace:!0})})]}):a.jsxs(ie,{children:[a.jsx(x,{path:"/",element:a.jsx(B,{to:"overview",replace:!0})}),a.jsx(x,{path:"overview",element:a.jsx(ya,{})}),a.jsx(x,{path:"promo",element:a.jsx(B,{to:`${l}/overview`,replace:!0})}),a.jsx(x,{path:"customers",element:a.jsx(na,{})}),a.jsx(x,{path:"customers/new",element:a.jsx(Yo,{})}),a.jsx(x,{path:"customers/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"customers/:customer_id",element:a.jsx(Xo,{})}),a.jsx(x,{path:"customers/:customer_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions",element:a.jsx(Fa,{})}),a.jsx(x,{path:"subscriptions/new",element:a.jsx(Pa,{})}),a.jsx(x,{path:"subscriptions/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions/:subscription_id",element:a.jsx(La,{})}),a.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"invoices",element:a.jsx(Ia,{})}),a.jsx(x,{path:"invoices/create",element:a.jsx(zo,{})}),a.jsx(x,{path:"invoices/:invoice_id",element:a.jsx(fa,{})}),a.jsx(x,{path:"invoices/:invoice_id/record-payment",element:a.jsx(cn,{})}),a.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:a.jsx(Ea,{})}),a.jsx(x,{path:"payments",element:a.jsx(ba,{})}),a.jsx(x,{path:"payments/record",element:a.jsx(cn,{})}),a.jsx(x,{path:"payments/:transaction_id",element:a.jsx(Ra,{})}),a.jsx(x,{path:"credits",element:a.jsx(Zo,{})}),a.jsx(x,{path:"credits/:credit_note_id",element:a.jsx(Ko,{})}),a.jsx(x,{path:"discounts",element:a.jsx(ua,{})}),a.jsx(x,{path:"discounts/new",element:a.jsx(Ho,{})}),a.jsx(x,{path:"discounts/:coupon_id",element:a.jsx(la,{})}),a.jsx(x,{path:"dunning",element:a.jsx(pa,{})}),a.jsx(x,{path:"dunning/:case_id",element:a.jsx(ma,{})}),a.jsx(x,{path:"catalog",element:a.jsx(Bo,{})}),a.jsx(x,{path:"catalog/new",element:a.jsx(Mo,{})}),a.jsx(x,{path:"catalog/:item_id",element:a.jsx(Ro,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(ln,{})}),a.jsx(x,{path:"audit_log",element:a.jsx($o,{})}),a.jsx(x,{path:"data_import",element:a.jsx(aa,{})}),a.jsx(x,{path:"data_import/migrate",element:a.jsx(ca,{})}),a.jsx(x,{path:"data_import/:sessionId",element:a.jsx(ia,{})}),a.jsx(x,{path:"*",element:a.jsx(M,{})})]})}export{Ss as default};
@@ -1,4 +1,4 @@
1
- import{j as t}from"./liveblocks-Oqbhz69O.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-DWK-yy-f.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-BHC2ac1c.js";import{a2 as x,H as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,o as ue,S as he,a7 as ge,O as xe,E as fe,e as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-B6CDEkoa.js";import{n as m}from"./mui-CXd5PBjh.js";import f from"./NotFoundScreen-CjtnHhJo.js";import{a as I}from"./sentry-DaOZuZWH.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b542e5ff-f569-4c94-ab05-47235204c79f",e._sentryDebugIdIdentifier="sentry-dbid-b542e5ff-f569-4c94-ab05-47235204c79f")}catch{}})();const Ie=m.div`
1
+ import{j as t}from"./liveblocks-BjcYyeQ6.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-B-8b0iz9.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-95zxmizy.js";import{a2 as x,H as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,o as ue,S as he,a7 as ge,O as xe,E as fe,e as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-DuxR1XDX.js";import{n as m}from"./mui-C33Oegsm.js";import f from"./NotFoundScreen-BatgS8le.js";import{a as I}from"./sentry-DZ9rNYfw.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b542e5ff-f569-4c94-ab05-47235204c79f",e._sentryDebugIdIdentifier="sentry-dbid-b542e5ff-f569-4c94-ab05-47235204c79f")}catch{}})();const Ie=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as u}from"./liveblocks-Oqbhz69O.js";import{a as g}from"./sentry-DaOZuZWH.js";import{u as O,g as _,h as w,t as V,j as l,N as L}from"./core-DWK-yy-f.js";import{z as r,E as M,G as P,U as A,k as N,V as $,$ as q,a0 as G,Y as R}from"./index-B6CDEkoa.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-BHC2ac1c.js";import{n as ne}from"./mui-CXd5PBjh.js";import{u as se}from"./useDeviceId-DqbeMLtN.js";import{f as ae}from"./analyticsHelper-I16kGxOb.js";import{t as ie}from"./getLocaleForTenant-gphiv_jN.js";import"./recharts-BTQwLLFS.js";import"./analytics-aFpUj4gs.js";import"./plaid--nk7zPNe.js";import"./dnd-BQcaJ1VA.js";import"./stripe-cKAAJElX.js";import"./lottie-BLloBrVp.js";import"./lexical-D0wtImar.js";import"./pdf-B7YVgnpS.js";import"./utils-wj3imWq2.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="61d49e01-f580-4606-8e7e-75decca31fbc",t._sentryDebugIdIdentifier="sentry-dbid-61d49e01-f580-4606-8e7e-75decca31fbc")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>Y(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
1
+ import{j as u}from"./liveblocks-BjcYyeQ6.js";import{a as g}from"./sentry-DZ9rNYfw.js";import{u as O,g as _,h as w,t as V,j as l,N as L}from"./core-B-8b0iz9.js";import{z as r,E as M,G as P,U as A,k as N,V as $,$ as q,a0 as G,Y as R}from"./index-DuxR1XDX.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-95zxmizy.js";import{n as ne}from"./mui-C33Oegsm.js";import{u as se}from"./useDeviceId-gFU5q5zf.js";import{f as ae}from"./analyticsHelper-C6SU-53H.js";import{t as ie}from"./getLocaleForTenant-D57C4sYC.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="61d49e01-f580-4606-8e7e-75decca31fbc",t._sentryDebugIdIdentifier="sentry-dbid-61d49e01-f580-4606-8e7e-75decca31fbc")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>Y(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;