@zeniai/web-app-ui 5.3.63-dev → 5.3.64-dev-beta0KB

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 (157) hide show
  1. package/dist/assets/{AccountMappingScreen-BRZHYOUR.js → AccountMappingScreen-C_GVFaoh.js} +2 -2
  2. package/dist/assets/ActualMatchingMatchDetailScreen-Br9CFUye.js +1 -0
  3. package/dist/assets/AddressRoutes-Bw_nh--O.js +1 -0
  4. package/dist/assets/AddressScreen-CvhZrOl1.js +9 -0
  5. package/dist/assets/AiCfoScreen-enlKpZc4.js +22 -0
  6. package/dist/assets/{AppDrawer-DZIMVdFc.js → AppDrawer-BvDyxQG-.js} +1 -1
  7. package/dist/assets/BillPayApprovalRoutes-D18TxHMc.js +1 -0
  8. package/dist/assets/{BillPayRoutes-CUUjBefv.js → BillPayRoutes-CloKoO0m.js} +6 -6
  9. package/dist/assets/{BusinessVerificationPageScreen-DFamYzxa.js → BusinessVerificationPageScreen-wzhfqwbN.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-Cx5KkOYw.js → CardsAiCfoScreen-CsPjsbB8.js} +2 -2
  11. package/dist/assets/{ChargeCardRoutes-DzIBuJeY.js → ChargeCardRoutes-CeG2_2Iv.js} +9 -9
  12. package/dist/assets/CompanyPassportScreen-CTdU0eT4.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-tQkR0Qdq.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-Cfna6QXU.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-CjmJGGJm.js → CustomerOnboardingRoutes-C2PIK8CC.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-ByHBLKcB.js → DashboardRoutes-B6PQcDII.js} +4 -4
  17. package/dist/assets/DefaultTenantHome-R8lvjrth.js +1 -0
  18. package/dist/assets/DomesticWireDetailScreen-BOXpXEFg.js +18 -0
  19. package/dist/assets/{DrawerScreen-B5BqRZEJ.js → DrawerScreen-kd-vUIOU.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-CKVztcFF.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-CZBhc5OO.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-DlYWStt_.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-BiVfvVOh.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-x0fdv66l.js → InboxNotificationsProvider-jZPrqdDf.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-CTeBd6HD.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-C5BKMtwW.js → MagicLinkRoutes-DBawNNk_.js} +20 -20
  27. package/dist/assets/MagicLinkSignInScreen-CKyZ86AC.js +12 -0
  28. package/dist/assets/MobileAppDrawer-thURFqdR.js +1 -0
  29. package/dist/assets/NotFoundScreen-CjcmfT5h.js +1 -0
  30. package/dist/assets/{NotificationRoutes-DICT3yoM.js → NotificationRoutes-B5kGRr3c.js} +1 -1
  31. package/dist/assets/OAuthConsentScreen-DKPtywIw.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-DuKFzXpp.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-Cz1wlNqO.js → PaymentLinkScreen-DgjfMeF_.js} +9 -9
  34. package/dist/assets/PeopleRoutes-BFFXxsrW.js +22 -0
  35. package/dist/assets/PerformanceRoutes-DlDpAJN4.js +1 -0
  36. package/dist/assets/{Preview-Dz6yJNce.js → Preview-CFep9b6s.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-D8eeXRWb.js → QBOConnectionScreen-zn7s2M2b.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-h6pN24Dd.js +1 -0
  39. package/dist/assets/ReimbursementApprovalRuleDetailScreen-La5bMk76.js +1 -0
  40. package/dist/assets/ReimbursementRoutes-DpjqJ1j9.js +68 -0
  41. package/dist/assets/{ReportsRoutes-CqUKv9Uh.js → ReportsRoutes-Tu97hQPr.js} +1 -1
  42. package/dist/assets/RewardsRoutes-C7-L_VuA.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CLEogplJ.js → ScheduleDetailsPrepaidExpensesScreen-BNVCc0tE.js} +5 -5
  44. package/dist/assets/ScreenRoutes-DUiJb0LC.js +2 -0
  45. package/dist/assets/{SettingsRoutes-QcMcR-j3.js → SettingsRoutes-BVrPYY3-.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-fuvb0IYd.js → SetupPagesScreen-Cx3OOUGr.js} +4 -4
  47. package/dist/assets/SignInScreen-BXBlASFY.js +1 -0
  48. package/dist/assets/SignOutScreen-BN1O2qGb.js +9 -0
  49. package/dist/assets/{TaskListScreen-C2urPjKT.js → TaskListScreen-DrflApgr.js} +2 -2
  50. package/dist/assets/{TaskRoutes-BuzkCbPW.js → TaskRoutes-BxW92Ol2.js} +2 -2
  51. package/dist/assets/TransactionDetailRoutes-CUdtnWL8.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-CQr1YyP0.js → TransactionDetailScreen-C2qhnA5b.js} +2 -2
  53. package/dist/assets/TransactionListRoutes-Bt_C_073.js +1 -0
  54. package/dist/assets/{TreasuryRoutes-CbD79DO8.js → TreasuryRoutes-DJK_7z5t.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-CCYu89Uf.js → VendorsRoutes-dr-KQ_Nk.js} +13 -13
  56. package/dist/assets/WiseConfirmationScreen-BjSMumPA.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-CoRmS3Mc.js → ZeniAccountRoutes-mpb2ppPH.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-C6P6WNnP.js +9 -0
  59. package/dist/assets/{accountMappingHelper-tmyjt9rr.js → accountMappingHelper-D5I8xPpR.js} +1 -1
  60. package/dist/assets/analytics-CVpLIXYS.js +68 -0
  61. package/dist/assets/{analyticsHelper-BEL0ra9X.js → analyticsHelper-DIAaX2E9.js} +1 -1
  62. package/dist/assets/{core-CHD8T-IM.js → core-BmXpopk3.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-p_nrn8Pg.js → decodeURIComponentSafe-CmNiiSLm.js} +1 -1
  64. package/dist/assets/{dnd-Dwi6R-ey.js → dnd-CFbFq_On.js} +1 -1
  65. package/dist/assets/{empty-CeRjDJvl.js → empty-0E71-pkh.js} +1 -1
  66. package/dist/assets/{empty-CZC5CrVC.js → empty-IUpx8pFE.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-BQ5qxpg6.js → emptyVideoElement-DvAsJwe7.js} +1 -1
  68. package/dist/assets/epic-Dp0UOOW0.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-wsi-w_Qs.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-D-or0iZO.js → getLocaleForTenant-CLcFXXBi.js} +1 -1
  71. package/dist/assets/{index-DKH4PK2B.js → index-BH7Z90Ry.js} +16554 -16011
  72. package/dist/assets/{index-BMy5YH8G.js → index-BwG9RDJd.js} +1 -1
  73. package/dist/assets/{index-yiW1aZfy.js → index-DaYn0dIv.js} +2 -2
  74. package/dist/assets/{index-CKiMoeFX.js → index-Diiw4rJ6.js} +1 -1
  75. package/dist/assets/{index-BVHBHjSe.js → index-_EB0AYfG.js} +1 -1
  76. package/dist/assets/{index-XRUedCJ0.js → index-n9iskFtR.js} +1 -1
  77. package/dist/assets/{index-C1KaIuMT.js → index-nMXCGK26.js} +1 -1
  78. package/dist/assets/{index-w09kaOHP.js → index-xAn5v5dB.js} +1 -1
  79. package/dist/assets/{lexical-CMNdypK6.js → lexical-CUqOWG_f.js} +1 -1
  80. package/dist/assets/{liveblocks-e6rGc1UF.js → liveblocks-2F3ER8H4.js} +1 -1
  81. package/dist/assets/{lottie-B778bt56.js → lottie-Do5BYuHO.js} +1 -1
  82. package/dist/assets/{mui-NTaF3UaY.js → mui-DpZKsKJ-.js} +1 -1
  83. package/dist/assets/{pathToGoBack-3T3qt1CN.js → pathToGoBack-IYhrTF3T.js} +1 -1
  84. package/dist/assets/{pdf-Bx92ZlM_.js → pdf-CaVqV5T4.js} +3 -3
  85. package/dist/assets/{pdf-lib-CSbJ_JNk.js → pdf-lib-DgpGz3__.js} +1 -1
  86. package/dist/assets/{plaid-DdTo7m1-.js → plaid-B0sfsJHV.js} +1 -1
  87. package/dist/assets/{pusher-TnSBrmnt.js → pusher-BZ4RRfso.js} +1 -1
  88. package/dist/assets/{react-BRi8TcMI.js → react-B40uyjvd.js} +1 -1
  89. package/dist/assets/{react-COkaiBQo.js → react-BlQV6oEC.js} +1 -1
  90. package/dist/assets/{react-Ba46BK4D.js → react-CM6JlJfX.js} +1 -1
  91. package/dist/assets/{react-Ci1ltUcy.js → react-CVdpmzlC.js} +1 -1
  92. package/dist/assets/{react-DJOUavGZ.js → react-Cx2vmGsH.js} +1 -1
  93. package/dist/assets/{react-B75Gnqob.js → react-cC2pOmRW.js} +1 -1
  94. package/dist/assets/{recharts-C6xUtcdL.js → recharts-lgPPofcu.js} +1 -1
  95. package/dist/assets/routePaths-DuFLBwyX.js +1 -0
  96. package/dist/assets/{sentry-DsyKtMW2.js → sentry-Dwi3Xpu2.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-CKrdD9MQ.js → stripSplatSuffix-Cm_Bj9mb.js} +1 -1
  98. package/dist/assets/{url-Zl9uXQ4e.js → url-B3IdPeRD.js} +1 -1
  99. package/dist/assets/{url-ClJewK9Y.js → url-CuCw2GYz.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CTL9QRWv.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B1hI9_5p.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-B82QOIYm.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-BWi4_PP5.js → useChargeCardPusherEvents-CNgbxhoK.js} +1 -1
  104. package/dist/assets/{useDeviceId-VsdzmSZI.js → useDeviceId-Dklpg4lb.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-BfOhSDOo.js +1 -0
  106. package/dist/assets/useEnsureVendorListLoaded-BtOYIHPo.js +1 -0
  107. package/dist/assets/{useInitialThreadRequest-DDr_z_RH.js → useInitialThreadRequest-DagpMHc1.js} +1 -1
  108. package/dist/assets/useTaskManagerAccess-DvrYqbN3.js +1 -0
  109. package/dist/assets/{useTaskManagerPusherEvents-DCIopLVZ.js → useTaskManagerPusherEvents-Be2DL4pK.js} +1 -1
  110. package/dist/assets/{utils-CCA3F0sZ.js → utils-DAgs23EZ.js} +1 -1
  111. package/dist/assets/withTransactionSidePanel-Dn8x-lme.js +25 -0
  112. package/dist/assets/{zeni-epic-state-BO3zdDfL.js → zeni-epic-state-DtY6MD5C.js} +6 -6
  113. package/dist/index.html +1 -1
  114. package/package.json +4 -4
  115. package/dist/assets/ActualMatchingMatchDetailScreen-CT_TfQgQ.js +0 -1
  116. package/dist/assets/AddressRoutes-CisWqyoC.js +0 -1
  117. package/dist/assets/AddressScreen-CrINuapd.js +0 -9
  118. package/dist/assets/AiCfoScreen-BXw0LDjo.js +0 -22
  119. package/dist/assets/BillPayApprovalRoutes-Dp_PkbIk.js +0 -1
  120. package/dist/assets/CompanyPassportScreen-CENbDnLW.js +0 -1
  121. package/dist/assets/ConnectionAuthScreen-DTyZxcME.js +0 -11
  122. package/dist/assets/CustomerOnboardingAuthScreen-zLmHJyqv.js +0 -1
  123. package/dist/assets/DefaultTenantHome-Dm9FOXup.js +0 -1
  124. package/dist/assets/DomesticWireDetailScreen-086WQWRB.js +0 -18
  125. package/dist/assets/EntityDetailRoutes-BuN3sXNp.js +0 -1
  126. package/dist/assets/ExpenseAutomationRoutes-Ce3IicTe.js +0 -38
  127. package/dist/assets/FeaturePreviewScreen-D54Nwanb.js +0 -1
  128. package/dist/assets/HubSpotOAuthCallbackScreen-BRUwb2B6.js +0 -1
  129. package/dist/assets/InvoicingRoutes-IQsFojD0.js +0 -2
  130. package/dist/assets/MagicLinkSignInScreen-9LYlxmop.js +0 -12
  131. package/dist/assets/MobileAppDrawer-DX2JnkbM.js +0 -1
  132. package/dist/assets/NotFoundScreen-CtgFRYZy.js +0 -1
  133. package/dist/assets/OAuthConsentScreen-BmiLDdxn.js +0 -1
  134. package/dist/assets/PandLWithForecastRoutes-DAq9XRB1.js +0 -1
  135. package/dist/assets/PeopleRoutes-DgYtveDU.js +0 -22
  136. package/dist/assets/PerformanceRoutes-B6iTINLg.js +0 -1
  137. package/dist/assets/ReimbursementApprovalRoutes-CE6y6IwA.js +0 -1
  138. package/dist/assets/ReimbursementApprovalRuleDetailScreen-BT_O_PEv.js +0 -1
  139. package/dist/assets/ReimbursementRoutes-BmOT-3C-.js +0 -68
  140. package/dist/assets/RewardsRoutes-D5CR9NnI.js +0 -1
  141. package/dist/assets/ScreenRoutes-xDjhbdP1.js +0 -2
  142. package/dist/assets/SignInScreen-ekGlkjLH.js +0 -1
  143. package/dist/assets/SignOutScreen-9NJIr2hr.js +0 -9
  144. package/dist/assets/TransactionDetailRoutes-D99Yv6kv.js +0 -1
  145. package/dist/assets/TransactionListRoutes-BTidVr9Z.js +0 -1
  146. package/dist/assets/WiseConfirmationScreen-B0HeU8Sh.js +0 -12
  147. package/dist/assets/ZeniAccountStatementScreen-BnpFJ5jB.js +0 -9
  148. package/dist/assets/analytics-C3e3An3a.js +0 -68
  149. package/dist/assets/epic-BW8jUHg5.js +0 -2
  150. package/dist/assets/expenseAutomationHelper-kGR6VZFG.js +0 -1
  151. package/dist/assets/routePaths-CGyE-cU7.js +0 -1
  152. package/dist/assets/useActualMatchingMatchDetail-Cc17Q5Tv.js +0 -1
  153. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CHbHmZzx.js +0 -1
  154. package/dist/assets/useAskAiCfoHostNavButtonProps-BcCbRGDK.js +0 -1
  155. package/dist/assets/useEmailConnectResultRefresh-ClXdZp-6.js +0 -1
  156. package/dist/assets/useTaskManagerAccess-CUv6a62x.js +0 -1
  157. package/dist/assets/withTransactionSidePanel-B_xgLNm6.js +0 -25
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-2F3ER8H4.js";import{a as d}from"./sentry-Dwi3Xpu2.js";import{h as q,u as A,g as G,i as X,j as l,N as F,l as W,n as $,o as N}from"./core-BmXpopk3.js";import{Xc as _,fF as O,Wo as M,m$ as R,Sp as k,Xh as Y,X1 as z,l$ as V,Sq as S,Wt as H,Wu as J,X3 as K,X2 as L}from"./zeni-epic-state-DtY6MD5C.js";import{ba as Q,m as U,a5 as Z,p as tt}from"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import{d as b}from"./decodeURIComponentSafe-CmNiiSLm.js";import{w as et}from"./withTransactionSidePanel-Dn8x-lme.js";import{f as at,c as nt}from"./routePaths-DuFLBwyX.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.js";import"./useAskAiCfoHostNavButtonProps-B82QOIYm.js";import"./TransactionDetailScreen-C2qhnA5b.js";import"./useInitialThreadRequest-DagpMHc1.js";import"./expenseAutomationHelper-wsi-w_Qs.js";import"./stripSplatSuffix-Cm_Bj9mb.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]="e0da6fc4-5223-41b1-b4d0-2546b59e61eb",a._sentryDebugIdIdentifier="sentry-dbid-e0da6fc4-5223-41b1-b4d0-2546b59e61eb")}catch{}})();const ot=W((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:U,isAccountingClassesEnabled:V(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(K({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(H()),a(J()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(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(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(Q),it=et((function({entityType:a,...t}){const e=q(),o=A(),c=G(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:j}=X(),r=b(x??""),p=b(j??""),u=rt(r,p),v=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),w=l((n=>O(n).company?.companyInfo.firstMonthOfFY??1)),f=l((n=>M(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&u===!0&&(T(!0),o(R(i)))}),[m,u,i]);const E=l((n=>n.trendState.fetchState)),P=f?.selectedPeriod?.timePeriod??g,B=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(f?.selectedPeriod?.timePeriod,g);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(k(i,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),u?s.jsx(ot,{firstMonthOfFY:w,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:B,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(F,{to:I(v.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 wt({entityType:a}){return s.jsx($,{children:s.jsx(N,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{wt as EntityDetailRoutes,wt as default};
@@ -0,0 +1,38 @@
1
+ import{j as T}from"./liveblocks-2F3ER8H4.js";import{u as he,h as st,g as Te,j as F,i as Be,t as Xn,l as Hn,n as Kn,o as He,N as Qn}from"./core-BmXpopk3.js";import{fF as ke,a1j as Zn,q0 as Me,Uo as es,A3 as ts,a1k as as,a1l as ns,a1m as ss,a1n as gt,a1o as Qe,gh as Tt,a1p as ia,eW as os,g0 as cs,a1q as la,a1r as Ze,qT as is,uR as ls,gS as rs,gQ as ds,a1s as us,r4 as ms,rd as ps,qb as hs,qp as Ra,gP as re,gR as Ss,a1t as gs,qL as Da,re as Cs,qm as fs,qh as Is,uX as ks,gO as Ue,a1u as at,Cd as Fa,MA as _a,a1v as Ma,Fy as Ua,a1w as Ts,eZ as bs,e$ as Ps,sS as bt,Xd as ra,Xf as ys,m2 as vs,Xg as Es,m9 as As,dl as xs,Dw as Pt,a1x as ws,a1y as Rs,fm as yt,sG as da,a1z as Ds,X1 as Fs,a1A as _s,a1B as Ms,mb as Us,a1C as Os,Rg as Bs,ma as Vs,l$ as js,qE as Oa,rj as nt,tt as Ba,tP as Ls,Ue as Va,ri as ua,rl as ja,rn as $s,bE as zs,ny as Gs,nv as Ns,rm as et,rk as pe,a1D as qs,rE as ma,a1E as Js,a1F as Ys,sK as Ws,sL as Xs,WZ as Hs,W3 as Ks,a0N as Qs,a1G as Zs,X3 as pa,X2 as Ke,a1H as ha,mq as eo,a1I as to,a1J as ao,a1K as no,a1L as so,qz as oo,a1M as co,a1N as io,a1O as lo,ru as ro,md as uo,m4 as mo,a1P as po,mc as Sa,Xq as ho,a1Q as So,a1R as go,us as Co,u3 as fo,u2 as Ct,a1S as Io,a1T as ko,a1U as To,a1V as bo,nJ as Po,br as yo,nE as ga,nq as vo,a1W as Eo,g$ as Ao,nB as xo,sU as wo,sW as Ro,sD as Do,W6 as Fo,W7 as _o,F0 as Mo,E$ as Uo,Fg as Oo,a1X as Ca,sJ as Bo,a1Y as Vo,rU as jo,r_ as Lo,s9 as $o,rX as zo,a1Z as Go,s8 as No,sP as qo,a1_ as Jo,t0 as Yo,sx as Wo,t6 as Xo,sC as Ho,rF as Ko,a1$ as Qo,qX as Zo,qv as ec,qC as fa,rp as tc,a20 as ac,a21 as nc,a22 as sc,a23 as oc,a24 as cc,a25 as ic,a26 as lc,ta as rc,a27 as dc,a28 as uc,a29 as Ia,uD as mc,tW as pc,tL as ka,tJ as hc,a2a as Sc,ty as gc,td as Cc,tM as fc,a2b as Ic,a2c as kc,tj as Tc,a2d as bc,te as Pc,ti as yc,tg as vc,tS as Ec}from"./zeni-epic-state-DtY6MD5C.js";import La from"./NotFoundScreen-CjcmfT5h.js";import{a as s,R as $a}from"./sentry-Dwi3Xpu2.js";import{n as be,S as Ac}from"./mui-DpZKsKJ-.js";import{d as Ve,$ as X,m as H,p as te,ar as za,at as Ga,dQ as xc,dR as wc,P as Na,z as ot,dS as Rc,dT as Dc,dU as Fc,af as Oe,dV as _c,dW as Ta,bc as ba,dX as Mc,a8 as qa,dY as Uc,k as tt,a as Oc,dZ as Bc,d_ as Vc,c as jc,O as Lc,d$ as $c,e0 as zc,e1 as Gc,b6 as Nc,bu as qc,ac as Jc,b7 as Yc,b8 as Wc,G as Xc,w as Hc,e2 as Kc,aw as Pa,e3 as Qc}from"./index-BH7Z90Ry.js";import{u as Ja}from"./useAskAiCfoHostNavButtonProps-B82QOIYm.js";import{g as ya,b as Zc,c as ei,h as ti,a as ai,i as ni,r as si,C as oi}from"./TransactionDetailScreen-C2qhnA5b.js";import{u as ci}from"./useActualMatchingMatchDetail-CTL9QRWv.js";import{d as ii}from"./decodeURIComponentSafe-CmNiiSLm.js";import{m as Ya,a as Wa}from"./expenseAutomationHelper-wsi-w_Qs.js";import{u as Xa,a as Ha,w as li}from"./withTransactionSidePanel-Dn8x-lme.js";import{b as ri,S as di,a as ui,J as mi}from"./ScheduleDetailsPrepaidExpensesScreen-BNVCc0tE.js";import{s as va,i as Ka,h as pi,j as hi,v as Si,c as gi}from"./routePaths-DuFLBwyX.js";import{a as ft}from"./accountMappingHelper-D5I8xPpR.js";import{D as Ci}from"./DrawerScreen-kd-vUIOU.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.js";import"./useInitialThreadRequest-DagpMHc1.js";import"./stripSplatSuffix-Cm_Bj9mb.js";import"./pathToGoBack-IYhrTF3T.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]="286501ae-a521-4879-95ab-6be6fddf7cd5",t._sentryDebugIdIdentifier="sentry-dbid-286501ae-a521-4879-95ab-6be6fddf7cd5")}catch{}})();const fi=()=>{const t=he(),n=st(),f=Te(),I=F((C=>ke(C))),{useFeatureGate:k}=Ve(),{isFeatureEnabled:o}=k(X.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(X.aiAuditScorePercentage),E=F((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=F((C=>Zn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=Ja({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,L=!1)=>{t(Me({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:L}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&H.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(es(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&&H.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]),_=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:_,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=za();return Ga({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(ts(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;H.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]),T.jsx(Ii,{children:T.jsx(xc,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},Ii=be.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ background-color: ${t=>t.theme.colors.grey4};
8
+ `;function ki({isFullView:t,matchId:n,onClose:f}){const{match:I,detailFetchState:k,handleOpenBill:o,handleContinueMatch:r,handleRefresh:E,handleUndoReversal:l,lastMatchResults:S,lastUndoResults:R,refreshStatus:x,undoReversalStatus:m}=ci(n);return T.jsx(wc,{match:I,detailFetchState:k.fetchState,isRenderedInPanel:!t,isUndoInFlight:m.fetchState==="In-Progress",refreshStatus:x.fetchState,onNavigateBack:f,onOpenBill:o,onContinueMatch:r,onRefresh:E,onUndoReversal:l,lastMatchResults:S,lastUndoResults:R})}const Ti=/^match\/([^/?]+)$/,bi=Ha({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const{useFeatureGate:n}=Ve(),{isFeatureEnabled:f}=n(X.isTransactionDetailSplitViewEnabled),{isFeatureEnabled:I}=n(X.isAccrualEnabled),k=Na(),o=(function(E=!0){const l=st(),S=Te(),R=Be(),x=Ya(R),m=Xa({childPathPattern:Ti,enabled:E,listPath:x}),g=m.matchGroups[0]!=null&&m.matchGroups[0]!==""?ii(m.matchGroups[0]):void 0,u=R.tenantEmailDomain??S.pathname.split("/").find(Boolean)??"",_=s.useRef({isOpen:m.isOpen,matchId:g});_.current={isOpen:m.isOpen,matchId:g};const A=s.useCallback((h=>{!m.isMobile&&E?_.current.isOpen&&_.current.matchId===h?m.closePanel():m.navigateToChild(`match/${encodeURIComponent(h)}`,{replace:_.current.isOpen}):l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(h)}`)}),[l,m.isMobile,m.navigateToChild,m.closePanel,E,u]),p=s.useCallback((()=>{if(g==null)return;const h=te(S.state?.pathnameStackToGoBack,`${S.pathname}${S.search}`);l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(g)}`,{state:{pathnameStackToGoBack:h}})}),[S.pathname,S.search,S.state,g,l,u]),C=m.isOpen&&g!=null;return{closePanel:m.closePanel,isOpen:C,maximize:p,matchId:E&&C?g:void 0,openPanel:A}})(t&&I===!0&&k===!0&&f===!0),r=s.useMemo((()=>{if(o.isOpen&&o.matchId!=null)return T.jsx(ki,{isFullView:!1,matchId:o.matchId,onClose:o.closePanel},o.matchId)}),[o.closePanel,o.isOpen,o.matchId]);return{injectedProps:s.useMemo((()=>({closeMatchSidePanel:o.closePanel,isMatchPanelOpen:o.isOpen,matchPanelContent:r,matchPanelMatchId:o.matchId,openMatchPanel:o.openPanel})),[r,o.closePanel,o.isOpen,o.matchId,o.openPanel]),selectedItemId:o.matchId,sidePanel:{closePanel:o.closePanel,maximize:o.maximize}}}}),Pi=$a.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:f,onFetchLinkTokenClick:I,onEstablishConnectionClick:k})=>{const o=he(),{useFeatureGate:r}=Ve(),{isFeatureEnabled:E}=r(X.isReconV3Enabled),{isFeatureEnabled:l}=r(X.isReconciliationCombinedStatementEnabled),S=ot.getSignedInUser(),R=F((y=>ke(y))),x=s.useMemo((()=>({userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:R?.tenantId??""})),[S?.userId,S?.zeniSessionId,R?.tenantId]),{accountReconciliationsByAccountID:m,excludedAccountIDs:g,monthYearPeriod:u,statementUploadChosen:_}=t,A=m[n],p=s.useMemo((()=>as(m,n)),[m,n]),C=s.useMemo((()=>ns(m)),[m]),h=s.useMemo((()=>ss(m,n)),[m,n]),L=s.useRef(!1),$=s.useCallback((y=>{L.current=y,Ta(n,y)}),[n]),q=s.useCallback((y=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:y.completedSteps,startedAtMs:y.startedAtMs,totalDurationSeconds:y.totalDurationSeconds})),y.accountMappings!=null&&o(Qe({accountId:n,selectedPeriod:u,localData:{combinedStatementAccountMappings:y.accountMappings}})),A!=null&&requestAnimationFrame((()=>{L.current||o(Tt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Rc(A)}]}))}))}),[o,u,A,n]),b=s.useCallback((()=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,n,u]),J=s.useCallback((y=>{o(ia({accountId:n,selectedPeriod:u,backgroundCompletedSteps:y}))}),[o,u,n]),N=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u,backgroundCompletedSteps:0})),o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,u,n]);s.useEffect((()=>()=>{Ta(null,!1)}),[]);const e=A?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??A?.accountReconEntity.statementMetaData?.statementUploadId,a=A?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,i=F((y=>a!=null&&a!==""?os(cs(y.userState,a)):"")),d=s.useCallback((()=>{o(la({accountId:n,selectedPeriod:u}))}),[o,n,u]),v=s.useCallback((()=>{o(la({accountId:n,selectedPeriod:u})),o(Ze({statementUploadChosen:!0}))}),[o,n,u]),P=(y,z)=>{o(ks(y,z.split(".")[0]))},D=(y,z)=>{if(z===!0){const Q=A?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(Q!=null&&Q!=="")return void o(fs({accountId:n,selectedPeriod:u,combinedStatementGroupId:Q,fileId:y}))}e!=null&&o(Is({accountId:n,selectedPeriod:u,fileId:y,statementUploadId:e}))},M=()=>{o(Ze({statementUploadChosen:!1}))},Y=y=>{o(Cs({accountId:n,selectedPeriod:u,payload:y,statementAccountScope:l===!0?A?.localData?.statementAccountScope??"single_account":"single_account"}))},W=s.useCallback(((y,z,Q)=>{o(is({accountId:y,selectedPeriod:z,statementUploadId:Q}))}),[o]),se=s.useCallback(((y,z,Q,Z,ge)=>{ge!=null&&ge!==""&&o(ls(ge)),o(Z==null||Z===""?ds({accountId:y,selectedPeriod:z,statementUploadId:Q}):rs({accountId:y,selectedPeriod:z,statementUploadId:Q,combinedStatementGroupId:Z}))}),[o]),ce=s.useCallback(((y,z)=>{z!==""&&o(us({accountId:n,selectedPeriod:u,statementUpdateLocalData:y,statementUploadId:z}))}),[o,n,u]),Pe=s.useCallback((()=>{e!=null&&o(A?.localData?.statementAccountScope!=="multi_account"?ps({accountId:n,selectedPeriod:u,statementUploadId:e}):ms({accountId:n,selectedPeriod:u,statementUploadId:e}))}),[o,A?.localData?.statementAccountScope,n,u,e]),ye=s.useCallback((y=>{e!=null&&o(hs({accountId:n,selectedPeriod:u,statementUploadId:e,accountMappings:y}))}),[o,u,n,e]),ve=s.useCallback((()=>{o(Ze({statementUploadChosen:!0}))}),[o]),K=y=>{o(Qe({accountId:n,selectedPeriod:u,localData:{accountSource:y}}))},B=y=>{o(Qe({accountId:n,selectedPeriod:u,localData:{statementAccountScope:y}}))},je=s.useCallback((()=>{o(Ra({accountId:n}))}),[o,n]),Ee=s.useCallback((y=>{o(re(u,y,!0)),f()}),[o,u,f]),ct=s.useCallback((()=>{o(Ss({accountId:n,selectedPeriod:u,statementProcessingFailed:!1})),o(gs({accountId:n,selectedPeriod:u}))}),[o,n,u]),Se=s.useCallback((()=>{o(Da({accountId:n}))}),[o,n]),Le=g.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(Le!=null)return T.jsx(Ea,{children:T.jsx(Aa,{$isV3:E===!0,children:T.jsx(Dc,{excludedAccountReconciliation:Le,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:E,onDismissClick:f,onIncludeIntoReconciliation:Se})})});if(A!=null){const y=E===!0?T.jsx(Fc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,onSelectStatementAccountScope:B,isReconciliationCombinedStatementEnabled:l===!0,ledgerAccounts:p,statementOverrideWarningAccountIds:h,unavailableLedgerAccountIds:C,onConfirmStatementMapping:ye,filesEndPoint:Oe.fileMicroServiceBaseUrl,authParams:x,openFilePicker:_,onStatementUploadSuccess:Y,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:je,onRetryParsing:W,onFetchStatementParseInfo:se,onReviewClicked:Ee,statementProcessingFailed:A.statementProcessingFailed,statementProcessingDismissedToBackground:A.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ct,onContinueInBackground:q,onClearStatementProcessingDismissedToBackground:b,onResetStatementProcessingProgress:N,onStatementProcessingProgressChange:J,onStatementFlowVisibilityChange:$,onReuploadStatement:ve,onStatementFormDataChange:ce,onStatementConfirmSave:Pe,reconciledByName:i,onDismissDateConflict:d,onReuploadAfterDateConflict:v,isReconV3Enabled:E}):T.jsx(_c,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,filesEndPoint:Oe.fileMicroServiceBaseUrl,authParams:x,openFilePicker:_,onStatementUploadSuccess:Y,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:je});return T.jsx(Ea,{children:T.jsx(Aa,{$isV3:E===!0,children:y})})}return null})),Ea=be.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
12
+ `,Aa=be.div`
13
+ flex: 1;
14
+ min-height: 0;
15
+ display: flex;
16
+ flex-direction: column;
17
+ box-sizing: border-box;
18
+ min-width: 0;
19
+ overflow-x: hidden;
20
+ overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
21
+ `;function yi({panelType:t,scheduleId:n,onClose:f,onCloseAfterDecision:I}){return T.jsx(Ei,{children:T.jsx(Ai,{children:vi(t,n,f,I)})})}function vi(t,n,f,I){switch(t){case"one_time_accrual":return T.jsx(mi,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:f});case"accrued_expenses":return T.jsx(ui,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"fixed_assets":return T.jsx(di,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"prepaid_expenses":return T.jsx(ri,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:f,onPanelCloseAfterDecision:I})}}const Ei=be.div`
22
+ display: flex;
23
+ flex-direction: column;
24
+ height: 100%;
25
+ `,Ai=be.div`
26
+ flex: 1;
27
+ min-height: 0;
28
+ display: flex;
29
+ flex-direction: column;
30
+ box-sizing: border-box;
31
+ min-width: 0;
32
+ overflow-x: hidden;
33
+ overflow-y: auto;
34
+ `,xi=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,wi=Ha({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(m=!0){const g=st(),u=Te(),_=he(),A=Be(),p=Xa({childPathPattern:xi,enabled:m}),C=p.matchGroups[0],h=Ka(C)?C:void 0,L=p.matchGroups[1]!=null&&p.matchGroups[1]!==""?p.matchGroups[1]:void 0,$=p.isOpen&&h!=null&&L!=null,q=A.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",b=s.useRef({isOpen:$,scheduleId:L});b.current={isOpen:$,scheduleId:L};const J=s.useCallback(((e,a,i)=>{i!=null&&(a==="prepaid_expenses"||a==="fixed_assets")&&_(Ua({selectedJEScheduleKey:i})),!p.isMobile&&m?b.current.isOpen&&b.current.scheduleId===e?p.closePanel():p.navigateToChild(`schedule/${a}/${e}`,{replace:b.current.isOpen}):g(va(a,e,q),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[_,g,p.isMobile,p.navigateToChild,p.closePanel,m,q]),N=s.useCallback((()=>{if(h==null||L==null)return;const e=te(u.state?.pathnameStackToGoBack,u.pathname);g(va(h,L,q),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[g,h,L,q,u.pathname,u.state]);return{closePanel:p.closePanel,isOpen:$,maximize:N,openPanel:J,panelType:$?h:void 0,scheduleId:$?L:void 0}})(t),f=s.useRef(null),[I,k]=s.useState(null),o=s.useMemo((()=>({registerPanelDirtyGuard:m=>{f.current=m}})),[]),r=s.useCallback((m=>{f.current?.isDirty()===!0?k((()=>m)):m()}),[]),E=s.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=s.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),S=s.useCallback(((m,g,u)=>{r((()=>n.openPanel(m,g,u)))}),[r,n.openPanel]),R=s.useMemo((()=>{if(I!=null)return{onCancel:()=>k(null),onDiscard:()=>{f.current=null,k(null),I()}}}),[I]),x=s.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return T.jsx(Mc.Provider,{value:o,children:T.jsx(yi,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:E,onCloseAfterDecision:()=>{f.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,E,o]);return{injectedProps:s.useMemo((()=>({closeSchedulePanel:E,isSchedulePanelOpen:n.isOpen,openSchedulePanel:S,schedulePanelContent:x,schedulePendingDiscardConfirmation:R})),[E,S,x,R,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:E,maximize:l}}}});function Ri({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:f,resetCustomerRequest:I}){const k=ot.getSignedInUser();if(k==null)throw Error("Can't access Customer Request page without signing in...");const o=F((r=>Ts(r,t,k)));return s.useEffect((()=>{I()}),[]),T.jsx(T.Fragment,{children:o.fetchState==="In-Progress"||o.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?T.jsx(qa,{fetchState:"In-Progress"}):T.jsx(Uc,{onCloseClick:n,addCustomerRequest:f,snippets:o.companyMonthEndReportTemplatesData,bulletPoints:o.zeniRequestsData??[]})})}const Di={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},Fi=()=>{const t=F((R=>Ue(R))),n=Te(),{currentSelectedViewFetchState:f,currentSelectedView:I,selectedPeriod:k}=t,o=tt(I),r=tt(f.fetchState),E=t.jeSchedules.uiState.selectedPageTab??"schedules",l=tt(E),S=s.useCallback((R=>{const x=n.state?.referrer;I==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?H.trackTransactionsReviewPage(k.month,k.year,t.transactionView.totalCountByTab.review,0,R,x??null):H.trackTransactionsAutoCategorisedPage(k.month,k.year,t.transactionView.totalCountByTab.autoCategorized,0,R,x??null)),I==="missing_receipts"&&H.trackMissingReceiptsPage(k.month,k.year,R,t.missingReceipts.transactions.length,x??null),I==="je_schedules"&&H.trackMonthCloseScheduleListPage(k.month,k.year,R,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.failedPostings.length,(m=>{const g={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return m.forEach((u=>{if(bs(u))g.oneTimeAccrualCount+=1;else switch(Ps(u)){case"prepaid_expenses":g.prepaidCount+=1;break;case"fixed_assets":g.fixedAssetsCount+=1;break;case"accrued_expenses":g.accruedCount+=1}})),g})(t.jeSchedules.pendingReviewSchedules),Di[E],x??null),I==="flux_analysis"&&H.trackFluxAnalysisPage(k.month,k.year,R,_i(t.fluxAnalysis),x??null),I==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&H.trackInsightsEmailPage(k.month,k.year,R,"draft",t.auditSummary.auditScorePercentage,null,x??null)}),[k,t,E]);return s.useEffect((()=>{(r!==f.fetchState||I!==o||I==="je_schedules"&&l!=null&&E!==l)&&f.fetchState==="Completed"&&S(!1)}),[I,f.fetchState,o,E,l]),S},_i=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Mi,comma:xa,space:Ui}},dateFormat:Qa}=Xc.getLocalizedStrings(),wa=Ec,Oi=Hn((function(t,n){const{uncategorizedAccounts:f,vendorSearchAutoCompleteData:I,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,companyId:r,isMissingReceiptsBulkUploadEnabled:E,isTransactionActivityEnabled:l,newScheduleActiveType:S}=n,R=ot.getSignedInUser(),x=t.tenantState.currentTenantId,m={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:x??""},g=Ue(t),{selectedTransactionCategorizationTab:u}=g,{searchTransactionsResults:_,searchTransactionsFetchState:A}=Js(t),p=S==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:C,classListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:L,newScheduleLocalData:$,saveStatus:q}=Ys(t,p);return{expenseAutomationViewSelector:g,accountListNestedAccountHierarchy:C,allDepreciationAccountListNestedAccountHierarchy:L,baseTransactionSearchFetchState:A,baseTransactionSearchResults:_,classListNestedAccountHierarchy:h,newScheduleLocalData:$,initialSelectedBaseTransaction:$.selectedBaseTransactionId!=null?Ws(t.transactionState,Xs($.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Hs(t),newScheduleSaveStatus:q,bulkUploadSelector:E===!0?g.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:I,authParams:m,receiptUploadEndpoint:`${Oe.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Pa}/transaction_attachments`,bulkUploadEndpoint:E===!0?`${Oe.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:g.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:R,uncategorizedAccounts:f,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:Qs(t.tenantState,x),downloadParams:{authParams:m,jeScheduleEndPoint:`${Pa}/jeScheduleReports`,timezone:Ks(),companyName:ke(t).companyName}}}),(function(t,n){const{themeState:f,isAccountingClassesEnabled:I,isCOTEnabled:k,isMissingReceiptsBulkUploadEnabled:o,location:r,vendorSearchAutoCompleteData:E,expenseAutomationViewSelector:l,currentTenant:S,newScheduleActiveType:R,uncategorizedAccounts:x,navigate:m,onClickCustomerRequest:g,handleEditClick:u,closeSchedulePanel:_,isSchedulePanelOpen:A,openSchedulePanel:p,setActivityLogTransactionId:C}=n,{selectedPeriod:h,currentSelectedView:L,reconciliation:{selectedAccountId:$}}=l,{accountSettingsView:q}=l.jeSchedules,b=Oa(h),J=nt(b.start),N=nt(b.end);return{onZeniLogoClick:()=>{f.toggle()},onUploadReceiptAttachment:e=>{H.trackMissingReceiptAttached(h.month,h.year),t(pc(e))},onUploadTransactionReceipt:(e,a,i,d,v,P)=>{t(Ia(e,a,{fetchState:"In-Progress"}));const D=()=>t(Ia(e,a,{fetchState:"Error"}));Qc(`${Oe.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,P,a,i,d,v).then((M=>{M!=null?t(mc(e,M)):D()})).catch(D)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(uc(e,a)),S!=null&&t(Me({tenantId:S.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,i,d)=>{t(dc(e,{fetchState:a,error:i})),i!=null&&t(Tt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:d!=null?Ui+Mi+d+xa:xa}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,i=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,d=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;i&&n.closeMatchSidePanel?.(),A===!0&&(i||d)&&_?.(),e.createdGroupCollapsed!=null?t(oc()):e.pendingGroupCollapsed!=null?t(cc()):e.failedGroupCollapsed!=null?t(ic()):e.selectedJETypeFilter!==void 0?t(lc(e.selectedJETypeFilter)):t(rc(e))},onUpdateMissingReceiptsUIState:e=>{t(sc(e))},onFetchMissingReceiptsList:()=>{N!=null&&J!=null&&t(ja({start:J,end:N},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...o===!0?{onBulkUploadFiles:e=>{t(vc(e))},onBulkUploadProgress:e=>{t(yc(e))},onBulkUploadSuccess:e=>{t(Pc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(bc(e))},onConfirmBulkUploadMatch:(e,a,i,d,v)=>{t(Tc(e,a,i,d,v))},onBulkUploadConfirmMatchAcknowledged:()=>{t(kc())},onSetBulkUploadResultsTab:e=>{t(Ic(e))},onSetBulkUploadCompletedSubTab:e=>{t(fc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(ka({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(Cc())},onSearchTransactionsForManualMatch:(e,a)=>{t(wa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(wa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(gc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(Sc())},onFetchBulkUploadBatches:e=>{t(Ba(e))},onFetchMoreBatchDetails:()=>{t(hc())},onResetBulkUploadSort:()=>{t(ka({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(nc())},onSearchTextChanged:e=>{const a=l.currentSelectedView,i=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(Ct({selectedTab:i,uiState:{searchString:e}})),N!=null&&J!=null&&t(pe(i,{start:J,end:N},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(ac({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(tc())},onClose:()=>{L==="reconciliation"&&$!=null&&t(fa({selectedAccountId:void 0})),m("../")},onBack:()=>{L==="reconciliation"&&$!=null&&t(fa({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(ec(e))},onSaveReconciliationReview:e=>{t(Zo(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:i,referrer:l.currentSelectedView}}),t(Va(e))},handleLogOutClick:()=>{const e=te(r.state?.pathnameStackToGoBack,r.pathname);m("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:i,fixedAssetsAccount:d,accruedExpensesAccount:v}=a,P=ft(q.prepaidExpensesAccountList,i.selectedOptions),D=ft(q.fixedAssetsAccountList,d.selectedOptions),M=ft(q.accruedExpensesAccountList,v.selectedOptions),Y={selectedPrepaidExpensesAccountIds:P.map((W=>W.accountId)),selectedFixedAssetsAccountIds:D.map((W=>W.accountId)),selectedAccruedExpensesAccountIds:M.map((W=>W.accountId))};t(Qo({data:Y}))},onSaveJeAccountSettingsClick:()=>{t(Ko())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:i,accumulatedDepreciationCategory:d,scheduleClass:v,scheduleExpenseCategory:P,vendor:D}=a,{allAccountList:M,allClassList:Y,allDepreciationAccountList:W}=l.jeSchedules,se=E.entityAutoCompleteView.vendor.length>0?E.entityAutoCompleteView.vendor.find((K=>K.id===D?.selectedOption)):void 0,ce={id:se?.zeniId??D?.selectedOption??"",name:se?.name??D?.defaultOptions.find((K=>K.value===D?.selectedOption))?.label??"",logo:se?.logo},Pe=P?.selectedOption!=null?M.find((K=>K.qboId===P.selectedOption)):void 0,ye=v?.selectedOption!=null?Y.find((K=>K.classId===v.selectedOption)):void 0,ve=d?.selectedOption!=null?W.find((K=>K.qboId===d.selectedOption)):void 0;t(Ho({scheduledJournalEntryID:e,localData:{jeScheduleID:i,scheduledJournalEntryID:e,updatedCategoryId:Pe?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:ve?.accountId,updatedVendor:{id:ce.id,name:ce.name}}}))},onRevertJeSchedule(e,a,i,d,v){t(Xo(e,a,i,d,v))},ignoreRecommendedJeSchedule(e,a,i,d){t(Wo(e,a,i,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(pa({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onCancelAutoComplete:()=>{t(Ke("common"))}},onPostJESchedule(e,a){t(Yo({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(Jo())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=gi(e,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(qo({query:e,scheduleType:R==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const i=yt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(Ca({scheduleType:i,localData:a}))},onOpenMatchNewModal(e){t(No(e))},onCloseMatchNewModal(){t(Go())},onClearMatchNewModal(){t(zo())},onSearchMatchTransactions(e,a){t($o(e,a))},onSearchMatchAccruals(e,a){t(Lo(e,a))},onMatchAndReverse(e){t(jo(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds))},onUpdateActualMatchingUIState(e){t(Vo(e))},onSaveSchedule(e,a){const i=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:d,allDepreciationAccountList:v}=l.jeSchedules,P=a.selectedAccount!=null?d.find((M=>M.qboId===a.selectedAccount)):void 0,D=a.selectedAccumulatedDepreciationCategory!=null?v.find((M=>M.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(Ca({scheduleType:i,localData:{...a,selectedAccount:P?.accountId,selectedAccumulatedDepreciationCategory:D?.accountId}})),t(Bo({scheduleType:i}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Fo()),t(_o()),t(Mo({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(Uo({scheduleType:a})),t(Oo(a,void 0))},onCreateOneTimeAccrual(e){t(Do(e))},handleJeScheduleClick:(e,a,i)=>{if((function(v,P){return P!=="accrued_expenses"})(0,i)&&t(Ua({selectedJEScheduleKey:a})),p!=null&&Ka(i))return void p(e,i,a);const d=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/${i}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,i,d)=>{t(a!=="revert"?Ro(e,i,d):wo(e,i,d))},onOneTimeAccrualClick:e=>{if(p!=null)return void p(e,"one_time_accrual");const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},improveMonthEndInsightsUsingZeniGPTClick:e=>{S!=null&&t(xo(e,S.companyId,S.tenantId))},onClickCustomerRequest:g,setActivityLogTransactionId:C,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Ao())},onOpenFileAttachmentSnackBar:()=>{t(Tt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Eo(e))},onUpdateFileAttachment:e=>{t(vo({files:e}))},previewMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(ga(e,S.companyId,a,!0,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},saveMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(ga(e,S.companyId,a,!1,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:i,auditSummary:d}=l;S!=null&&d?.auditScorePercentage!=null&&(t(Po(S.companyId,e,S.tenantId)),H.trackInsightsEmailPage(i.month,i.year,!1,"draft",d.auditScorePercentage,yo().format(Qa.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const i=l.transactionView.uiState.searchString??"",d=l.transactionView.transactions,v=d.findIndex((M=>M.id===e)),P=i.length>0?{resultPosition:v>=0?v+1:void 0,resultsCount:d.length,searchTerm:i}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,P);const D=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:D,message:"expenseAutomation",origin:"transaction_categorization",searchContext:P}})},setLocalDataForCategoryAndClass:(e,a,i,d,v,P,D,M,Y,W,se,ce)=>{t(bo(e,a,i,d,x,v,P,D,M,Y,W,se,ce))},onCancelAutoComplete:()=>{t(Ke("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(ha({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(pe(e,{start:J,end:N},!1,!1)),t(To(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(ko(e)),t(pe("autoCategorized",{start:J,end:N},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(Io(e)),t(pe(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:J,end:N},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a})),N!=null&&J!=null&&t(pe(e,{start:J,end:N},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,i,d,v,P)=>{N!=null&&J!=null&&t(pe(e,{start:J,end:N},!0,i,a,d,v,P))},resetTransactionCategorizationLocalData:(e,a,i,d,v,P,D)=>{t(fo(e,a,i,d,D??null,v,P,!1)),si(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,i,d,v)=>{t(Sa({selectedTab:e,transactionId:a,lineId:i,selectedTransaction:d,uncategorizedAccounts:x,updatedVendor:v,isAccountingClassesEnabled:I}))},onSaveUpdateTransactionCategorization:(e,a,i)=>{const d=r.state?.referrer;e==="autoCategorized"?H.trackTransactionsAutoCategorisedPage(h.month,h.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,d??null):H.trackTransactionsReviewPage(h.month,h.year,l.transactionView.totalCountByTab.review,a.length,!1,d??null),t(Co(e,a,i)),ni(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(go({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:Y}=a;P!=null&&t(ho({transactionId:D,customerUpdates:P})),t(So({selectedTab:d,transactionId:D.id,lineId:Y[0],selectedTransaction:M,uncategorizedAccounts:x,updatedCustomer:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))},onFetchRecommendationsForEntityCategorization:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:Y}=a;P!=null&&(t(uo({transactionId:D,vendorUpdates:{name:P.name,id:P.id?P.id:void 0}})),t(mo({vendorId:P.id?P.id:void 0,localData:{vendorName:P.name,vendorId:P.id?P.id:void 0}}))),P?.id?(t(Sa({selectedTab:d,transactionId:D.id,lineId:Y[0],selectedTransaction:M,uncategorizedAccounts:x,updatedVendor:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))):t(po({selectedTab:d,transactionId:D.id,lineId:Y[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(et(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(et(h,!0,!1,null,!1,!1))},markAsReview:(e,a,i,d)=>{H.trackFluxAnalysisReviewed(i.month,i.year,d??!1,e),t(ro(a,e,i,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(lo(e))},updateOperatingExpensesIdsForReview:e=>{t(io({operatingExpenseIds:e,selectedPeriod:h}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=Si(e.id,e.qboId,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(co({sectionId:e,selectedPeriod:h}))},onFetchReimbursementView:(e,a,i)=>{t(et(e,!0,!1,a,!0,i))},onReviewClicked:e=>{t(re(h,e))},setOpenDrawerClicked:e=>{t(at({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Fa("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const i=S?.companyId;i!=null&&(t(_a(e,i,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(Ma({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(at({selectedDrawerAccountId:e})),t(Qe({accountId:e,selectedPeriod:h,localData:{accountSource:"bank_statement"}})),t(Ze({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(re(h,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(oo({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(so({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(no({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{n.closeSidePanel?.(),t(ao({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,i)=>{const d=e.vendor?.id;i&&d!=null&&t(eo(d)),t(to({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,bt("bill"));const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{m(-1)},onReconListPageScroll:e=>{t(ha({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(pa({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Zs({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(Ra({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Da({accountId:e}))}}}),((t,n,f)=>{const{isMissingReceiptsBulkUploadEnabled:I,...k}=f;return(function(o,r,E){return{...o,...r,...E,onUploadTransactionReceipt:(l,S,R,x,m)=>{r.onUploadTransactionReceipt(l,S,R,x,m,o.authParams)}}})(t,n,k)}))(Hc(Kc)),It="newScheduleMode",kt="newScheduleType",Bi=wi(li((function(t){const n=t.displayName??t.name??"Component",f=$a.memo(t),I=k=>{const o=he(),r=(function(){const p=he(),C=F((h=>Ue(h).reconciliation.selectedDrawerAccountId));return{isOpen:C!=null,selectedAccountId:C,openPanel:s.useCallback((h=>{p(at({selectedDrawerAccountId:h}))}),[p]),closePanel:s.useCallback((()=>{p(at({selectedDrawerAccountId:void 0}))}),[p])}})(),E=F((p=>Ue(p).reconciliation)),l=F((p=>ke(p))),S=s.useCallback(((p,C)=>{o(Fa("expense_automation_reconcile",p,C))}),[o]),R=s.useCallback(((p,C)=>{const h=l?.companyId;h!=null&&(o(_a(p,h,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",C)),o(Ma({accountId:C,connectionInProgress:!0})))}),[o,l?.companyId]),x=s.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return T.jsx(Pi,{reconciliation:E,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:S,onEstablishConnectionClick:R})}),[r.isOpen,r.selectedAccountId,r.closePanel,E,S,R]),m=s.useMemo((()=>({reconPanelContent:x,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[x,r.isOpen,r.closePanel]),{useFeatureGate:g}=Ve(),{isFeatureEnabled:u}=g(X.isReconV3Enabled),_=s.useContext(ba),A=s.useMemo((()=>r.isOpen?u===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:_),[r.isOpen,r.closePanel,r.selectedAccountId,_,u]);return T.jsx(ba.Provider,{value:A,children:T.jsx(f,{...k,...m})})};return I.displayName=`withReconSidePanel(${n})`,I})(bi((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:f,matchPanelContent:I,isMatchPanelOpen:k,openMatchPanel:o,openTransactionPanel:r,panelContent:E,reconPanelContent:l,reconSidePanelIsOpen:S,isSchedulePanelOpen:R,closeSchedulePanel:x,openSchedulePanel:m,schedulePanelContent:g,schedulePendingDiscardConfirmation:u,sidePanelIsFullView:_,sidePanelIsOpen:A})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:C}=Oc(),h=Bc(),{isOpen:L}=Vc(),$=st(),q=Te(),b=he(),{isAiCfoAccessEnabled:J,onAskAiCfoClick:N}=Ja({mobileExploreReferrer:"Transaction categorization"}),e=s.useCallback((()=>{k===!0&&t?.(),A===!0&&_!==!0&&f?.()}),[t,f,k,_,A]),a=F(ws);s.useEffect((()=>{a===!0&&(e(),b(Rs()))}),[a,e,b]);const{areTenantIdsInSync:i}=za(),d=Fi(),v=jc(),[P,D]=s.useState(!1),[M,Y]=Xn(),W=s.useCallback((c=>{Y((w=>{const G=new URLSearchParams(w);return c==null?(G.delete(It),G.delete(kt),G):(G.set(It,c.scheduleDetailsMode),G.set(kt,c.scheduleType),G)}),{replace:!0})}),[Y]),[se,ce]=s.useState(void 0),Pe=s.useCallback(((c,w,G)=>{const j=yt(c);ce(j),W({scheduleDetailsMode:w,scheduleType:c}),b(da({scheduleType:j==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:G}))}),[b,W]),ye=s.useMemo((()=>{const c=M.get(It),w=M.get(kt);return c!=null&&w!=null?{scheduleDetailsMode:c,scheduleType:w}:void 0}),[M]),ve=s.useCallback((c=>{W(c),c!=null&&b(da({scheduleType:yt(c.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[b,W]),K=F((c=>ra(c))),B=F((c=>ke(c))),[je,Ee]=s.useState(!1),[ct,Se]=s.useState(!1),[Le,y]=s.useState([]),[z,Q]=s.useState(null),Z=s.useCallback((()=>{Q(null)}),[]),ge=z?.contentType==="activity"?z.detail.transactionId:void 0,it=s.useCallback((c=>{c!=null?(p&&C(!1),h(),e(),Q({contentType:"activity",detail:{transactionId:c}})):Q((w=>w?.contentType==="activity"?null:w))}),[e,p,h,C]),Za=s.useCallback((c=>{p&&C(!1),h(),e(),Q({contentType:"transfer",detail:c})}),[e,p,h,C]),en=s.useCallback((()=>{h(),Z(),e(),N()}),[e,Z,N,h]),vt=s.useRef(p);s.useEffect((()=>{p===!0&&vt.current===!1&&(h(),Z(),e()),vt.current=p}),[e,Z,p,h]);const Et=s.useRef(L);s.useEffect((()=>{L===!0&&Et.current===!1&&(p&&C(!1),Z(),k===!0&&t?.(),A===!0&&_!==!0&&f?.()),Et.current=L}),[Z,t,f,L,p,k,C,_,A]);const $e=A===!0&&_!==!0||k===!0,At=s.useRef($e);s.useEffect((()=>{$e&&!At.current&&(p&&C(!1),h(),Z()),At.current=$e}),[Z,p,$e,h,C]);const[xt,tn]=s.useState(!1),wt=s.useRef(!1),{selectedTab:an}=Be(),{tenantEmailDomain:Ae}=Be(),[lt,Rt]=s.useState(q.state?.message==="comingFromTransactionDetail"),Dt=q.state?.message==="comingFromOverview",Ft=Lc(),rt=ot.getSignedInUser(),{useFeatureGate:oe}=Ve(),{isFeatureEnabled:_t}=oe(X.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:xe}=oe(X.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:dt}=oe(X.isTransactionActivityEnabled),{isFeatureEnabled:Mt}=oe(X.isAccrualEnabled),nn=Na(),de=Mt===!0&&nn===!0,{isFeatureEnabled:Ut}=oe(X.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:sn}=oe(X.isCreateTransactionEnabled),on=F((c=>Ds(c))),{isFeatureEnabled:cn}=oe(X.isProjectsTransactionsEnabled),{isFeatureEnabled:ln}=oe(X.isReconV3Enabled),rn=s.useCallback((c=>{const w=bt(c.transactionType??(c.view==="reconciliation"?"bill":"expense")),G=te(q.state?.pathnameStackToGoBack,q.pathname),j=new URLSearchParams({view:"full"});c.threadId!=null&&j.set("thread_id",c.threadId),c.entityType!=null&&j.set("entity_type",c.entityType),$(`/${Ae}/transaction/${encodeURIComponent(w)}/${c.transactionId??c.entityId}?${j.toString()}`,{state:{pathnameStackToGoBack:G,message:"expenseAutomation"}})}),[$,Ae,q.state,q.pathname]),dn=F((c=>Fs(c,"common"))),V=F((c=>Ue(c))),{categoryOptions:un,paymentAccountNames:mn}=F((c=>_s(c.accountState))),pn=F((c=>Ms(c.classState))),{monthEndCloseChecksView:ee,currentSelectedView:U,selectedPeriod:O,selectedTransactionCategorizationTab:ut,currentSelectedViewBackgroundRefreshFetchState:hn,currentSelectedViewFetchState:ie,jeSchedules:mt,reconciliation:Ot}=V;Zc(U==="transaction_categorization");const Sn=V.transactionView.saveStatus.fetchState,ze=V.transactionView.transactions,Bt=s.useRef(ze);Bt.current=ze;const Vt=F((c=>c.expenseAutomationTransactionsViewState?.transactionCategorizationView)),jt=F((c=>c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Lt=s.useRef(Vt);Lt.current=Vt;const $t=s.useRef(jt);$t.current=jt;const Ge=F((c=>{const w=c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return w!=null?c.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[w]?.filters:void 0})),zt=s.useRef("");s.useEffect((()=>{if(U!=="transaction_categorization")return;const c=V.transactionView.uiState.searchString??"";if(ie.fetchState!=="Completed"||c.length===0||c===zt.current)return;zt.current=c;const w=Ge!=null?$c(Ge):0,G=Ge?.categories.filter((j=>j.values.length>0&&String(j.values[0]??"").trim()!=="")).map((j=>`${j.field}:${j.values.join(",")}`))??[];H.trackAiCloseTransactionSearch({filtersApplied:G,hasResults:ze.length>0,isFiltered:w>0,resultsCount:ze.length,searchTerm:c,searchType:"free_text"})}),[U,ie.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,Ge]);const le=ei(Sn,(()=>{const c=[],w=$t.current,G=Lt.current,j=G!=null&&w!=null?G[w]:void 0;if(j?.transactionReviewLocalDataById!=null)for(const fe of Object.values(j.transactionReviewLocalDataById)){const ae=fe?.transactionReviewLocalData?.lineItemById;if(ae!=null)for(const pt of Object.values(ae)){const _e=pt?.account;_e?.accountId!=null&&c.push(_e.accountId)}}const Ce=Bt.current;for(const fe of Ce)for(const ae of fe.lines??[])"account"in ae&&ae.account?.accountId!=null&&c.push(ae.account.accountId);return c}));s.useEffect((()=>{U==="transaction_categorization"&&A!==!0||it(void 0)}),[U,it,A]),s.useEffect((()=>{S===!0&&n?.()}),[U,Ot.selectedAccountId]);const gn=V.transactionView.selectedTransactionCategorizationCompletedSubTab,Cn=V.transactionView.selectedTransactionGroup,Ne=`${ut}|${gn}|${Cn}`,qe=s.useRef(null),Gt=s.useRef(null);s.useEffect((()=>{qe.current!==null?qe.current!==Ne&&(qe.current=Ne,U==="transaction_categorization"&&Z()):qe.current=Ne}),[Z,U,Ne]);const fn=F((c=>ge==null?void 0:Us(c.transactionState,ge))),ue=fn?.qboId,Nt=F((c=>ue==null?void 0:Os(c,ue)));s.useEffect((()=>{ue!=null&&b(Bs(ue))}),[b,ue]);const{createTransferEntryStatus:qt,creditCardTransferAccountsList:Jt,transferAccounts:Yt}=V.transactionView,Wt=s.useCallback((c=>ti(b,c)),[b]),Xt=s.useMemo((()=>U!=="transaction_categorization"||z==null?null:z.contentType==="activity"?dt===!0?T.jsx(zc,{activityLogView:Nt,qboId:ue,onClose:()=>Q(null),selectedTransactionId:z.detail.transactionId,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null:z.contentType==="transfer"?T.jsx(Gc,{createTransferEntryStatus:qt,creditCardTransferAccountsList:Jt,transaction:z.detail,transferAccounts:Yt,onClose:()=>Q(null),onCreateTransfer:Wt,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null),[U,z,dt,Nt,ue,qt,Jt,Yt,Wt]),In=Xt!=null,{selectedAccountId:we}=Ot,Ht=tt(mt.accountSettingsView.saveState.fetchState),kn=F((c=>Vs(c.accountState,c.accountListState,"accountList"))),Tn=F((c=>js(c))),Re=Wa(an)??U,bn=F((c=>c.entityAutoCompleteState.autoCompleteText.common));if(Ga({isDataReady:ie.fetchState==="Completed"}),rt==null)throw Error("Can't access expense automation screen without signing in...");const Kt=Oa(O),De=nt(Kt.start),Fe=nt(Kt.end);if(De==null||Fe==null)throw Error(`Invalid start - ${De} and end - ${Fe} period from given ${O}`);const Pn=s.useCallback((()=>{Ee(!1)}),[]),yn=s.useCallback((()=>{Se(!0)}),[]),vn=s.useCallback((c=>{y(c),Se(!1)}),[]),En=s.useCallback((()=>{y([])}),[]),Je=V.missingReceipts.bulkUpload.phase,Qt=V.missingReceipts.bulkUpload.currentBatchId;s.useEffect((()=>{xe===!0&&U==="missing_receipts"&&Je==="matching"&&Qt!=null&&b(Ba({cacheOverride:!0}))}),[xe,U,Je,Qt,b]);const Zt=rt?.userId,An=O.month,xn=O.year,ea=B?.tenantId;s.useEffect((()=>{U==="missing_receipts"&&xe!==!1&&Je==="idle"&&Zt!=null&&ea!=null&&b(Ls())}),[U,xe,Je,Zt,ea,An,xn,b]),s.useEffect((()=>{K.newVendorState?.vendorDetailLocalData?.vendorName!=null?D(!0):D(!1)}),[K.newVendorState?.vendorDetailLocalData?.vendorName]),s.useEffect((()=>{Re!=null&&U!==Re&&b(Va(Re))}),[Re]),s.useEffect((()=>{xt===!1&&ie.fetchState==="Completed"&&i&&(tn(!0),b(ua(!1,!1,de)))}),[xt,ie,i,de]),s.useEffect((()=>{const c={month:O.month,year:O.year},w=Gt.current;Gt.current=c,w===null||w.month===c.month&&w.year===c.year||!Dt&&i&&(b(ua(!1,!1,de)),b(re(O,we,!1,!1)))}),[O.month,O.year,i,de]);const Ye=s.useCallback(((c=!1,w=!1)=>{const G={start:De,end:Fe};switch(U){case"transaction_categorization":b(pe(ut,G,c,!lt,void 0,void 0,w)),Rt(!1);break;case"flux_analysis":b(et(O,c,w,null));break;case"month_end_insights":if(w===!1){const j=new Date(O.year,O.month,0),Ce=zs(j.toDateString()).format(Qa.analytics.YYYYDashMMDashDDFormat);b(Gs(!0,B.companyId,B.tenantId,Ce)),b(Ns(B.companyId,B.tenantId))}break;case"je_schedules":b($s(G,w,de));break;case"missing_receipts":b(ja(G,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,w));break;default:b(re(O,we,c,w))}}),[U,De,Fe,B.companyId,B.tenantId,ut,O,we,lt,Rt,de]),wn=s.useCallback((()=>{Ye(!0,!0)}),[Ye]);s.useEffect((()=>{U===Re&&ie.fetchState==="Not-Started"&&i&&Ye(!0)}),[ie,De,Fe,B.companyId,B.tenantId,i]),s.useEffect((()=>{Dt||lt||wt.current||hn.fetchState==="In-Progress"||ie.fetchState!=="Completed"||(wt.current=!0,Ye(!0,!0))}),[]),s.useEffect((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState!=="Completed"&&ee.fetchState!=="Error"&&B?.tenantId!=null&&b(Me({tenantId:B.tenantId,period:O,refreshViewInBackground:!1}))}),[ee.fetchState,B?.tenantId]),s.useEffect((()=>{ee.fetchState!=="Completed"||!i||(ee.monthEndCloseChecks?.monthEndCloseCheckList.some((c=>c.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&b(re(O,void 0,!1,!1))}),[ee.fetchState,i,O.month,O.year,V.reconciliation.fetchStatus.fetchState,b]),s.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?Ee(!0):Ee(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),s.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&i&&(b(Me({tenantId:B.tenantId,period:O,refreshViewInBackground:!0})),b(qs({companyId:B.companyId})),$("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,B.tenantId,O,B.companyId,i]),s.useEffect((()=>{const c=setInterval((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState==="Completed"&&b(Me({tenantId:B.tenantId,period:O,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(c)}),[ee.fetchState,B.tenantId,O,b]),s.useEffect((()=>{const c=setInterval((()=>{U==="reconciliation"&&we==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&b(re(O,void 0,!0,!0))}),3e5);return()=>clearInterval(c)}),[U,b,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,re,we,O]);const Rn=ya(),{isFeatureEnabled:Dn}=oe(X.isRecommendationFeedbackEnabled),ta=Nc(),{onRecommendationSelection:aa,popup:Fn}=ai({isEnabled:Dn}),_n=s.useMemo((()=>({...ta,onRecommendationSelection:aa})),[ta,aa]);s.useEffect((()=>{const c=(ee.monthEndCloseChecks?.monthEndCloseCheckList.find((w=>w.id==="month_end_insights"))?.isDisabled??!1)&&!_t;U!=="month_end_insights"||!c&&ee.monthEndCloseChecks?.reportEmailSentDate==null||$("../")}),[U,ee.monthEndCloseChecks]);const Mn=S===!0?l:E,Un=S===!0||A===!0,On=S===!0?n:f,Bn=S!==!0&&_;s.useEffect((()=>{Ht==="In-Progress"&&mt.accountSettingsView.saveState.fetchState==="Completed"&&b(ma())}),[Ht,mt.accountSettingsView.saveState.fetchState,ma]);const{transactionId:na,onSaveVendor:Vn,onSaveSuccess:jn,onCancel:Ln,vendorViewDetails:$n}=(({expenseAutomationViewSelector:c,closeDrawerHandler:w,currentSelectedView:G})=>{const j=he();let Ce,fe,ae;const pt=ya(),_e=c.transactionView;let sa=()=>{};const{transactions:zn,selectedTransactionId:Ie,selectedTransactionLineId:We,transactionLocalData:Gn}=_e;if(G==="transaction_categorization"){const ht=Gn.find((me=>me.transactionId===Ie)),ne=zn.find((me=>me.id===Ie)),oa=We!=null?ht?.transactionReviewLocalData?.lineItemById[We]:void 0,ca=oa?.account;fe=oa?.class?.classId,Ce=["Uncategorized Income","Uncategorized Expense"].includes(ca?.accountName??"")?void 0:ca?.accountId;const qn=pi(Ie,ne?.typeOfTransaction);ne!=null&&qn&&(ae={id:Ie,type:bt(ne.typeOfTransaction)}),sa=()=>{if(Ie!=null&&We!=null&&ne!=null){const me=_e.transactionLocalData.find((Xe=>Xe.transactionId===Ie))?.transactionReviewLocalData;if(me!=null&&ne.lines!=null&&ne.lines.length>0){const Xe=me.lineItemById[We];let St=me.selectedEntity;if(xs(ne)||(St=Xe.selectedEntityLine),St!=null){const Jn=St,Yn={transactionId:{id:ne.id,type:ne.type},transaction:ne,lineIds:ne.lines.map((Wn=>Wn.id))??[]};j(Pt({entity:Jn,amount:Xe.amount.amount,transactionDetails:Yn,flowType:"categorization",selectedTab:c.selectedTransactionCategorizationTab,isFetchCOT:pt}))}}}}}const Nn=F((ht=>ra(ht,void 0,Ce,fe)));return{transactionId:ae,onSaveVendor:()=>{j(As(ae,void 0,!1,!0))},onSaveSuccess:sa,onCancel:()=>{ae!=null&&j(ys({transactionId:ae})),j(vs()),j(Es()),w()},vendorViewDetails:Nn}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{D(!1)},currentSelectedView:U});return Ft?.loggedInUserRoleMap==null?ee.fetchState==="Error"?T.jsx(qc,{onGoHome:()=>$("../",{replace:!0}),onReload:()=>window.location.reload()}):T.jsx(qa,{fetchState:"In-Progress"}):T.jsxs(T.Fragment,{children:[T.jsx(Ci,{isOpen:ct,drawerLeftMargin:new Jc(0,0,300,650),onClose:()=>{Se(!1)},children:T.jsx(Vi,{onClick:c=>c.stopPropagation(),children:T.jsx(Ri,{companyId:B.companyId,closeCustomerRequestDrawer:()=>Se(!1),addCustomerRequest:vn,resetCustomerRequest:En})})}),na!=null&&P&&T.jsx(oi,{isOpen:P,transactionId:na,onSaveVendor:Vn,onSaveSuccess:jn,onCancel:Ln,vendorViewDetails:$n}),T.jsx(Yc,{toolkit:_n,children:T.jsx(Oi,{events:[],eventCallback:(c,w,G)=>{},navigate:$,location:q,themeState:v,categoryOptions:un,classesForFilters:pn,accountsForFilters:mn,vendorSearchAutoCompleteData:{autoCompleteText:bn,entityAutoCompleteView:dn},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:xe,monthEndInsightsPreviewMode:je,monthEndInsightsCustomerRequestData:Le,isRealtimeInsightsFeatureEnabled:_t,isCreateTransferEntryFromExpenseEnabled:Ut,isCreateTransactionEnabled:sn===!0&&Ft?.connectionName!=="netsuite",isCreatingTransaction:on.fetchState==="In-Progress",onCreateTransactionSelect:c=>{Ae!=null&&(H.trackCreateTransactionRequested({transactionType:c}),$(hi(Ae,c)))},isAccountingClassesEnabled:Tn,isProjectsTransactionsEnabled:cn,isCOTEnabled:Rn,currentTenant:B,companyId:B.companyId,signedInUser:rt,isTransactionActivityEnabled:dt,isRightPanelOpen:In,rightSidePanel:Xt,onOpenTransferRightPanel:Ut===!0?Za:void 0,uncategorizedAccounts:kn,newScheduleActiveType:se,isAccrualEnabled:Mt,isActualMatchingEnabled:de,newScheduleSelection:ye,onNewScheduleSelectionChange:ve,onScheduleTypeChange:Pe,onNewScheduleSaved:wn,onClickCustomerRequest:yn,handleEditClick:Pn,tenantEmailDomain:Ae,trackExpenseAutomationTabAnalytics:d,setActivityLogTransactionId:it,closeMatchSidePanel:t,closeSidePanel:On,openTransactionPanel:r,closeSchedulePanel:x,openSchedulePanel:m,openMatchPanel:o,sidePanelIsOpen:Un,sidePanelIsFullView:Bn,panelContent:Mn,isAiCfoAccessEnabled:J,onAskAiCfoClick:en,isReconV3Enabled:ln,onExpenseAutomationCommentingThreadClick:rn,sidePanelListPercent:S===!0?66:void 0,isMatchPanelOpen:k,isSchedulePanelOpen:R,matchPanelContent:I,schedulePanelContent:g,schedulePendingDiscardConfirmation:u})}),Fn,le.showPopup&&le.popupType!=null&&T.jsx(Wc,{popupType:le.popupType,currencySymbol:le.currencySymbol,accountId:le.popupAccountId??"",accountName:le.popupAccountName??"",onSubmit:le.handleSubmit,onDismiss:le.handleDismiss})]})}))))),Vi=be(Ac)`
35
+ display: flex;
36
+ min-height: 100%;
37
+ flex-direction: column;
38
+ `;function ji(){const t=Te(),{selectedTab:n,tenantEmailDomain:f}=Be(),I=F((r=>ke(r))),k=F((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[I.tenantId]));if(Wa(n)==null)return T.jsx(La,{});const o=Ya({tenantEmailDomain:f,selectedTab:n,selectedPeriod:k!=null?`${k.month}-${k.year}`:void 0});return o==null?null:T.jsx(Qn,{to:o,replace:!0,state:t.state})}function Sl(){return T.jsxs(Kn,{children:[T.jsx(He,{index:!0,element:T.jsx(fi,{})}),T.jsx(He,{path:"/:selectedTab/:selectedPeriod/*",element:T.jsx(Bi,{})}),T.jsx(He,{path:"/:selectedTab",element:T.jsx(ji,{})}),T.jsx(He,{path:"*",element:T.jsx(La,{})})]})}export{Sl as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-2F3ER8H4.js";import{a as r}from"./sentry-Dwi3Xpu2.js";import{ax as f,ay as c,K as l,a5 as p}from"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import m from"./NotFoundScreen-CjcmfT5h.js";import{h as u,g as b}from"./core-BmXpopk3.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]="08549f3e-b21e-4a34-9e4c-629f5ca64db3",e._sentryDebugIdIdentifier="sentry-dbid-08549f3e-b21e-4a34-9e4c-629f5ca64db3")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=p(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=f(a.pathname);return o!=null?s.jsx(c,{menuItem:l(o),onDemoClick:t,onGoBack:i}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -0,0 +1 @@
1
+ import{a as r}from"./sentry-Dwi3Xpu2.js";import{u as l,h as m,g as p}from"./core-BmXpopk3.js";import{hY as f,UL as g,UM as b}from"./zeni-epic-state-DtY6MD5C.js";import{u as _,L as h,z as y}from"./index-BH7Z90Ry.js";import"./liveblocks-2F3ER8H4.js";import"./recharts-lgPPofcu.js";import"./mui-DpZKsKJ-.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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]="e75d06d0-2c31-444b-9b95-65670d27ecbe",e._sentryDebugIdIdentifier="sentry-dbid-e75d06d0-2c31-444b-9b95-65670d27ecbe")}catch{}})();function j(){const e=l(),n=m(),o=p(),{setLoading:i,clearAllLoading:u}=_(),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"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(f(t.tenant_id,t.connection_id,g("revenue"),b("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -1 +1 @@
1
- import{n as s}from"./liveblocks-e6rGc1UF.js";import{j as d}from"./core-CHD8T-IM.js";import{fF as a}from"./zeni-epic-state-BO3zdDfL.js";import"./sentry-DsyKtMW2.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-2F3ER8H4.js";import{j as d}from"./core-BmXpopk3.js";import{fF as a}from"./zeni-epic-state-DtY6MD5C.js";import"./sentry-Dwi3Xpu2.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 c}from"./liveblocks-2F3ER8H4.js";import{a as r}from"./sentry-Dwi3Xpu2.js";import{u as L,h as P,i as F,j as k,t as X,l as O,s as H,g as J,N as B,n as ae,o as x}from"./core-BmXpopk3.js";import{a9 as et,m as g,ar as R,U as l,ce as nt,cf as tt,cg as it,ch as ot,ci as at,cj as ct,ck as st,cl as rt,cm as lt,cn as dt,co as ut,cp as gt,p as Y,cq as mt,cr as vt,z as W,af as re,cs as pt,ct as St,cu as ft,cv as It,cw as ht,cx as Ct,cy as kt,cz as Et,cA as yt,cB as bt,O as xt,aj as ln,cC as At,cD as Dt,cE as jt,cF as Lt,cG as Pt,cH as _t,cI as $t,cJ as wt,cK as Ft,cL as Rt,cM as Tt,t as qe,k as _e,cN as Ot,cO as Mt,cP as Nt,cQ as Ut,cR as Bt,cS as Vt,cT as Ht}from"./index-BH7Z90Ry.js";import"./mui-DpZKsKJ-.js";import{A as K}from"./AddressScreen-CvhZrOl1.js";import M from"./NotFoundScreen-CjcmfT5h.js";import{_3 as qt,_4 as Qt,vp as Qe,_5 as G,vS as le,_6 as $e,_7 as de,wt as xe,wA as zt,wF as dn,_8 as we,wx as un,y7 as ze,vR as Ke,_9 as Kt,_a as gn,wQ as Ae,_b as ue,wU as Gt,_c as Wt,_d as mn,wX as vn,z2 as Xt,_e as fe,_f as Ge,_g as pn,vP as Jt,_h as Yt,vJ as Zt,_i as ei,yk as ni,_j as Sn,yt as We,_k as ti,yq as ii,_l as Fe,gh as Re,_m as ie,_n as oe,xa as oi,vX as Xe,w0 as fn,v_ as ai,vU as ci,x3 as si,w2 as ri,xc as li,_o as De,xl as In,xj as Z,xh as ge,xg as di,_p as hn,yz as Je,_q as ui,vQ as Cn,_r as Te,fF as Ie,wb as je,w8 as Le,wl as kn,wk as Oe,w5 as gi,we as En,wn as ce,VM as yn,vT as Me,wi as mi,wj as vi,wh as pi,_s as Si,wV as fi,wR as bn,_t as xn,vD as Ye,_u as Ii,vz as hi,_v as Ci,yF as ki,yJ as Q,yE as Ei,xN as he,_w as yi,_x as An,yS as Ze,_y as bi,yP as xi,_z as Dn,xQ as Ai,xR as V,xU as Di,_A as jn,y2 as Ee,_B as ji,xb as Ln,Ui as Pn,_C as Li,yc as Pi,_D as _n,_E as _i,_F as $i,_G as wi,zH as Fi,_H as Ri,_I as $n,yZ as wn,_J as Fn,zF as ye,_K as Ti,zC as Oi,_L as Mi,_M as Ni,_N as Ui,_O as Bi,_P as Vi,_Q as en,_R as Hi,eg as qi,zL as Qi,_S as Ne,xv as zi,xq as Ki,_T as me,xG as Rn,xy as ve,xx as Gi,xB as Tn,_U as Wi,xw as Xi,_V as On,z3 as Mn,zu as nn,zp as Ji,_W as Yi,z4 as Zi,_X as eo,zv as no,zz as to,_Y as Ue,wv as Nn,zg as io,ww as oo,_Z as ao,__ as Un,c8 as co,ms as so,mt as ro,_$ as tn,wu as pe,gl as lo,mz as uo,zm as Bn,zX as go,zj as Vn,uX as mo,uL as vo,hS as po,UL as on,UM as So,Gh as Hn,zU as fo,hK as Io,zR as ho,$0 as Co,VB as ko,$1 as Eo,A0 as be,A1 as yo,$2 as bo,$3 as qn,z_ as xo,$4 as Ao,$5 as Do,yg as jo,$6 as Lo}from"./zeni-epic-state-DtY6MD5C.js";import{M as Po}from"./MobileAppDrawer-thURFqdR.js";import{q as Se}from"./QBOConnectionScreen-zn7s2M2b.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.js";import"./InboxNotificationsProvider-jZPrqdDf.js";import"./useTaskManagerAccess-DvrYqbN3.js";import"./empty-0E71-pkh.js";import"./pdf-lib-DgpGz3__.js";import"./index-_EB0AYfG.js";import"./url-CuCw2GYz.js";import"./index-Diiw4rJ6.js";import"./decodeURIComponentSafe-CmNiiSLm.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]="c55e082d-cb5a-421e-9309-c9b5db3f7c32",t._sentryDebugIdIdentifier="sentry-dbid-c55e082d-cb5a-421e-9309-c9b5db3f7c32")}catch{}})();const $=({event:t,isReady:e=!0})=>e?c.jsx(et,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function _o(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:v,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(qt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((_,U)=>{const T=Qt(D,_,U,E);T!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:_,entityId:U,fromScreen:"audit_log",toScreen:_}),e(T))}),[E,e,D]);r.useEffect((()=>{const _=setTimeout((()=>u(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&t(Qe({filters:y,keepExistingListItems:!1,sort:m}))}),[i,y,m,t]);const A=v==="Not-Started"||v==="In-Progress"&&f.length===0,C=v==="In-Progress"&&f.length>0,j=v==="Completed";return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(nt,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:S,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{S&&I!=null&&t(Qe({cursor:I,filters:y,keepExistingListItems:!0,sort:m}))},onSearchChange:o,onSortChange:p})]})}function Ce(t,e=!1){const n=L(),i=k((s=>G(s).productNextCursor!=null)),a=k((s=>G(s).productNextCursor)),o=k((s=>G(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ee(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const p=d.current==="In-Progress";d.current=t,t==="Completed"&&p&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((p=>p+1)))}),[s,e]),a}const $o=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!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(un({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(we({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i}),t(dn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(zt({action:o,id:a,parentItemId:i}))}}}))(tt);function Fo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[a]=X(),{areTenantIdsInSync:o}=R(),s=(u=a.get("kind"))!=null&&$o.has(u)?u:"plan";var u;const d=k((y=>$e(y,n))),{pageFetchState:p}=d,m=p.fetchState;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:s}))}),[o,n,s,t]);const v=r.useCallback((y=>t(xe({cacheOverride:!0,id:y,kind:s}))),[t,s]),S=ee(d.fetchState,d.isFormLoading,n,v),f=m==="Completed"&&!d.isFormLoading;Ce(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(m==="Not-Started"||m==="In-Progress"||d.isFormLoading);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(wo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},S)]})}const Ro=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:a}=e,o=a!=null?`${n}/catalog/${encodeURIComponent(a)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(de({id:a})),e.navigate(`${n}/catalog`)},onChange:s=>{t(we({id:a,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{mode:i}),t(dn({id:a}))}}}))(it);function Mo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[a]=X(),{areTenantIdsInSync:o}=R(),s=n!=null,u=a.get("type"),d=u!=null&&Ro.has(u)?u:void 0,p=(m=a.get("kind"))!=null&&To.has(m)?m:"plan";var m;const v=k((S=>$e(S,n)));return Ce(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:p}))}),[o,n,p,t]),r.useEffect((()=>{s||d==null||v.localData.catalogType===d||t(we({localData:{...v.localData,catalogType:d}}))}),[s,d,v.localData?.catalogType,t]),r.useEffect((()=>{if(v.fetchState==="Completed"){const S=v.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(de({id:n}))}}),[v.fetchState,v.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&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:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="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",a=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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=No[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onCatalogItemLifecycleAction:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:u,fromScreen:"catalog_list",itemId:s}),t(un({action:Kt(u),id:s}))},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(Ke({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Ke({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(ot);function Bo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,p]=r.useState(""),[m,v]=r.useState(null),S=r.useMemo((()=>m!=null?{dir:m.direction,field:m.columnKey}:void 0),[m]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((_=>G(_))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed",j=h.runningActionId??null;return r.useEffect((()=>{const _=setTimeout((()=>p(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[i,t,I,E,S]),r.useEffect((()=>{i&&(f!==y||S?.field!==D?.field||S?.dir!==D?.dir)&&t(ze({cacheOverride:!0,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[y,D,i,t,I,E,f,S]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:m,planFilters:I,productFilters:E,sort:S,planNextCursor:b,productNextCursor:A,runningCatalogItemActionId:j,onSearchChange:o,onTabChange:u,onSortChange:v})]})}const Vo=O((function(t,e){const n=gn(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,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ue({id:i})),e.navigate(`${n}/discounts`)},onChange:s=>{t(Wt({id:i,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{mode:a}),t(Gt({id:i}))}}}))(at);function Ho(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,savedCouponId:s}=k((u=>gn(u,n)));return r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ue({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCouponFormPage}),c.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=mn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(pn(a))},onSubmit:()=>{const a=Yt(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(Zt(a))}}}))(st);function Qo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),[i]=X(),{areTenantIdsInSync:a}=R(),o=i.get("customerId"),s=k((b=>mn(b))),u=s.fetchState,d=s.localData,p=s.savedInvoiceId,m=k(vn),v=k((b=>Xt(b))),S=k(fe),f=v.fetchState==="Not-Started"||v.fetchState==="In-Progress"&&m==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,E=f||I,h=v.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(pn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(Jt({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=p!=null?`/${n}/invoicing/invoices/${encodeURIComponent(p)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,p,e,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(ct,{}):c.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const zo=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=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(rt);function Ko(){const t=L(),e=P(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>ei(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(ni({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(zo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=Sn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ii({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(lt);function Wo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=Sn(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(We({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ti(D)),onSortChange:p})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Xo=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:a=>{t(De({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new`)},onDiscardEdit:()=>{t(Z(ge)),t(di({id:i}))},onOpenAddress:()=>{const a=Qn(e.tenantEmailDomain??"",ge,i),o=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i}),t(De({id:i,localData:a})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(li({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(ri({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(gt);function Jo(){const t=L(),e=P(),n=J(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((T=>Fe(T,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[p,m]=r.useState(!1),[v,S]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;C.current!=="Error"&&T==="Error"&&t(Re({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=T}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ie()),t(oe()),()=>{t(ie()),t(oe())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(oi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(Xe({customerId:i}))}),[o,i,t,A]);const _=r.useCallback((T=>t(fn({id:T}))),[t]),U=ee(s.fetchState,s.isFormLoading,i,_);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(Xo,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(ie()),i!=null&&A&&t(Xe({customerId:i})),m(!0)},onCreatePromotionalCredits:()=>{t(oe()),S(!0)}},U),c.jsx(dt,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:p,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(ci({customerId:i}))},onClose:()=>{m(!1),t(ie())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(ai({customerId:i,data:T})))}}),c.jsx(ut,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:v,submitSucceeded:y.fetchState==="Completed",onClose:()=>{S(!1),t(oe())},onSubmit:({amount:T,description:te})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(si({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:te})))}})]})}const Yo=O((function(t,e){const n=Fe(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,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(hn({id:i})),t(Z(ge)),e.navigate(`${n}/customers`)},onChange:s=>{t(De({id:i,localData:s}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",ge,i),u=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{mode:a}),t(In({id:i}))}}}))(mt);function Zo(){const t=L(),e=P(),n=J(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCustomerId:u}=k((d=>Fe(d,i)));return r.useEffect((()=>{o&&i!=null&&t(fn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,p=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(p),t(hn({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerFormPage}),c.jsx(Yo,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ea=O((function(t){const e=fe(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(Cn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(vt);function na(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Je({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ui(D)),onSortChange:p})]})}const Pe=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:Pe(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=Pe(s,a),p=s.actionStateByKind.retry?.fetchState==="In-Progress",m=s.actionStateByKind.rollback?.fetchState==="In-Progress",v=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Le({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||p?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Oe(a)))},onRollback:v?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(kn(a)))}:void 0}}))(pt);function ia(){const t=L(),e=P(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),[o,s]=r.useState({}),u=k(Te),d=k(Ie),p=r.useMemo((()=>{const E=W.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),m=Pe(u,n),v=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(je(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const S=m?.status==="scanning"||m?.status==="importing";r.useEffect((()=>{if(!a||n==null||!S)return;const E=setInterval((()=>{t(je(n)),t(Le({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,S,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=v?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportDetailPage,isReady:m!=null&&I!=="Not-Started"}),c.jsx(ta,{authParams:p,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const zn=t=>`invoicing_active_migration:${t}`,se=(t,e)=>{if(t!=null&&t!=="")try{const n=zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.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,a=o=>{const s=o??null;t(ce(s)),se(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Oe(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(St);function aa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(Te);r.useEffect((()=>{i&&(t(gi()),t(En()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(oa,{navigate:e,tenantEmailDomain:n,view:a})]})}const ca=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:p,sessions:m}=u,v=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),S=n!=null?p[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:S??m.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(pi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{n!=null&&t(Oe(n))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(vi(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(mi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ft);function sa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(vn),o=k(Ie),s=r.useMemo((()=>{const h=W.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??W.getSignedInUserTenant(n??"")?.companyId,p=k((h=>yn(h,d))),m=k(Te),{activeMigrationSessionId:v}=m,S=v??void 0,f=S!=null?m.sessionDetail[S]??m.sessions.find((h=>h.id===S)):void 0;r.useEffect((()=>{i&&(t(Me()),t(En()))}),[i,t]),r.useEffect((()=>{if(v!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(zn(y))}catch{return null}})(n);h!=null&&t(ce(h))}),[v,t,n]),r.useEffect((()=>{se(n,v)}),[v,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||S==null||!E)return;const h=setInterval((()=>{t(je(S))}),3e3);return()=>clearInterval(h)}),[i,S,E,t]),r.useEffect((()=>{I==="done"&&(t(ce(null)),se(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(ca,{activeId:S,authParams:s,integrationsView:p,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:m,onBack:()=>{t(ce(null)),se(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:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(bn({action:a,id:i}))},onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i}),t(fi({data:a,id:i}))}}}))(It);function la(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((I=>Si(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[p,m]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&m(n)}),[n,d]);const v=p===n;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]);const S=r.useCallback((I=>t(Ae({cacheOverride:!0,id:I}))),[t]),f=ee(o.fetchState,o.isFormLoading,n,S);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(ra,{hasLoadedRecord:v,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=xn(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=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(bn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(hi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(ht);function ua(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=xn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(Ii(b)),onSortChange:p})]})}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,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(Q({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(Q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(Q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(Q({action:"retry",id:i}))}:void 0}}))(kt);function ma(){const t=L(),e=P(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((C=>Ci(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,p]=r.useState("idle"),[m,v]=r.useState(!1),[S,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{p("idle"),v(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(ki({id:n})),p("idle"),v(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(v(!1),p("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(Q({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=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((()=>{a&&n!=null&&t(Ei({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(he({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{p("idle"),v(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(p("idle"),v(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?m&&o.actionState.fetchState==="Completed"?(n!=null&&t(yi({id:n})),h()):m&&o.actionState.fetchState==="Error"&&p("failed"):v(!0))}),[n,h,t,d,m,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(Ct,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const va=O((function(t){const e=An(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`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};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:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(Q({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(xi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Et);function pa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=An(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ze({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(bi(b)),onSortChange:p})]})}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,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail"}),t(Di({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
+ `).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(V({action:"void",invoiceId:i,body:s}))}}}))(yt);function fa(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((f=>Dn(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,p]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&p(n)}),[n,u]);const m=d===n;r.useEffect((()=>{a&&n!=null&&t(Ai({invoiceId:n}))}),[a,n,t]);const v=r.useCallback((f=>t(he({invoiceId:f}))),[t]),S=ee(o.actionState.fetchState,o.fetchState==="In-Progress",n,v);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:m,navigate:e,tenantEmailDomain:i,view:o},S)]})}const Ia=O((function(t){const e=jn(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`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(V({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(V({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(Ln({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(bt);function ha(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=jn(A);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:C.nextCursor,invoiceListFetchState:C.fetchState,voidingInvoiceId:C.runningActionId,invoices:C.invoices}}),H),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ee({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(ji(A)),t(Ee({cacheOverride:!1,filters:v,sort:m}))},onSortChange:p})]})}function an(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),i=xt(),a=ln(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=k(Pn),p=Li(i?.loggedInUserRoleMap),m=`/${n}/invoicing`,v=S=>{s(S)};return d==="completed"?c.jsx(B,{to:`${m}/overview`,replace:!0}):d==="settings"&&p?c.jsx(B,{to:`${m}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPromoPage}),c.jsx(Po,{isAppContentDrawerOpen:o,handleDrawerToggle:v}),c.jsx(At,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!p,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(Pi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{v(!0)}})]})}const Ca=O((function(t,e){const n=_n(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(Ri({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Fi())}}}))(Dt);function ka(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:p}=k((f=>_n(f,n??""))),m=`/${i}/invoicing`,v=r.useRef(null);r.useEffect((()=>{t(_i()),v.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(he({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&v.current!==n&&(v.current=n,t($i({localData:wi(s)})))}),[t,o,s,n]);const S=r.useRef(p.fetchState);return r.useEffect((()=>{const f=S.current;S.current=p.fetchState,f!=="Completed"&&p.fetchState==="Completed"&&d!=null&&e(`${m}/credits/${encodeURIComponent(d)}`)}),[d,e,p.fetchState,m]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Ea=O((function(t){return{invoicingOverview:$n(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(wn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(jt);function ya(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>$n(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(wn(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(Ea,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const ba=O((function(t){const e=Fn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Lt);function xa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const _=Fn(j);return{activeType:_.activeTab,appliedSearch:_.filters.search,appliedSort:_.sort,nextCursor:_.nextCursor,transactionListFetchState:_.fetchState,transactions:_.transactions}}),H),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const _=y.find((T=>T.id===j)),U=_?.linkedInvoices?.[0]?.invoiceID??_?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const _=y.find((U=>U.id===j))?.customerID;_!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:_,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(_)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(ba,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(Ti(j)),t(ye({cacheOverride:!1,filters:v,sort:m}))},onSortChange:p,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const Aa=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=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=n!=null&&n!=="",s=k(fe),u=k((C=>Mi(C))),d=k(Ni),p=k((C=>Dn(C,n??""))),m=p.invoice,v=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ui()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?he({invoiceId:n}):Cn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&m!=null&&n!=null&&p.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Bi({contextInvoiceId:n,localData:Vi(m)})))}),[t,m,n,p.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Ln({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(en({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=d.fetchState,C!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${v}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${v}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,v]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:Aa(C)})))),[s.customers]),h=k((C=>Hi(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,_=qi.currencySymbol,$t("0,0.00",j,_)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,_}))),[h]),D=r.useMemo((()=>{if(!o||m==null)return;const C=m.currencyCode??"USD",j=m.amountDue?.amount??0;return{amountDue:Pt("0,0.00",m.amountDue),amountDueValue:j,currencyCode:C,customerName:m.customerName??m.customerID,invoiceId:m.id,invoiceNumber:m.invoiceNumber??m.id}}),[m,o]),b=o?`${v}/invoices/${encodeURIComponent(n??"")}`:`${v}/payments`,A=!o||p.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(_t,{customers:E,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(en({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Qi(o?n??void 0:void 0))}})]})}const Kn=(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,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);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,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Tn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(me({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Z(ve)),t(Gi({id:i}))},onOpenAddress:()=>{const s=Kn(e.tenantEmailDomain??"",ve,i),u=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(me({id:i,localData:s})),t(Rn({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))(wt);function ja(){const t=L(),e=P(),n=J(),{subscription_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((y=>Ne(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:p}=s,m=s.pageFetchState.fetchState,v=m==="Completed"&&!s.isFormLoading,[S,f]=r.useState(v?i:void 0);r.useEffect((()=>{i!=null&&v&&f(i)}),[i,v]);const I=S===i;Ce(o),r.useEffect((()=>{o&&i!=null&&t(zi({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(Ki({id:y}))),[t]),h=ee(s.fetchState,s.isFormLoading,i,E);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionDetailPage,isReady:v}),c.jsx(Da,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:p,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const La=O((function(t,e){const n=Ne(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,a=i!=null?"edit":"create";return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(On({id:i})),t(Z(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(me({id:i,localData:o}))},onOpenAddress:()=>{const o=Kn(e.tenantEmailDomain??"",ve,i),s=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,{mode:a}),t(Rn({id:i}))}}}))(Ft);function Pa(){const t=L(),e=P(),n=J(),{subscription_id:i,tenantEmailDomain:a}=F(),[o]=X(),{areTenantIdsInSync:s}=R(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:p}=k((S=>Wi(S,i))),m=k((S=>Ne(S,i).localData));Ce(s),r.useEffect((()=>{s&&t(Xi({subscriptionId:i}))}),[s,i,t]);const v=r.useRef(!1);return r.useEffect((()=>{v.current||i!=null||u==null||u===""||m.customerId!==""||(v.current=!0,t(me({id:i,localData:{...m,customerId:u}})))}),[u,i,m,t]),r.useEffect((()=>{if(d==="Completed"){const S=p??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),t(On({id:i}))}}),[d,p,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(La,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const _a=O((function(t){const e=Mn(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=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Tn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(Zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Rt);function $a(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Mn(C);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),H),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(nn({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(Ji())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(_a,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(Yi(C)),onSortChange:p})]})}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:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(to({action:"capture",id:i}))}:void 0}}))(Tt);function Fa(){const t=L(),e=P(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>eo(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(no({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(wa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Gn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=R(),u=k(Ue),d=u.connection?.connected===!0,p=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&p!=="Not-Started"||o(Nn()),n&&o(io()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(oo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const Ra={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ne(t){const e=L(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=F(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:p}=k(ao),{configError:m,configFetchState:v,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Un),h=k(Ue);Gn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(Ie),D=t==="dunning"||t==="quickbooks",b=y.companyId??W.getSignedInUserTenant(i??"")?.companyId,A=k((w=>yn(w,b))),C=co(y.userRole??[]),j=y.tenantId??"",_=W.getSignedInUser(),U={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:j},T=s?.fileId,te=k((w=>T!=null&&T!==""?so(w,T):void 0)),Be=k((w=>T!=null&&T!==""?ro(w,T):void 0)),Wn=T!=null&&T!==""&&te!=null?{[T]:te}:{},Xn=T!=null&&T!==""&&Be!=null?{[T]:Be}:{};r.useEffect((()=>(e(tn()),()=>{e(tn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[n,e,a]),r.useEffect((()=>{n&&D&&v==="Not-Started"&&e(pe())}),[n,e,v,D]),r.useEffect((()=>{if(!n)return;const w=_?.userId;w!=null&&w!==""&&j!==""&&qe.shouldFetchActiveTenant(j)&&(qe.markActiveTenantFetchStarted(j),e(lo(w,j,_?.zeniSessionId)))}),[n,e,_?.userId,_?.zeniSessionId,j]);const Jn=S.length>0||f.length>0,Yn=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!Jn&&(v==="Not-Started"||v==="In-Progress"),Zn=a==="Completed"&&(!D||v==="Completed"),Ve=A.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,ke=re?.invoicingMicroServiceBaseUrl,He=ke!=null&&ke.length>0?`${ke}/1.0/webhooks/stripe`:"",z={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:p.fetchState==="In-Progress",onConnectStripe:w=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(ho(w))},onDisconnect:(w,q)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:q,entityId:w,fromScreen:t??"hub"}),e(Io(j,w,on(q))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(fo())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const w=y.tenantEmailDomain??i??"";Se.init("/connection/auth",w),Se.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Hn()))},onSaveChargeBeeCredentials:(w,q)=>{Ve!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(po(j,Ve,on("revenue"),So("chargebee"),{api_key:w,site:q})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He};return{authParams:U,deleteFileStatusById:Wn,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:re?.fileMicroServiceBaseUrl??"",integrationsSectionProps:z,isInvoicingPageReady:Zn,isLoading:Yn,isSaving:u.fetchState==="In-Progress",isStripeBusy:p.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&v==="Error"?m?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He,updateFileStatusById:Xn,onConnectStripe:z.onConnectStripe,onDeleteFile:w=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(vo(w,j))},onDisconnectStripe:z.onDisconnectStripe,onEditFileName:(w,q)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(mo(w,q.split(".")[0],j))},onReconnectQBO:z.onReconnectQBO,onRefreshQBO:z.onRefreshQBO,onRetryQboSyncTask:w=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:w,fromScreen:t??"hub"}),e(Vn(w))},onSave:w=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(go({settings:w,snackbarSection:Ra[t??""]}))},onStartQboBackfill:w=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Bn(w))},updateFilesEntity:w=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(uo({files:w}))}}}function sn({appContent:t}){const e=P(),n=J(),i=L(),{tenantEmailDomain:a}=F(),o=ne("branding"),s=k((p=>Co(p))),u=k((p=>ko(be,p)?.addressToCreate));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&(i(Eo()),i(Z(be)))}),[s.saveState.fetchState,i]);const d=_e(s.saveState.fetchState);return r.useEffect((()=>{d==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[d,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ot,{address:u,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:p=>{i(bo({localData:p}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const p=`/${a}/invoicing/settings/branding/${be}/`,m=Y(n.state?.pathnameStackToGoBack,n.pathname);e(p,{state:{pathnameStackToGoBack:m}})},onSubmit:()=>i(yo()),updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=P(),e=ne("dunning");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Mt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=P(),e=ne("integrations");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Nt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=P(),e=ne("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Ut,{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=qn(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(Ao())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Vn(e))},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(xo())},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Bn(e))}}}))(Bt);function Ua(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),i=k(Ie),{configFetchState:a,saveState:o,settingsFetchState:s}=k(qn),u=_e(o.fetchState);return r.useEffect((()=>{u==="In-Progress"&&o.fetchState==="Completed"&&e("..")}),[e,u,o.fetchState]),r.useEffect((()=>{s!=="Not-Started"&&s!=="Error"||t(Me())}),[t,s]),r.useEffect((()=>{a==="Not-Started"&&t(pe())}),[a,t]),Gn({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Se.init("/connection/auth",i.tenantEmailDomain??n??""),Se.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Hn())}})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=ln(),e=L(),n=P(),[i,a]=X(),o=ne(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:p,isStripeConnected:m}=k(Un),v=i.get("tab");return r.useEffect((()=>{if(v==null)return;const S=Ba[v];a({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[v,n,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Vt,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:p,isStripePaymentsReady:m,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(jo())}})]})}function rn(){return c.jsxs(ae,{children:[c.jsx(x,{index:!0,element:c.jsx(Va,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Ma,{})}),c.jsx(x,{path:"branding",element:c.jsx(sn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(sn,{appContent:c.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Oa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Ta,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ua,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:"..",replace:!0})})]})}function Sc(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),{enableState:a,fetchState:o,status:s}=k(Pn),u=_e(a.fetchState),d=`/${n}/invoicing`,p=r.useRef(!1),m=k((v=>Ue(v).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||p.current||(p.current=!0,t(pe({cacheOverride:!1}))):t(pe({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&m==="Not-Started"&&t(Nn())}),[i,t,m]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(Lo()))}),[u,a.fetchState,d,t,e]),s==null&&o!=="Error"?c.jsx(Ht,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ae,{children:[c.jsx(x,{path:"/",element:c.jsx(B,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(ya,{})}),c.jsx(x,{path:"promo",element:c.jsx(B,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(na,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(Zo,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(Jo,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx($a,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(Pa,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(ja,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"invoices",element:c.jsx(ha,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Qo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(fa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(cn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(ka,{})}),c.jsx(x,{path:"payments",element:c.jsx(xa,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(cn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Fa,{})}),c.jsx(x,{path:"credits",element:c.jsx(Wo,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(Ko,{})}),c.jsx(x,{path:"discounts",element:c.jsx(ua,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Ho,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(la,{})}),c.jsx(x,{path:"dunning",element:c.jsx(pa,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ma,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Bo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(Mo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Fo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(_o,{})}),c.jsx(x,{path:"data_import",element:c.jsx(aa,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(sa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ia,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{Sc as default};
@@ -1,4 +1,4 @@
1
- import{j as t}from"./liveblocks-e6rGc1UF.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-CHD8T-IM.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-BO3zdDfL.js";import{a2 as x,J as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,N as ue,f as he,a7 as ge,F 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-DKH4PK2B.js";import{n as m}from"./mui-NTaF3UaY.js";import f from"./NotFoundScreen-CtgFRYZy.js";import{a as I}from"./sentry-DsyKtMW2.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.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]="6de49a9c-e956-4832-85a2-fab455119f03",e._sentryDebugIdIdentifier="sentry-dbid-6de49a9c-e956-4832-85a2-fab455119f03")}catch{}})();const Ie=m.div`
1
+ import{j as t}from"./liveblocks-2F3ER8H4.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as L,N as ae,n as ne,o as p}from"./core-BmXpopk3.js";import{UE as k,UF as v,UG as T,Jy as D,Jk as U,UH as B,UI as oe,UJ as ie,Jo as se,gi as $,Jv as le,Js as de}from"./zeni-epic-state-DtY6MD5C.js";import{a2 as x,I as d,a3 as re,m as j,X as G,a4 as ce,a5 as me,a6 as pe,p as H,d as ue,$ as he,a7 as ge,c as xe,E as fe,g 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-BH7Z90Ry.js";import{n as m}from"./mui-DpZKsKJ-.js";import f from"./NotFoundScreen-CjcmfT5h.js";import{a as I}from"./sentry-Dwi3Xpu2.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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]="33c4872d-fcda-4860-a02f-4af5226c8a99",e._sentryDebugIdIdentifier="sentry-dbid-33c4872d-fcda-4860-a02f-4af5226c8a99")}catch{}})();const Ie=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -6,8 +6,8 @@ import{j as t}from"./liveblocks-e6rGc1UF.js";import{i as S,l as g,h as C,g as y,
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
- `,Ce=g((function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
9
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
10
+ `,Ce=g((function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(re);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
11
11
  display: flex;
12
12
  height: 100vh;
13
13
  width: 100%;
@@ -15,8 +15,8 @@ import{j as t}from"./liveblocks-e6rGc1UF.js";import{i as S,l as g,h as C,g as y,
15
15
  flex-direction: column;
16
16
  align-items: center;
17
17
  background-color: ${e=>e.theme.colors.grey4};
18
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ne=m.div`
18
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
19
+ `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ee=m.div`
20
20
  display: flex;
21
21
  height: 100%;
22
22
  width: 100%;
@@ -24,8 +24,8 @@ import{j as t}from"./liveblocks-e6rGc1UF.js";import{i as S,l as g,h as C,g as y,
24
24
  flex-direction: column;
25
25
  align-items: center;
26
26
  background-color: ${e=>e.theme.colors.grey4};
27
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Le=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Le,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
27
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
28
+ `,Ne=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(T({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),r=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(pe);function Le(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ee,{windowSize:n,children:t.jsx(Ne,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
29
  display: flex;
30
30
  height: 100%;
31
31
  width: 100%;
@@ -33,40 +33,40 @@ import{j as t}from"./liveblocks-e6rGc1UF.js";import{i as S,l as g,h as C,g as y,
33
33
  flex-direction: column;
34
34
  align-items: center;
35
35
  background-color: ${e=>e.theme.colors.grey4};
36
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Te=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Je=m(ke)`
38
- width: ${r.sp4};
39
- height: ${r.sp4};
40
- margin-bottom: ${r.sp3};
41
- margin-top: ${r.sp3};
42
- margin-left: ${r.sp8};
36
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
37
+ `,Te=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:r}=s;e(ie({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),r=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},He=m(ke)`
38
+ width: ${d.sp4};
39
+ height: ${d.sp4};
40
+ margin-bottom: ${d.sp3};
41
+ margin-top: ${d.sp3};
42
+ margin-left: ${d.sp8};
43
43
  cursor: pointer;
44
44
  position: absolute;
45
45
  color: ${e=>e.theme.colors.brandColorJade};
46
- `,Me=m.div`
46
+ `,Je=m.div`
47
47
  display: flex;
48
48
  height: 100vh;
49
49
  flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
50
  width: 100vw;
51
51
  overflow-y: scroll;
52
52
  background-color: ${e=>e.theme.colors.grey4};
53
- `,He=m.div`
53
+ `,Me=m.div`
54
54
  display: flex;
55
55
  flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
56
  flex-direction: column;
57
57
  width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
58
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
- padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
59
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
60
+ padding-top: ${e=>e.windowSize!=="small"?d.sp2:"0px"};
61
61
  `,Ve=m.div`
62
62
  display: flex;
63
63
  flex-direction: column;
64
64
  align-items: center;
65
65
  justify-content: center;
66
- padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
66
+ padding: ${e=>e.windowSize==="small"?d.sp3:`62px ${d.sp6} ${d.sp9} ${d.sp8}`};
67
67
  height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
68
  overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
69
  width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
70
  background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
71
  margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),M=n.pathname.includes("address"),w=x(),H=xe(),A=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:N,sessionId:L}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[b,c,i,o,d,a]),I.useEffect((()=>{b&&c==="Completed"&&($(N,L,z),l!=null&&a(re(l)))}),[c,b,N,L,z,l,a]),c==="Error"?t.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,R))(u)}),t.jsxs(Me,{windowSize:w,children:[w!=="small"?t.jsx(Je,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(He,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
72
+ `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),r=s.get("token"),J=n.pathname.includes("address"),w=x(),M=xe(),A=fe(),b=we(),V=()=>{M.toggle()},_=L((u=>k(u))),K=L((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:X}=_,{tenantId:z,userId:E,sessionId:N}=W,{fetchState:R,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&r!=null&&a(le(i,o,r))}),[b,c,i,o,r,a]),I.useEffect((()=>{b&&c==="Completed"&&($(E,N,z),l!=null&&a(de(l)))}),[c,b,E,N,z,l,a]),c==="Error"?t.jsx(f,{}):R==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${d.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,X))(u)}),t.jsxs(Je,{windowSize:w,children:[w!=="small"?t.jsx(He,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:J,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(Me,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function rt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Le,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{rt as default};
@@ -0,0 +1,12 @@
1
+ import{j as u}from"./liveblocks-2F3ER8H4.js";import{a as g}from"./sentry-Dwi3Xpu2.js";import{u as O,g as _,h as w,t as A,j as l,N as L}from"./core-BmXpopk3.js";import{z as r,E as M,G as P,T as V,m as N,U as W,_ as B,a0 as G,W as R}from"./index-BH7Z90Ry.js";import{fF as $,U7 as q,UA as H,Ur as J,gi as K,gk as Q,Uw as X,gU as Y,dj as Z,UB as ee,UC as te}from"./zeni-epic-state-DtY6MD5C.js";import{n as ne}from"./mui-DpZKsKJ-.js";import{u as se}from"./useDeviceId-Dklpg4lb.js";import{f as ie}from"./analyticsHelper-DIAaX2E9.js";import{t as ae}from"./getLocaleForTenant-CLcFXXBi.js";import"./recharts-lgPPofcu.js";import"./analytics-CVpLIXYS.js";import"./plaid-B0sfsJHV.js";import"./dnd-CFbFq_On.js";import"./stripe-cKAAJElX.js";import"./lottie-Do5BYuHO.js";import"./lexical-CUqOWG_f.js";import"./pdf-CaVqV5T4.js";import"./utils-DAgs23EZ.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]="1e75b918-141e-4492-93c3-36493735fee5",t._sentryDebugIdIdentifier="sentry-dbid-1e75b918-141e-4492-93c3-36493735fee5")}catch{}})();const T=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function Te(){const t=O(),i=_(),f=w(),[y]=A(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),a=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)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>$(e))),k=l((e=>q(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&a!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(H(n,a,m)))}),[n,p,t,a,m,s?.zeniSessionId]),g.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(J(k.tenantsInOrder),s.zeniSessionId),K(s.userId,s.zeniSessionId,o.tenantId),t(Q(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),P.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=R();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(W.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,i.state,t]);const E=g.useCallback((()=>{f("/signin/auth")}),[f]),j=g.useCallback((()=>{a!=null&&d!=null&&c!=null&&t(ee(a,c,d))}),[a,d,t,c]),F=g.useCallback((e=>{a!=null&&n!=null&&c!=null&&d!=null&&t(te(e,a,c,d))}),[a,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(B,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=i.state?.origin??"/";return u.jsx(L,{to:e,state:{...i.state,origin:""}})}if(!T(n,p)||m==null||h==="Error"){const e=i.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||h==="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
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ z-index: 9999;
11
+ background-color: ${t=>t.theme.colors.background};
12
+ `;export{Te as default};