@zeniai/web-app-ui 5.3.73-qa → 5.3.74-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/assets/{AccountMappingScreen-BE1tvCY-.js → AccountMappingScreen-bgBnbWdy.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-JIrVAnYO.js → ActualMatchingMatchDetailScreen-CafaM5XY.js} +1 -1
  3. package/dist/assets/AddressRoutes-B0qCwALn.js +1 -0
  4. package/dist/assets/AddressScreen-DeduQWQ4.js +9 -0
  5. package/dist/assets/AiCfoScreen-B7J9RT9C.js +22 -0
  6. package/dist/assets/{AppDrawer-BtvyICbv.js → AppDrawer-BW6P-wV8.js} +2 -2
  7. package/dist/assets/{BillPayApprovalRoutes-BeNlUYtP.js → BillPayApprovalRoutes-D2bN_nnZ.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-NNo26FTU.js → BillPayRoutes-CgW1erGg.js} +18 -18
  9. package/dist/assets/BusinessVerificationPageScreen-DcKUi-lt.js +9 -0
  10. package/dist/assets/CardsAiCfoScreen-C1dyyMbI.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-Czud_dft.js → ChargeCardRoutes-BWzbRtxf.js} +6 -6
  12. package/dist/assets/{CompanyPassportScreen-CUrmIaoV.js → CompanyPassportScreen-xleu1jTV.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-B5EFa-_C.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-BrgGs5TS.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-nYzTX44l.js → CustomerOnboardingRoutes-B7MWRMYz.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-DhAARK1y.js → DashboardRoutes-h3cnLeE8.js} +3 -3
  17. package/dist/assets/{DefaultTenantHome-BnU9SlLP.js → DefaultTenantHome-B6pMA7H4.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-CXWbzXGO.js → DomesticWireDetailScreen-zZKn41az.js} +4 -4
  19. package/dist/assets/{DrawerScreen-KU4gAeGs.js → DrawerScreen-DMtHjlqA.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-D_ufO2eZ.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-CLNre9XZ.js → ExpenseAutomationRoutes-jgAFt30Z.js} +3 -3
  22. package/dist/assets/FeaturePreviewScreen-zypoS_dA.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-DbtL26-p.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-DNSMQBKV.js → InboxNotificationsProvider-CrlYLYr4.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-Cy4ZHmk0.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-DPv2J5Oz.js → MagicLinkRoutes-DzAI89ll.js} +8 -8
  27. package/dist/assets/MagicLinkSignInScreen-BgTist7Q.js +12 -0
  28. package/dist/assets/MobileAppDrawer-DqkcDASf.js +1 -0
  29. package/dist/assets/NotFoundScreen-CNN7HdXS.js +1 -0
  30. package/dist/assets/NotificationRoutes-C2jjWnl-.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-BPAw8v-M.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-CBKGWsoX.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-eihuemvD.js → PaymentLinkScreen-B6TgBvUT.js} +1 -1
  34. package/dist/assets/PeopleRoutes-DypFbuli.js +22 -0
  35. package/dist/assets/PerformanceRoutes-C2kXP11r.js +1 -0
  36. package/dist/assets/{Preview-Csnu6hhv.js → Preview-B36YgZlJ.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-D1I_iW5h.js → QBOConnectionScreen--H698GzB.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-D4ojMFTf.js +1 -0
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BIyPBmgD.js → ReimbursementApprovalRuleDetailScreen-DegiBelw.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-LP6xm98z.js → ReimbursementRoutes-Yr2nE-d0.js} +7 -7
  41. package/dist/assets/{ReportsRoutes-DITYNMuX.js → ReportsRoutes-DjFQNpll.js} +1 -1
  42. package/dist/assets/RewardsRoutes-Dtxx5k0B.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BcgBt7ic.js → ScheduleDetailsPrepaidExpensesScreen-BRIu0n7K.js} +5 -5
  44. package/dist/assets/ScreenRoutes-kKJ3YpZH.js +2 -0
  45. package/dist/assets/{SettingsRoutes-Da6bbYYR.js → SettingsRoutes-BZmYgJtK.js} +6 -6
  46. package/dist/assets/SetupPagesScreen-lPaGXTgS.js +29 -0
  47. package/dist/assets/SignInScreen-DTadPYrT.js +1 -0
  48. package/dist/assets/SignOutScreen-BHkTJ-yD.js +9 -0
  49. package/dist/assets/TaskListScreen-D3GsptEL.js +9 -0
  50. package/dist/assets/TaskRoutes-fGbGk9KK.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-ViQ3OgVr.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-bF7tC5BL.js → TransactionDetailScreen-Be7gHGgU.js} +2 -2
  53. package/dist/assets/TransactionListRoutes-CDGe1Ogo.js +1 -0
  54. package/dist/assets/{TreasuryRoutes-ZY5ec2rr.js → TreasuryRoutes-Dbi6qnAw.js} +6 -6
  55. package/dist/assets/{VendorsRoutes-g-bxxUNg.js → VendorsRoutes-DIJ1qy90.js} +13 -13
  56. package/dist/assets/WiseConfirmationScreen-CVfxBgou.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-p4oJntrm.js → ZeniAccountRoutes-RSARM6Ba.js} +11 -11
  58. package/dist/assets/{ZeniAccountStatementScreen-BLhbe-0Z.js → ZeniAccountStatementScreen-BfUClG3a.js} +2 -2
  59. package/dist/assets/{accountMappingHelper-B03ntuMF.js → accountMappingHelper-CBNvvMfn.js} +1 -1
  60. package/dist/assets/{analytics-BFbgqgMT.js → analytics-DYPKn651.js} +1 -1
  61. package/dist/assets/{analyticsHelper-CR4O3yZF.js → analyticsHelper-BvcLZ--H.js} +1 -1
  62. package/dist/assets/{core-BTxe1IJ4.js → core-CJWbgnFM.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-CLAUpL82.js → decodeURIComponentSafe-BCm_uqSw.js} +1 -1
  64. package/dist/assets/{dnd-CH048ZLo.js → dnd-hHoSpesG.js} +1 -1
  65. package/dist/assets/{empty-CAFZs_Ce.js → empty-CGblm06Y.js} +1 -1
  66. package/dist/assets/{empty-BlDbR96Q.js → empty-DUMrvwO9.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-C3V_Mh-h.js → emptyVideoElement-D2KJ78rZ.js} +1 -1
  68. package/dist/assets/epic-n7HybIEr.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-Bra4tyPR.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-AQFwGK3G.js → getLocaleForTenant-DDk9eOPJ.js} +1 -1
  71. package/dist/assets/{index-5MqCU60P.js → index-BWgG5UXp.js} +2 -2
  72. package/dist/assets/{index-9ZQLuzDm.js → index-BfkcPaMK.js} +1 -1
  73. package/dist/assets/{index-lUU_agnk.js → index-C8z0vmNu.js} +1 -1
  74. package/dist/assets/{index-Bk3SeEYR.js → index-CdkOnd47.js} +1 -1
  75. package/dist/assets/{index-BBiUi3gN.js → index-ColbwDzi.js} +1 -1
  76. package/dist/assets/{index-D-UPM8nK.js → index-D9-rtXik.js} +1 -1
  77. package/dist/assets/{index-t_YINWfi.js → index-DvSod3qd.js} +16657 -16580
  78. package/dist/assets/{index-JPLpjCnh.js → index-EziXfial.js} +1 -1
  79. package/dist/assets/{lexical-tyxOdseK.js → lexical-CAwA0n9Q.js} +1 -1
  80. package/dist/assets/{liveblocks-BOLtmXrt.js → liveblocks-Du6nrW5U.js} +1 -1
  81. package/dist/assets/{lottie-DLo-RGW2.js → lottie-BBf_aMXD.js} +1 -1
  82. package/dist/assets/{mui-CoXsq-BK.js → mui-dbvYX-CF.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bch85fkl.js → pathToGoBack-CI7vJZ39.js} +1 -1
  84. package/dist/assets/{pdf-DVvA7lFh.js → pdf-C7M7XqWN.js} +3 -3
  85. package/dist/assets/{pdf-lib-CTa71n8-.js → pdf-lib-ArqLJwp-.js} +1 -1
  86. package/dist/assets/{plaid-aFRwvwGe.js → plaid-BrZReSCz.js} +1 -1
  87. package/dist/assets/{pusher-kon0XfSK.js → pusher-B8VDNFKS.js} +1 -1
  88. package/dist/assets/{react-BukI8JJo.js → react-B8eW8M54.js} +1 -1
  89. package/dist/assets/{react-CnAe8nlJ.js → react-C7HcxS4Y.js} +1 -1
  90. package/dist/assets/{react-CuayOuaV.js → react-CmsG3ktk.js} +1 -1
  91. package/dist/assets/{react-CgA-IPTs.js → react-DCRvz-4Y.js} +1 -1
  92. package/dist/assets/{react-Bugty8Ja.js → react-Rk6uPjYN.js} +1 -1
  93. package/dist/assets/{react-BlW33xsQ.js → react-rIttatCG.js} +1 -1
  94. package/dist/assets/{recharts-4iB4lKv8.js → recharts-qq-VgjqX.js} +1 -1
  95. package/dist/assets/{routePaths-ByVgDZC2.js → routePaths-5zdijNTw.js} +1 -1
  96. package/dist/assets/{sentry-CXDuPEuw.js → sentry-DlU3V0QD.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Ph0joKsY.js → stripSplatSuffix-D3txeaXa.js} +1 -1
  98. package/dist/assets/{url-gwgPp82g.js → url-BjQv6zlz.js} +1 -1
  99. package/dist/assets/{url-b7gVrWYV.js → url-U6gN5rx7.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-DYWJx87C.js +1 -0
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BAsCzUuV.js → useAiCfoDashboardSuggestedQuestionsChips-CQIzuErz.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-DDS1YL8l.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-Babpz4Cl.js → useChargeCardPusherEvents-BEZEnt6s.js} +1 -1
  104. package/dist/assets/{useDeviceId-Bb0qVsLr.js → useDeviceId-CDXz5n2o.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DYtoHOCU.js +1 -0
  106. package/dist/assets/{useInitialThreadRequest-AuBsHZ1k.js → useInitialThreadRequest-CWExIS9V.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-OslA3wOO.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-Ct21DG4i.js → useTaskManagerPusherEvents-D9C1zIb_.js} +1 -1
  109. package/dist/assets/{utils-Dq3SJj6J.js → utils-C-x5CNgO.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-DxjwZ9FM.js → withTransactionSidePanel-bpiv3Wfp.js} +4 -4
  111. package/dist/assets/{zeni-epic-state-EEoBiaeS.js → zeni-epic-state-DUCBgtEU.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -46
  114. package/dist/assets/AddressRoutes-D9zk0sYw.js +0 -1
  115. package/dist/assets/AddressScreen-DX07-zau.js +0 -9
  116. package/dist/assets/AiCfoScreen-tIUREuwh.js +0 -22
  117. package/dist/assets/BusinessVerificationPageScreen-DUnn3sZ3.js +0 -9
  118. package/dist/assets/CardsAiCfoScreen-DgW1pdhN.js +0 -14
  119. package/dist/assets/ConnectionAuthScreen-DBBWNSFG.js +0 -11
  120. package/dist/assets/CustomerOnboardingAuthScreen-BkD1xkwc.js +0 -1
  121. package/dist/assets/EntityDetailRoutes-D_N1d5ZQ.js +0 -1
  122. package/dist/assets/FeaturePreviewScreen-CSQdoVFf.js +0 -1
  123. package/dist/assets/HubSpotOAuthCallbackScreen-CdA2Kn-0.js +0 -1
  124. package/dist/assets/InvoicingRoutes-BHf-XoEl.js +0 -2
  125. package/dist/assets/MagicLinkSignInScreen-DSrgS8kC.js +0 -12
  126. package/dist/assets/MobileAppDrawer-5FBCjy6b.js +0 -1
  127. package/dist/assets/NotFoundScreen-CT9mXoPL.js +0 -1
  128. package/dist/assets/NotificationRoutes-qO4Y_dYL.js +0 -1
  129. package/dist/assets/OAuthConsentScreen-SaWEQNl9.js +0 -1
  130. package/dist/assets/PandLWithForecastRoutes-By9t5qFG.js +0 -1
  131. package/dist/assets/PeopleRoutes-Dqp41TZY.js +0 -22
  132. package/dist/assets/PerformanceRoutes-C-s_fkZE.js +0 -1
  133. package/dist/assets/ReimbursementApprovalRoutes-D09rn5qB.js +0 -1
  134. package/dist/assets/RewardsRoutes-B40r6YTa.js +0 -1
  135. package/dist/assets/ScreenRoutes-D1Kn71pi.js +0 -2
  136. package/dist/assets/SetupPagesScreen-BEg9WOWC.js +0 -29
  137. package/dist/assets/SignInScreen-CGyR8HV0.js +0 -1
  138. package/dist/assets/SignOutScreen-rgwnFp37.js +0 -9
  139. package/dist/assets/TaskListScreen-BSIpi4t5.js +0 -9
  140. package/dist/assets/TaskRoutes-C4ENdbyX.js +0 -9
  141. package/dist/assets/TransactionDetailRoutes-CpfJculb.js +0 -1
  142. package/dist/assets/TransactionListRoutes-C_ZQyWLJ.js +0 -1
  143. package/dist/assets/WiseConfirmationScreen-Hu2tm7rB.js +0 -12
  144. package/dist/assets/epic-Cs9GTJNL.js +0 -2
  145. package/dist/assets/expenseAutomationHelper-DayJ0nIv.js +0 -1
  146. package/dist/assets/useActualMatchingMatchDetail-wQ6Oyy0y.js +0 -1
  147. package/dist/assets/useAskAiCfoHostNavButtonProps-CGeN7NSS.js +0 -1
  148. package/dist/assets/useEmailConnectResultRefresh-EO4XFjwp.js +0 -1
  149. package/dist/assets/useTaskManagerAccess-21llCh7a.js +0 -1
package/dist/index.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html lang="en"><head><meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"><meta http-equiv="expires" content="0"><meta http-equiv="pragma" content="no-cache"><meta charset="UTF-8"><link rel="icon" type="image/svg+xml" href="/assets/favicon-D56XvgAH.ico"><meta name="ROBOTS" content="NOINDEX, NOFOLLOW"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"><meta name="theme-color" content="#000000"><meta name="description" content="Zeni - Modern Finance Team For Startups"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&family=Manrope:wght@200..800&display=swap"><link rel="apple-touch-icon" href="/assets/logo192-CqcTe-t4.png"><link rel="manifest" href="/assets/manifest-icT4lOF5.json"><title>Zeni - Modern Finance Team For Startups</title><script src="/theme-detect.js"></script><style>:root{--logo-color-from:#D4DCDD;--logo-color-to:#E9F0F0;--bar-color-from:#E9F0F0;--bar-color-to:#D4DCDD;--sidebar-bg:#F3F7F7;--main-bg:#FAFCFC;--divider-color:#D4DCDD}html{background-color:#f3f7f7}html[data-theme=dark]{background-color:#1b1c1c;--logo-color-from:#545B5C;--logo-color-to:#3E4343;--bar-color-from:#3E4343;--bar-color-to:#545B5C;--sidebar-bg:#1B1C1C;--main-bg:#202222;--divider-color:#545B5C}.app-shell-loader{position:fixed;inset:0;display:flex;background-color:var(--sidebar-bg);z-index:9999}.app-shell-sidebar{width:210px;flex-shrink:0;background-color:var(--sidebar-bg);padding:16px 16px 0;display:flex;flex-direction:column;gap:36px;border-right:1px solid var(--divider-color);box-sizing:border-box}.app-shell-sidebar-group{display:flex;flex-direction:column;gap:10px}.app-shell-bar{height:10px;border-radius:5px;background-color:var(--bar-color-from);animation:app-shell-bar-shimmer 1.6s linear infinite}.app-shell-navbar{height:56px;display:flex;flex-direction:row;border-bottom:1px solid var(--divider-color);padding:0 32px;align-items:center;justify-content:space-between;box-sizing:border-box}@keyframes app-shell-bar-shimmer{0%,100%{background-color:var(--bar-color-from)}50%{background-color:var(--bar-color-to)}}.app-shell-main{flex:1;background-color:var(--main-bg)}.app-shell-logo{display:inline-flex;width:100%;height:calc(100vh - 56px);justify-content:center;align-items:center}.app-shell-logo svg path{animation:app-shell-color-cycle 1.6s linear infinite}@keyframes app-shell-color-cycle{0%,100%{fill:var(--logo-color-from)}50%{fill:var(--logo-color-to)}}@media (max-width:899px){.app-shell-sidebar{display:none}.app-shell-main{background-color:var(--sidebar-bg)}}</style><noscript><style>.app-shell-loader{display:none}</style></noscript><script async type="module" crossorigin src="/assets/index-t_YINWfi.js"></script><link rel="modulepreload" crossorigin href="/assets/sentry-CXDuPEuw.js"><link rel="modulepreload" crossorigin href="/assets/core-BTxe1IJ4.js"><link rel="modulepreload" crossorigin href="/assets/zeni-epic-state-EEoBiaeS.js"><link rel="modulepreload" crossorigin href="/assets/mui-CoXsq-BK.js"><link rel="modulepreload" crossorigin href="/assets/analytics-BFbgqgMT.js"><link rel="modulepreload" crossorigin href="/assets/utils-Dq3SJj6J.js"><link rel="stylesheet" crossorigin href="/assets/index-BhC2LNQw.css"></head><body style="margin:0"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div class="app-shell-loader" id="app-shell-loader"><div class="app-shell-sidebar"><div class="app-shell-sidebar-group"><div class="app-shell-bar zeni-logo" style="width:96px;height:20px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:78px;height:16px"></div><div class="app-shell-bar" style="width:46px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:110px;height:16px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div><div class="app-shell-bar" style="width:64px;height:16px"></div></div></div><div class="app-shell-main"><div class="app-shell-navbar"><div class="app-shell-bar" style="width:106px;height:27px"></div><div class="app-shell-bar" style="width:111px;height:32px"></div></div><div class="app-shell-logo"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.768 0.0270284C16.571 -0.055168 16.348 0.0572476 16.2913 0.267574C16.2713 0.342517 16.2489 0.417461 16.2253 0.491196C16.0094 1.15723 15.6459 1.76645 15.148 2.27776C14.3056 3.14203 13.1847 3.61949 11.9918 3.6207H11.9883C10.7978 3.6207 9.67689 3.14565 8.83445 2.2838C8.33653 1.7737 7.97077 1.16448 7.75367 0.499657C7.73007 0.425922 7.70765 0.350979 7.68641 0.276035C7.62978 0.065709 7.40678 -0.0454978 7.20974 0.0366985C6.05463 0.522624 4.98565 1.17899 4.0323 1.97436C3.91195 2.07468 3.87301 2.24512 3.93083 2.39259C3.9792 2.51589 4.03112 2.63797 4.08539 2.75764C4.51133 3.70894 5.10364 4.5853 5.84815 5.34682C7.48937 7.0246 9.66863 7.9493 11.9871 7.9493H11.9954C14.3162 7.94689 16.4978 7.01855 18.1379 5.33595C18.8812 4.57321 19.4711 3.69564 19.8959 2.74434C19.9502 2.62347 20.0009 2.50138 20.0493 2.37809C20.1071 2.23062 20.0682 2.06018 19.9478 1.95985C18.9933 1.16569 17.9231 0.511745 16.768 0.0270284Z"/><path d="M19.9102 21.2422C19.4843 20.2933 18.8931 19.4194 18.151 18.6603C16.5086 16.9801 14.3223 16.053 12.0038 16.0578C8.50304 16.0614 5.48371 18.1961 4.11031 21.2603C4.05722 21.38 4.0053 21.5009 3.95575 21.623C3.89675 21.7704 3.93569 21.9421 4.05722 22.0436C5.01175 22.8366 6.08073 23.4893 7.23466 23.9728C7.4317 24.055 7.65352 23.9438 7.71134 23.7335C7.73139 23.6573 7.75381 23.5836 7.77859 23.5086C8.37207 21.6979 10.0416 20.3888 12.0073 20.3864H12.012C13.2025 20.3864 14.3234 20.8614 15.1659 21.7233C15.6626 22.231 16.026 22.8378 16.2431 23.5002C16.2679 23.5739 16.2903 23.6489 16.3104 23.7238C16.3682 23.9341 16.59 24.0453 16.787 23.9619C17.9422 23.476 19.01 22.8209 19.9633 22.0255C20.0837 21.9252 20.1226 21.7535 20.0648 21.606C20.0164 21.4828 19.9645 21.3631 19.9102 21.2422Z"/><path d="M0.132148 10.1666C0.158105 9.98769 0.305591 9.85352 0.482575 9.85352L23.5093 9.81726C23.6863 9.81726 23.8338 9.95022 23.8609 10.1291C23.9518 10.7347 23.999 11.3548 23.999 11.9858C24.0001 12.6131 23.9541 13.2284 23.8668 13.8292C23.8408 14.0081 23.6934 14.1422 23.5164 14.1422L0.489654 14.1773C0.312671 14.1773 0.165185 14.0443 0.138047 13.8654C0.0471956 13.2598 0 12.6397 0 12.0088C0 11.3826 0.0448358 10.7673 0.132148 10.1666Z"/></svg></div></div></div></body></html>
1
+ <!DOCTYPE html><html lang="en"><head><meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"><meta http-equiv="expires" content="0"><meta http-equiv="pragma" content="no-cache"><meta charset="UTF-8"><link rel="icon" type="image/svg+xml" href="/assets/favicon-D56XvgAH.ico"><meta name="ROBOTS" content="NOINDEX, NOFOLLOW"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"><meta name="theme-color" content="#000000"><meta name="description" content="Zeni - Modern Finance Team For Startups"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&family=Manrope:wght@200..800&display=swap"><link rel="apple-touch-icon" href="/assets/logo192-CqcTe-t4.png"><link rel="manifest" href="/assets/manifest-icT4lOF5.json"><title>Zeni - Modern Finance Team For Startups</title><script src="/theme-detect.js"></script><style>:root{--logo-color-from:#D4DCDD;--logo-color-to:#E9F0F0;--bar-color-from:#E9F0F0;--bar-color-to:#D4DCDD;--sidebar-bg:#F3F7F7;--main-bg:#FAFCFC;--divider-color:#D4DCDD}html{background-color:#f3f7f7}html[data-theme=dark]{background-color:#1b1c1c;--logo-color-from:#545B5C;--logo-color-to:#3E4343;--bar-color-from:#3E4343;--bar-color-to:#545B5C;--sidebar-bg:#1B1C1C;--main-bg:#202222;--divider-color:#545B5C}.app-shell-loader{position:fixed;inset:0;display:flex;background-color:var(--sidebar-bg);z-index:9999}.app-shell-sidebar{width:210px;flex-shrink:0;background-color:var(--sidebar-bg);padding:16px 16px 0;display:flex;flex-direction:column;gap:36px;border-right:1px solid var(--divider-color);box-sizing:border-box}.app-shell-sidebar-group{display:flex;flex-direction:column;gap:10px}.app-shell-bar{height:10px;border-radius:5px;background-color:var(--bar-color-from);animation:app-shell-bar-shimmer 1.6s linear infinite}.app-shell-navbar{height:56px;display:flex;flex-direction:row;border-bottom:1px solid var(--divider-color);padding:0 32px;align-items:center;justify-content:space-between;box-sizing:border-box}@keyframes app-shell-bar-shimmer{0%,100%{background-color:var(--bar-color-from)}50%{background-color:var(--bar-color-to)}}.app-shell-main{flex:1;background-color:var(--main-bg)}.app-shell-logo{display:inline-flex;width:100%;height:calc(100vh - 56px);justify-content:center;align-items:center}.app-shell-logo svg path{animation:app-shell-color-cycle 1.6s linear infinite}@keyframes app-shell-color-cycle{0%,100%{fill:var(--logo-color-from)}50%{fill:var(--logo-color-to)}}@media (max-width:899px){.app-shell-sidebar{display:none}.app-shell-main{background-color:var(--sidebar-bg)}}</style><noscript><style>.app-shell-loader{display:none}</style></noscript><script async type="module" crossorigin src="/assets/index-DvSod3qd.js"></script><link rel="modulepreload" crossorigin href="/assets/sentry-DlU3V0QD.js"><link rel="modulepreload" crossorigin href="/assets/core-CJWbgnFM.js"><link rel="modulepreload" crossorigin href="/assets/zeni-epic-state-DUCBgtEU.js"><link rel="modulepreload" crossorigin href="/assets/mui-dbvYX-CF.js"><link rel="modulepreload" crossorigin href="/assets/analytics-DYPKn651.js"><link rel="modulepreload" crossorigin href="/assets/utils-C-x5CNgO.js"><link rel="stylesheet" crossorigin href="/assets/index-BhC2LNQw.css"></head><body style="margin:0"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div class="app-shell-loader" id="app-shell-loader"><div class="app-shell-sidebar"><div class="app-shell-sidebar-group"><div class="app-shell-bar zeni-logo" style="width:96px;height:20px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:78px;height:16px"></div><div class="app-shell-bar" style="width:46px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:110px;height:16px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div><div class="app-shell-bar" style="width:64px;height:16px"></div></div></div><div class="app-shell-main"><div class="app-shell-navbar"><div class="app-shell-bar" style="width:106px;height:27px"></div><div class="app-shell-bar" style="width:111px;height:32px"></div></div><div class="app-shell-logo"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.768 0.0270284C16.571 -0.055168 16.348 0.0572476 16.2913 0.267574C16.2713 0.342517 16.2489 0.417461 16.2253 0.491196C16.0094 1.15723 15.6459 1.76645 15.148 2.27776C14.3056 3.14203 13.1847 3.61949 11.9918 3.6207H11.9883C10.7978 3.6207 9.67689 3.14565 8.83445 2.2838C8.33653 1.7737 7.97077 1.16448 7.75367 0.499657C7.73007 0.425922 7.70765 0.350979 7.68641 0.276035C7.62978 0.065709 7.40678 -0.0454978 7.20974 0.0366985C6.05463 0.522624 4.98565 1.17899 4.0323 1.97436C3.91195 2.07468 3.87301 2.24512 3.93083 2.39259C3.9792 2.51589 4.03112 2.63797 4.08539 2.75764C4.51133 3.70894 5.10364 4.5853 5.84815 5.34682C7.48937 7.0246 9.66863 7.9493 11.9871 7.9493H11.9954C14.3162 7.94689 16.4978 7.01855 18.1379 5.33595C18.8812 4.57321 19.4711 3.69564 19.8959 2.74434C19.9502 2.62347 20.0009 2.50138 20.0493 2.37809C20.1071 2.23062 20.0682 2.06018 19.9478 1.95985C18.9933 1.16569 17.9231 0.511745 16.768 0.0270284Z"/><path d="M19.9102 21.2422C19.4843 20.2933 18.8931 19.4194 18.151 18.6603C16.5086 16.9801 14.3223 16.053 12.0038 16.0578C8.50304 16.0614 5.48371 18.1961 4.11031 21.2603C4.05722 21.38 4.0053 21.5009 3.95575 21.623C3.89675 21.7704 3.93569 21.9421 4.05722 22.0436C5.01175 22.8366 6.08073 23.4893 7.23466 23.9728C7.4317 24.055 7.65352 23.9438 7.71134 23.7335C7.73139 23.6573 7.75381 23.5836 7.77859 23.5086C8.37207 21.6979 10.0416 20.3888 12.0073 20.3864H12.012C13.2025 20.3864 14.3234 20.8614 15.1659 21.7233C15.6626 22.231 16.026 22.8378 16.2431 23.5002C16.2679 23.5739 16.2903 23.6489 16.3104 23.7238C16.3682 23.9341 16.59 24.0453 16.787 23.9619C17.9422 23.476 19.01 22.8209 19.9633 22.0255C20.0837 21.9252 20.1226 21.7535 20.0648 21.606C20.0164 21.4828 19.9645 21.3631 19.9102 21.2422Z"/><path d="M0.132148 10.1666C0.158105 9.98769 0.305591 9.85352 0.482575 9.85352L23.5093 9.81726C23.6863 9.81726 23.8338 9.95022 23.8609 10.1291C23.9518 10.7347 23.999 11.3548 23.999 11.9858C24.0001 12.6131 23.9541 13.2284 23.8668 13.8292C23.8408 14.0081 23.6934 14.1422 23.5164 14.1422L0.489654 14.1773C0.312671 14.1773 0.165185 14.0443 0.138047 13.8654C0.0471956 13.2598 0 12.6397 0 12.0088C0 11.3826 0.0448358 10.7673 0.132148 10.1666Z"/></svg></div></div></div></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/web-app-ui",
3
- "version": "5.3.73-qa",
3
+ "version": "5.3.74-dev",
4
4
  "files": [
5
5
  "dist/**/*"
6
6
  ],
@@ -28,9 +28,9 @@
28
28
  "@sentry/core": "^9.42.1",
29
29
  "@sentry/react": "^9.42.1",
30
30
  "@stripe/stripe-js": "^4.4.0",
31
- "@zeniai/client-analytics": "2.0.98",
32
- "@zeniai/client-epic-state": "5.2.73",
33
- "@zeniai/web-components": "4.4.12",
31
+ "@zeniai/client-analytics": "2.0.99",
32
+ "@zeniai/client-epic-state": "5.2.74",
33
+ "@zeniai/web-components": "4.4.13",
34
34
  "color": "3.1.3",
35
35
  "crypto-js": "4.2.0",
36
36
  "dnd-core": "^16.0.1",
@@ -62,48 +62,6 @@
62
62
  "vite-plugin-minify": "^2.1.0",
63
63
  "web-vitals": "^3.5.0"
64
64
  },
65
- "devDependencies": {
66
- "@eslint/js": "^9.39.2",
67
- "@juggle/resize-observer": "^3.4.0",
68
- "@liveblocks/client": "^3.22.0",
69
- "@originjs/vite-plugin-commonjs": "^1.0.3",
70
- "@rollup/plugin-terser": "^0.4.4",
71
- "@sentry/vite-plugin": "^2.21.2",
72
- "@testing-library/react": "^16.3.2",
73
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
74
- "@types/color": "3.0.2",
75
- "@types/crypto-js": "^4.1.0",
76
- "@types/lodash-es": "^4.17.12",
77
- "@types/node": "^20.19.0",
78
- "@types/react": "^18.3.11",
79
- "@types/react-dom": "^18.3.1",
80
- "@types/react-redux": "^7.1.24",
81
- "@types/react-window": "1.8.8",
82
- "@types/url-parse": "^1.4.11",
83
- "@typescript-eslint/eslint-plugin": "^8.26.0",
84
- "@typescript-eslint/parser": "^8.26.0",
85
- "@vitejs/plugin-react-swc": "^4.2.0",
86
- "dotenv": "^16.6.1",
87
- "eslint": "^9.39.2",
88
- "eslint-config-prettier": "^10.0.2",
89
- "eslint-plugin-perfectionist": "^4.15.0",
90
- "eslint-plugin-react": "^7.37.4",
91
- "globals": "^16.0.0",
92
- "husky": "^9.0.11",
93
- "jsdom": "^29.1.1",
94
- "knip": "^6.21.0",
95
- "madge": "^8.0.0",
96
- "prettier": "^3.5.3",
97
- "qs": "^6.16.0",
98
- "rollup-plugin-visualizer": "^5.12.0",
99
- "semver": "^7.5.2",
100
- "typescript": "^5.7.3",
101
- "vite": "^7.1.12",
102
- "vite-plugin-node-polyfills": "^0.24.0",
103
- "vite-plugin-svgr": "^4.5.0",
104
- "vite-tsconfig-paths": "^5.1.4",
105
- "vitest": "^4.1.11"
106
- },
107
65
  "keywords": [
108
66
  "zeni web app ui"
109
67
  ],
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BOLtmXrt.js";import{A as i}from"./AddressScreen-DX07-zau.js";import s from"./NotFoundScreen-CT9mXoPL.js";import"./sentry-CXDuPEuw.js";import{n as d,o as r}from"./core-BTxe1IJ4.js";import"./zeni-epic-state-EEoBiaeS.js";import"./recharts-4iB4lKv8.js";import"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="81cbb5c1-1b56-4d87-a240-ae6c03b91825",t._sentryDebugIdIdentifier="sentry-dbid-81cbb5c1-1b56-4d87-a240-ae6c03b91825")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
@@ -1,9 +0,0 @@
1
- import{j as n}from"./liveblocks-BOLtmXrt.js";import{a as S}from"./sentry-CXDuPEuw.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-BTxe1IJ4.js";import{a1 as $,E as D,z as K,O as L,a7 as V,a8 as z,k as C,S as b,a3 as F,Y as h,a4 as N}from"./index-t_YINWfi.js";import{Vv as _,is as O,fI as R,Vw as U,c9 as G,Vx as q,mK as H}from"./zeni-epic-state-EEoBiaeS.js";import{n as Y}from"./mui-CoXsq-BK.js";import J from"./NotFoundScreen-CT9mXoPL.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b34eddd1-ff59-4720-8b2c-b6f18d0bfc75",e._sentryDebugIdIdentifier="sentry-dbid-b34eddd1-ff59-4720-8b2c-b6f18d0bfc75")}catch{}})();const Q=Y.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `,W=M((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=R(e),a=s.roleMap!=null&&U(s.roleMap),d=i||c==="user_address"||G(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=q(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=_(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:h.googleMapsAPIKey,isDisabled:d}}),(function(e,s){const{navigate:o,location:i,addressType:c}=s,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,r=N(d?.pathnameStackToGoBack);let t=r.poppedPathname??v();const u=d?.queryParams;if(u){const f=new URLSearchParams(u).toString();f&&(t=`${t}?${f}`)}o(t,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:a=>{const d=X(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(b.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(s.bankAccountContext)},onCancel:()=>{l(s.bankAccountContext)}}}))(F);function ne({isSubPage:e,hideAddressSubTitle:s=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=T(),d=P(),r=j(),{addressId:t,addressType:u}=E(),f=$(),k=D(),w=K.getSignedInUser(),[g,I]=S.useState(t==null),p=B((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=L();if(w==null)throw Error("Can't access address page without signing in...");const A=m=>m.trackPageLoaded(t!=null?b.Event.editAddress:b.Event.addAddress),y=l??u;return S.useEffect((()=>{g||t==null||(I(!0),d(O(t,!1)))}),[g,t,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address|invoicing_customer_billing_address|invoicing_subscription_shipping_address|invoicing_business_address)$/g)?!g&&p==="Not-Started"||g&&p==="In-Progress"?n.jsx(V,{fetchState:p,style:{backgroundColor:k.colors.grey5}}):t!=null&&p==="Error"?(a(`${v(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(z,{analytics:C,onLoad:A}),n.jsx(Q,{windowSize:f,children:n.jsx(W,{location:r,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):n.jsx(J,{})}const v=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},X=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{ne as A,X as t};
@@ -1,22 +0,0 @@
1
- import{j as h}from"./liveblocks-BOLtmXrt.js";import{a as n}from"./sentry-CXDuPEuw.js";import{u as Qt,h as Ut,i as Lt,g as Bt,j as b,l as Ft}from"./core-BTxe1IJ4.js";import{a as Mt,v as $t,e6 as Vt,z as Nt,a1 as Ht,e7 as Gt,e8 as qt,e9 as zt,bp as Be,ea as We,eb as Wt,bo as Ye,a4 as ge,a8 as ce,k as M,ec as me,ed as Yt,ee as Jt,au as Xt,S as Kt,w as Zt,ef as es,eg as ts,av as ss,eh as ns,ei as as,ej as os,ek as is,p as rs,bk as Fe,el as ls}from"./index-t_YINWfi.js";import{fH as F,gw as R,Ud as us,a2q as ds,a2r as cs,jP as ms,a2s as Ss,jM as hs,a2t as Se,js as W,jV as Y,jy as Ie,jf as he,jd as ps,jX as fs,jH as Je,Um as Me,gy as $,gN as gs,Ul as Is,U6 as $e,fI as Cs,j6 as ks,a2u as bs,gb as vs,jo as Es,jk as Ps,fJ as pe,gi as ys,a2v as ws,a2w as xs,a2x as Rs,gx as Ts,gr as Ve,k7 as Ne,gt as He,gz as js,a2y as Ge,jY as Os,jh as As,jB as _s,jT as qe,jE as Ds,gA as Qs,gB as Us,gC as Ls,gD as Bs}from"./zeni-epic-state-EEoBiaeS.js";import{D as Fs,n as V,S as Ms,P as $s}from"./mui-CoXsq-BK.js";import{u as Vs}from"./useAiCfoDashboardSuggestedQuestionsChips-BAsCzUuV.js";import{p as Ns}from"./pathToGoBack-Bch85fkl.js";import{j as Hs}from"./routePaths-ByVgDZC2.js";import{u as Gs}from"./useTaskManagerPusherEvents-Ct21DG4i.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="7e5e8279-48c0-49ed-92b8-5a2bd89df533",s._sentryDebugIdIdentifier="sentry-dbid-7e5e8279-48c0-49ed-92b8-5a2bd89df533")}catch{}})();const qs=["claimed","running","succeeded","failed","timeout"],fe=s=>typeof s=="string"&&s!=="",Xe="chat-response-generated";function zs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=R(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Ws=Ft((function(s,r){const t=F(s),l=r.isSubmitting,c=t.uiState?.currentChatSessionId,i=c!=null?ys(s.aiCfoState,c):[],f=ts(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=ws(s),S=xs(s),A=Rs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ss}/tableDownload`,exportDownloadEndPoint:os(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(s).skills,skillSaveState:zs(s,A),skillsEnabled:R(s).skillsEnabled,skillsList:R(s).skills,skillsListError:R(s).fetchState==="Error",skillsListLoading:R(s).fetchState==="In-Progress",skillsCanPublish:R(s).canPublish,skillSaving:A.fetchState==="In-Progress",skillSaveError:A.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:S.macroId!=null&&S.version!=null?{macroId:S.macroId,version:S.version,instructions:S.instructions,error:S.fetchState==="Error",loading:S.fetchState==="In-Progress"}:void 0,skillDetail:Y(s).detail,skillDetailError:Y(s).fetchState==="Error",skillDetailLoading:Y(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:as(s),resolveSyntheticAnswerPolicyTile:ns(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:c,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:S,isCardPolicyEnabled:A,setIsAiCfoOpen:U}=r,T=l.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Xe&&typeof o.text=="string"&&typeof o.metadata=="object"){const m=o,E=Qs(m.type),v=m.metadata.chat_session_id??null,{currentChatSession:J,currentQuestionAnswer:j,currentQuestionAnswerSummary:X}=Ye(p,v);E!=="answer"?M.trackAICFOChatResponseGenerated(E,j?.question.questionText??"",m.text,v,ls(X,J),m.metadata.message_id??null):M.trackAICFOChatAnswerGenerated(m.text,j?.question.questionText??"",(m.follow_up_questions?.length??0)>0,!!m.assumptions,!!m.insights,m.visualization!=null,Us(m.visualization?.type??"")??null,v,m.summarized_title,m.metadata.message_id??null),s(Ls({chatSessionId:m.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Bs({chatSessionId:m.metadata.chat_session_id,answerPayload:m,userId:c}))}},onSubmit:(a,o,m,E,v)=>{a&&Fe(s,a,o,f,p,c,E,m,void 0,v)},onFetchSkills:()=>{s(Je())},onOpenSkill:a=>{s(Ie({macroId:a})),s(Ds({macroId:a}))},onSaveSkill:(a,o)=>{s(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",m=a.name?.trim()??"";s(qe({draft:{name:o.length>0?o:m,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{s(_s({macroId:a,version:o}))},onDeleteSkill:a=>{s(As({macroId:a}))},onSetSkillVisibility:(a,o)=>{s(Os({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{s(Ge())},onRunSkill:(a,o)=>{s($()),s(Ve()),Fe(s,o,"user_input",void 0,p,c,void 0,void 0,void 0,a),s(Ge())},updateCurrentInput:a=>{s(He(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{s(js(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??Ns(1);i(o,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),s(He(""))},togglePageView:()=>{const a=ge(t.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...We(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),U(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{f!=null&&o?.messageId!=null&&s(Ne(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s($()),f!=null&&s(Ve());const a=rs(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{s(Ts({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...is(s,{isAiCardCreationEnabled:S,isCardPolicyEnabled:A,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{U(!0),i(`/${T}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{U(!0),i(`/${T}/cards/policy`,{state:{...t.state}})}})}}))(Zt(es)),Cn=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Mt(),t=Qt(),l=Ut(),{session_id:c}=Lt(),i=Bt(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,S]=n.useState(!1),A=b((e=>F(e).uiState.isSkillsBrowserOpen===!0)),U=b((e=>R(e).skillsEnabled)),T=b((e=>F(e).uiState.isRoutinesBrowserOpen===!0)),a=b((e=>us(e))),o=b((e=>ds(e))),m=b((e=>cs(e))),[E,v]=n.useState(void 0),[J,j]=n.useState(!1),[X,Ce]=n.useState(void 0),Ke=n.useCallback((()=>{Ce(void 0),v(void 0),j(!0)}),[]),Ze=n.useCallback((e=>{v(e),j(!0)}),[]),et=n.useCallback((()=>{v(void 0),j(!1)}),[]),tt=n.useCallback((e=>{t(ms({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),j(!1)}),[t,E]),P=f,ke=a.routines.find((e=>e.scheduleId===P)),I=b((e=>Ss(e))),st=n.useCallback((e=>{t(hs({scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{t(P!=null?W({scheduleId:P}):Se())}),[t,P]);const B=ke?.macroId,nt=b((e=>Y(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&t(Ie({macroId:B}))}),[t,be,B]);const at=b((e=>F(e).uiState.currentChatSessionId))??c,C=a.routines.find((e=>e.scheduleId===f))??a.routines.find((e=>e.scheduleId===$t(at))),O=C?.scheduleId??null,[ve,ot]=n.useState(!0);n.useEffect((()=>{O!=null&&t(W({scheduleId:O}))}),[t,O]);const Ee=I.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{t(W({scheduleId:P})),t(he())}),5e3);return()=>window.clearInterval(e)}),[t,Ee,P]);const it=n.useCallback((e=>{Ce(e),v(void 0),j(!0)}),[]),rt=n.useCallback((e=>{t(ps({scheduleId:e.scheduleId}))}),[t]),lt=n.useCallback(((e,d)=>{t(fs({enabled:d,scheduleId:e.scheduleId}))}),[t]);n.useEffect((()=>{T&&t(he())}),[t,T]);const Pe=b((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),ut=n.useCallback((e=>{t(Ie({macroId:e}))}),[t]),Z=n.useCallback((()=>{t(Je()),t(Me())}),[t]),dt=n.useCallback((()=>{t($())}),[t]),{allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,onCardPolicyVendorSearchTextChange:ht}=Vt();n.useEffect((()=>{t(gs())}),[t]);const g=b((e=>F(e))),w=Nt.getSignedInUser();n.useEffect((()=>c==="routines"?(t($()),void t(Is())):c==="skills"?(t(Se()),t($e()),void t(Me())):(O==null&&t(Se()),t($e()),void t($()))),[t,O,f,c]);const pt=Ht(),_=Xt(pt),k=b((e=>Cs(e))),u=g.uiState.currentChatSessionId,y=k.tenantEmailDomain,L=y!=null&&y!=="",ee=n.useCallback((e=>{L&&l(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[L,l,y]),te=n.useCallback((()=>{L&&l(`/${y}/ai-cfo/routines`)}),[L,l,y]),se=n.useCallback(((e,d)=>{const D=e.sessionId??I.sessionId;D!=null&&L&&l(`/${y}/ai-cfo/${D}?routine=${encodeURIComponent(d)}`)}),[L,l,I.sessionId,y]),ft=n.useMemo((()=>C==null?void 0:{error:I.fetchState==="Error",kind:"routineRuns",loading:I.fetchState==="In-Progress"||I.fetchState==="Not-Started",routineName:C.name,schedule:Gt(C),skillName:C.isAdHoc===!0?void 0:K.find((e=>e.macroId===C.macroId))?.name,onOpenSkill:C.isAdHoc===!0?void 0:Z,runs:I.runs,tzName:C.tzName,unreadCount:C.unreadRuns,open:ve,onToggle:()=>ot((e=>!e)),onOpenRun:e=>se(e,C.scheduleId),onOpenRoutine:()=>ee(C),onOpenRoutines:te}),[Z,te,ee,se,ve,C,I.fetchState,I.runs,K]),{handleUploadPromoClose:gt,isUploadPromoVisible:It}=qt({isFileUploadEnabled:s,tenantEmailDomain:y}),ne=zt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:U,onCloseSkills:dt,onOpenSkills:Z}),{isSuggestedQuestionsLoading:Ct,suggestedPromptQuestions:kt}=Vs(),N=i.state,H=N?.aiCfoInitialQuestion,ye=!!N?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;S(!0);const d={...e};delete d[Be],l(i,{replace:!0,state:d})}),[i.pathname,i.search,i.state,l]);const[bt,ae]=n.useState(null),[vt,oe]=n.useState(!1),[Et,ie]=n.useState(void 0),[Pt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&H!=null&&H!==""){const e=i.state;ae(H),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const d=e?.aiCfoSuggestionIndex;re(typeof d=="number"?d:void 0),we.current=!0}}),[H,ye,i.state]);const yt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),l(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,l]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??N?.aiCfoRef,le=xe.get("emailRefId")??N?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(t(ks("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,t,w]);const G=g.uiState.lastContextMessage;n.useEffect((()=>{G!=null&&G!==""&&u!=null&&(ae(G),oe(!0),ie(void 0),re(void 0),t(bs()))}),[G,u,t]);const wt=k.masterTOSInfo,x=wt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Wt(u),q=g.fetchState,z=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,Oe=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:xt}=Ye(_e,u),Rt=xt.length===0;n.useEffect((()=>{x||_||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,l,i.state]);const Tt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),d=k.tenantEmailDomain;l(e.poppedPathname??(d!=null?`/${d}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),De=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=c!==De.current,d=u!==Qe.current;De.current=c,Qe.current=u,c!==u&&(!e||c==null||Hs(c)?d&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(vs({sessionId:c,agentId:"controller"})))}),[u,c]);const jt=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Xe}`)),eventCallback:(e,d,D)=>D.onEventReceived(e,d)})),[je]);n.useEffect((()=>{q!=="In-Progress"&&z&&t(Es())}),[q,z,t]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(c===u||q==="Completed"&&!z)&&t(Ps(u,w.userId))}),[Oe,q,Ae,z,u,w,c,t]);const ue=w?.userId,Ot=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),Ue=n.useCallback((e=>{const d=e!=null&&(e===P||e===O);(T||d)&&t(he()),d&&t(W({scheduleId:e}))}),[t,T,O,P]);Gs({events:Ot,onSubscribed:()=>Ue(P??O),onEvent:(e,d)=>{const D=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:qs.find((Dt=>Dt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(d);D!=null&&Ue(D.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||c==null)throw Error("Can't access AI Controller page without signing in...");const At=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return h.jsxs(Js,{children:[h.jsx(ce,{analytics:M,onLoad:Le}),ne.drawerElement,h.jsx(Xs,{children:h.jsx(ze,{children:h.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Tt,onCompleteClick:()=>{k.userRoleId!=null&&t(pe(k.userRoleId))}})})})]});const _t=h.jsxs(h.Fragment,{children:[p&&!x?h.jsx(ce,{analytics:M,onLoad:Le}):null,h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})]});return h.jsxs(h.Fragment,{children:[h.jsxs(Ys,{children:[h.jsx(ce,{analytics:M,onLoad:e=>e.trackPageLoaded(Kt.Event.aiCFOPage)}),_&&ne.drawerElement,h.jsx(Ws,{...jt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:ct,isAiCardCreationEnabled:mt,isCardPolicyEnabled:St,openOnboardingPage:()=>S(!0),userId:w.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:c,location:i,isSubmitting:At,isEmptyChatWithSession:Rt,currentTenant:k,emailLinkQuestion:bt??void 0,autoSubmitEmailLinkQuestion:vt,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Et,routedInitialQuestionSuggestionIndex:Pt,onCardPolicyVendorSearchTextChange:ht,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:It,onUploadPromoClose:gt,exploreSuggestedPromptQuestions:kt,exploreSuggestedPromptQuestionsLoading:Ct,isSkillsOpen:A,isRoutinesOpen:T,routineCanCreate:m,routineEditing:E,routineEditorOpen:J,routineListError:a.fetchState==="Error",routineListLoading:a.fetchState==="In-Progress",routineMaxRoutines:a.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:K,routines:a.routines,onRoutineCreate:Ke,onRoutineDelete:rt,routineHistoryError:I.fetchState==="Error",routineHistoryLoading:I.fetchState==="In-Progress",chatSidePanel:ft,routineDetail:ke,routineRunningScheduleId:o.runningScheduleId,routineRuns:I.runs,onRoutineEdit:Ze,onRoutineOpenRun:(e,d)=>se(d,e.scheduleId),onRoutineRun:st,onRoutineCloseDetail:te,onRoutineDraft:it,routineDraftPrompt:X,onRoutineOpenDetail:ee,onRoutineEditorCancel:et,onRoutineLoadSkillInstructions:ut,onRoutineSave:tt,onRoutineSetEnabled:lt,isCreateSkillEnabled:U,promoDismissalScope:y}),p&&_?h.jsx(Fs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ks,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:h.jsx(ze,{onClick:e=>e.stopPropagation(),children:h.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{x||k.userRoleId==null||t(pe(k.userRoleId)),S(!1)}})})}):null]}),p&&!_?h.jsx(Yt,{open:p,onClose:()=>S(!1),children:h.jsx(Jt,{children:_t})}):null]})},ze=V(Ms)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,Ys=V.div`
6
- height: 100vh;
7
- width: 100%;
8
- `,Js=V.div`
9
- height: 100vh;
10
- width: 100%;
11
- display: flex;
12
- flex-direction: column;
13
- min-height: 0;
14
- `,Xs=V.div`
15
- flex: 1;
16
- min-height: 0;
17
- display: flex;
18
- flex-direction: column;
19
- `,Ks=V($s)`
20
- box-shadow: ${({theme:s})=>s.colors.elevation2};
21
- color: ${({theme:s})=>s.colors.grey4};
22
- `;export{Cn as default};
@@ -1,9 +0,0 @@
1
- import{a as V}from"./sentry-CXDuPEuw.js";import{u as G,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-BTxe1IJ4.js";import{fI as z,HL as ce,Zh as ue,BK as de,Ss as pe,HZ as le,L9 as me,NY as fe,OC as ye,Pr as Se,Zi as ge,Zj as Ie,Zk as be,Zl as he,Zm as Te,Vw as De,Yn as Oe,VL as Ce,Md as ke,VM as Ve,Mh as we,mK as Ae,gJ as Ne,gI as Fe,gH as _e,v1 as ve,uU as xe,uR as Be,mC as Ee,BT as ze,BR as R,bF as L,C3 as P,cF as Re}from"./zeni-epic-state-EEoBiaeS.js";import{bT as Le,O as Pe,_ as Me,bi as Ue,z as E,a8 as je,k as M,o as x,S as B,bV as Ze,ae as Ge,p as U,aG as j}from"./index-t_YINWfi.js";import{n as He}from"./mui-CoXsq-BK.js";import{j as k}from"./liveblocks-BOLtmXrt.js";import{d as Z}from"./routePaths-ByVgDZC2.js";import{M as qe}from"./MobileAppDrawer-5FBCjy6b.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="351ea8ab-8473-481a-bb56-d0406ff55bf6",t._sentryDebugIdIdentifier="sentry-dbid-351ea8ab-8473-481a-bb56-d0406ff55bf6")}catch{}})();function nt(){const t=G(),u=h((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Le(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const Ke=He.div`
2
- display: flex;
3
- min-height: 100%;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${t=>t.theme.colors.grey4};
9
- `,Ye=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=E.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ge.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:w,stateOfIncorporation:A,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:b,companySourceOfFunds:H,companySourceOfFundsDescription:q,transactionVolume:K,transactionVolumeDescription:Y,purposeOfAccount:$,purposeOfAccountDescription:J,regulatedStatus:W,regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee}=e,_=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Re(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?L(f?.toString()):f,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:A?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:b?.selectedOptions.map((v=>v.length===2?v:j(v)))??[],companySourceOfFunds:H?.selectedOption??"",companySourceOfFundsDescription:q,transactionVolume:K?.selectedOption??"",transactionVolumeDescription:Y,purposeOfAccount:$?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:W??"",regulatedStatusDescription:Q,usNexus:X,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(P({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F}=m;let b;return S.selectDocumentType==="driverLicense"?b="driving_license":S.selectDocumentType==="passport"?b="passport":S.selectDocumentType==="stateId"?b="id_document":S.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?j(I.selectedOption):void 0,phone:l,birthday:o!=null?L(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:b,isSelectedForVerification:w,userVerificationStatus:A,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(P({officers:s}))},onSaveDetailsClick:e=>{t(R(n,e,i))},onSendForVerificationClick:e=>{t(R(n,e,i,!0))},onAddressClick:e=>{const s=Z(T,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=Z(T,e),m=U(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(Ee({files:e}))},onDeleteFile:e=>{t(Be(e))},onDeleteFileList:e=>{t(xe(e))},onEditFileName:(e,s)=>{t(ve(e,s.split(".")[0]))},onGetOtp:e=>{t(_e(e,"SpendManagementSetup"))},onResendOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(Ne(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ae({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Ve(e.documentType);s!=null&&t(we({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(ke({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ze),st=({productType:t})=>{const u=ne(),n=se(),i=G(),[d,p]=V.useState(!1),[r,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=Pe(),{useDynamicConfig:m}=Me(),{configValue:O}=m(Ue.zeniAccountsConfig),C=ue(O),g=h((a=>{switch(t){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}})),y=h((a=>a.companyConfigState.fetchState)),I=h((a=>a.userRoleConfigState.fetchState)),c=h((a=>z(a))),o=c.companyId??E.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),V.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{T(a)},S=h((a=>{switch(t){case"zeni_accounts":return Te(a,o);case"zeni_treasury":return he(a,o);case"charge_cards":return be(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?k.jsx(ie,{to:"../promo"}):k.jsxs(Ke,{children:[k.jsx(je,{analytics:M,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(B.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(B.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(B.Event.billPayBusinessVerification,x(n)?"Settings":void 0)}})(a)}),x(n)?k.jsx(qe,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,k.jsx(Ye,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:M,currentTenant:c,productType:t,isSettings:x(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};
@@ -1,14 +0,0 @@
1
- import{j as g}from"./liveblocks-BOLtmXrt.js";import{a as l}from"./sentry-CXDuPEuw.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as Se}from"./core-BTxe1IJ4.js";import{a as ge,e6 as be,z as ye,e8 as Pe,ea as z,eb as Ie,bo as W,a8 as we,k as D,ec as H,em as Ee,G as ke,S as Ae,w as xe,ef as Te,eg as Ue,av as _e,ej as Oe,ek as ve,bk as Qe,el as je}from"./index-t_YINWfi.js";import{gN as De,fH as G,fI as Fe,gb as $e,jo as Le,jk as Ve,fJ as M,gx as Re,gr as qe,gt as N,gz as Be,gA as He,gB as Me,gC as Ne,gD as ze}from"./zeni-epic-state-EEoBiaeS.js";import{D as We,n as $,P as Ge,S as Je}from"./mui-CoXsq-BK.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.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]="0eebe82a-dcd6-4f62-a038-42b046b9c64c",e._sentryDebugIdIdentifier="sentry-dbid-0eebe82a-dcd6-4f62-a038-42b046b9c64c")}catch{}})();const J="chat-response-generated",Y="cards/ask",K="card_policy_hero";function F(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),d=a.isSubmitting,c=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:d,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Oe(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...c}}),(function(e,a){const{location:o,currentTenant:d,userId:c,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:T,cardPolicyPageContext:U}=a,i=d.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):F(i);return{onEventReceived:(n,t)=>{if(n===J&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?D.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,je(P,y),s.metadata.message_id??null):D.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Me(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(ze({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:c}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,c,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Be(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(qe()),m((function(n){return`/${n}/${Y}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(Re({questionAnswerId:n,isCollapsed:t}))},...ve(e,{isAiCardCreationEnabled:x,isCardPolicyEnabled:T,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(F(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(xe(Te)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,gt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),d=he(),c=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:T,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(De())}),[o]);const i=B((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=B((r=>Fe(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=c.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:A,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),d(c.pathname,{replace:!0,state:z(c.state)})}),[c.pathname,c.state,d]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,j=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&d((function(r,w){return`/${r}/${Y}/${w}`})(s,t),{state:{...c.state},replace:!0})}),[t,p,s,d,c.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o($e({sessionId:p,agentId:"controller"}))}),[]);const ce=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${J}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&j&&o(Le())}),[Q,j,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!j&&o(Ve(t,C.userId))}),[V,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const de=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(tt,{children:[g.jsx(we,{analytics:D,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...ce,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:T,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:d,sessionFromUrl:de,location:c,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{d(I?X(s):F(s),{state:{...c.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),g.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(et,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},et=$(Je)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,tt=$.div`
6
- flex: 1 1 auto;
7
- display: flex;
8
- flex-direction: column;
9
- min-height: 0;
10
- width: 100%;
11
- `,st=$(Ge)`
12
- box-shadow: ${({theme:e})=>e.colors.elevation2};
13
- color: ${({theme:e})=>e.colors.grey4};
14
- `;export{gt as default};
@@ -1,11 +0,0 @@
1
- import{j as I}from"./liveblocks-BOLtmXrt.js";import{a as o}from"./sentry-CXDuPEuw.js";import{u as F,h as R,g as H,j as C,N as w}from"./core-BTxe1IJ4.js";import{U1 as q,fI as z,go as G,pV as V,gP as U,gn as M,gl as Q,Ur as B,gk as A}from"./zeni-epic-state-EEoBiaeS.js";import{u as J,z as E,L as T,G as K,M as W}from"./index-t_YINWfi.js";import{n as X}from"./mui-CoXsq-BK.js";import{P as h,a as _}from"./AccountMappingScreen-BE1tvCY-.js";import{t as Y}from"./getLocaleForTenant-AQFwGK3G.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-D1I_iW5h.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";import"./MobileAppDrawer-5FBCjy6b.js";import"./InboxNotificationsProvider-DNSMQBKV.js";import"./useTaskManagerAccess-21llCh7a.js";import"./accountMappingHelper-B03ntuMF.js";import"./empty-BlDbR96Q.js";import"./pdf-lib-CTa71n8-.js";import"./index-9ZQLuzDm.js";import"./url-b7gVrWYV.js";import"./index-BBiUi3gN.js";import"./decodeURIComponentSafe-CLAUpL82.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]="763a13dc-2c3c-4656-a8ee-82fc55014cce",t._sentryDebugIdIdentifier="sentry-dbid-763a13dc-2c3c-4656-a8ee-82fc55014cce")}catch{}})();const te=X.div`
2
- display: flex;
3
- flex: 1 1 auto;
4
- flex-direction: row;
5
- justify-content: center;
6
- align-items: center;
7
- width: 100%;
8
- height: 100vh;
9
- background-color: ${t=>t.theme.colors.background};
10
- box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
11
- `;function we(){const t=F(),i=R(),v=H(),{setLoading:d,clearAllLoading:m}=J(),S=o.useRef(!1),x=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:O,realmId:$,state:L}=Z(v.search),f=O!==""&&$!==""&&L!=="";f&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===_.pending,P=j===_.ready,y=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,c=e?.externalConnections?.saveConnectionState,b=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{d(T.CONNECTION_AUTH)}),[d]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(T.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,d]),o.useEffect((()=>{e.tenantId==null&&!x.current&&a!=null&&(x.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(V(a.userId)))}),[x,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||c!=="Error"||(d(T.CONNECTION_AUTH),t(U(a.userId,e.tenantId)))}),[c]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(M(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),Q(a?.userId,a?.zeniSessionId,e.tenantId),K.updateAppLocaleID(Y(B(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(U(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{y.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(y.tenantsCoreDetailsInOrder)}),[y.tenantsCoreDetailsInOrder.length,n]);const D=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&c==="In-Progress"&&(p.current=!0)}),[u,c]),o.useEffect((()=>{if(!u||D)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&c==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):p.current&&c==="Error"?(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(f||N.current||p.current||b!==!0||(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,D,c,f,b,e.tenantEmailDomain,m,t,i]),D)return null;if(f||b!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return P?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
@@ -1 +0,0 @@
1
- import{j as i}from"./liveblocks-BOLtmXrt.js";import{z as m}from"./index-t_YINWfi.js";import{g as n}from"./QBOConnectionScreen-D1I_iW5h.js";import"./sentry-CXDuPEuw.js";import{g as p,N as a}from"./core-BTxe1IJ4.js";import"./zeni-epic-state-EEoBiaeS.js";import"./recharts-4iB4lKv8.js";import"./mui-CoXsq-BK.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";import"./empty-BlDbR96Q.js";import"./pdf-lib-CTa71n8-.js";import"./index-9ZQLuzDm.js";import"./url-b7gVrWYV.js";import"./index-BBiUi3gN.js";import"./decodeURIComponentSafe-CLAUpL82.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="a1205b81-d106-415b-bd92-85aeae53ace3",t._sentryDebugIdIdentifier="sentry-dbid-a1205b81-d106-415b-bd92-85aeae53ace3")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),s=m.getSignedInUser()?.userId??"";if(f(o,r,e,s)===!0){const d=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(a,{to:d})}return i.jsx(a,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BOLtmXrt.js";import{a as d}from"./sentry-CXDuPEuw.js";import{h as B,u as G,g as A,i as q,j as l,N as F,l as _,n as N,o as O}from"./core-BTxe1IJ4.js";import{X3 as R,fI as $,Wk as M,n2 as X,Sl as k,X8 as Y,WZ as z,m2 as V,Sm as S,Wp as Z,Wq as H,W$ as J,W_ as K}from"./zeni-epic-state-EEoBiaeS.js";import{b8 as L,k as Q,a4 as U,p as tt}from"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import{d as b}from"./decodeURIComponentSafe-CLAUpL82.js";import{w as et}from"./withTransactionSidePanel-DxjwZ9FM.js";import{f as at,c as nt}from"./routePaths-ByVgDZC2.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";import"./useAskAiCfoHostNavButtonProps-CGeN7NSS.js";import"./TransactionDetailScreen-bF7tC5BL.js";import"./useInitialThreadRequest-AuBsHZ1k.js";import"./expenseAutomationHelper-DayJ0nIv.js";import"./stripSplatSuffix-Ph0joKsY.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]="b20686ee-0477-425e-be5a-9dc916436ba4",a._sentryDebugIdIdentifier="sentry-dbid-b20686ee-0477-425e-be5a-9dc916436ba4")}catch{}})();const ot=_((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:Q,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(J({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(K("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(Z()),a(H()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=U(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}))}}}}))(L),it=et((function({entityType:a,...t}){const e=B(),o=G(),c=A(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:W}=q(),r=b(x??""),p=b(W??""),u=rt(r,p),j=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>R(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),v=l((n=>$(n).company?.companyInfo.firstMonthOfFY??1)),f=l((n=>M(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&u===!0&&(T(!0),o(X(i)))}),[m,u,i]);const E=l((n=>n.trendState.fetchState)),P=f?.selectedPeriod?.timePeriod??g,w=(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:v,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:w,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(F,{to:I(j.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 vt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{vt as EntityDetailRoutes,vt as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BOLtmXrt.js";import{a as r}from"./sentry-CXDuPEuw.js";import{aw as c,ax as l,q as p,a4 as f}from"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import m from"./NotFoundScreen-CT9mXoPL.js";import{h as u,g as b}from"./core-BTxe1IJ4.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]="0558ec16-7d14-475c-91d0-925b0ae2f1dd",e._sentryDebugIdIdentifier="sentry-dbid-0558ec16-7d14-475c-91d0-925b0ae2f1dd")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=f(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=c(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:d}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -1 +0,0 @@
1
- import{a as r}from"./sentry-CXDuPEuw.js";import{u as l,h as f,g as m}from"./core-BTxe1IJ4.js";import{h$ as p,UH as g,UI as b}from"./zeni-epic-state-EEoBiaeS.js";import{u as _,L as h,z as y}from"./index-t_YINWfi.js";import"./liveblocks-BOLtmXrt.js";import"./recharts-4iB4lKv8.js";import"./mui-CoXsq-BK.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.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]="cbaf99b7-e770-4476-819d-df693b100290",e._sentryDebugIdIdentifier="sentry-dbid-cbaf99b7-e770-4476-819d-df693b100290")}catch{}})();function R(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:c}=_(),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(p(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}))}c();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{R as default};
@@ -1,2 +0,0 @@
1
- import{j as c}from"./liveblocks-BOLtmXrt.js";import{a as r}from"./sentry-CXDuPEuw.js";import{u as L,h as _,i as F,j as k,t as Z,l as O,s as q,g as X,N as V,n as oe,o as x}from"./core-BTxe1IJ4.js";import{a8 as Yn,k as g,aq as R,S as d,cc as et,cd as nt,ce as tt,cf as it,cg as ot,ch as at,ci as ct,cj as st,ck as rt,cl as dt,cm as lt,cn as ut,p as J,co as gt,cp as vt,z as W,ae as se,cq as mt,cr as pt,cs as St,ct as ft,cu as It,cv as ht,cw as Ct,cx as kt,cy as Et,cz as yt,O as bt,ai as rn,cA as xt,cB as At,cC as Dt,cD as jt,cE as Lt,cF as _t,cG as Pt,cH as wt,cI as $t,cJ as Ft,cK as Rt,t as He,j as _e,cL as Tt,cM as Ot,cN as Mt,cO as Nt,cP as Ut,cQ as Bt,cR as Vt}from"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import{A as K}from"./AddressScreen-DX07-zau.js";import M from"./NotFoundScreen-CT9mXoPL.js";import{ZW as Ht,ZX as qt,vv as qe,ZY as G,vY as re,ZZ as Pe,Z_ as de,wz as be,wG as Qt,wL as dn,Z$ as we,wD as ln,yd as Qe,vX as ze,_0 as zt,_1 as un,wW as xe,_2 as le,w_ as Kt,_3 as Gt,_4 as gn,x1 as vn,z8 as Wt,_5 as Se,_6 as Ke,_7 as mn,vV as Zt,_8 as Xt,vP as Jt,_9 as Yt,yq as ei,_a as pn,yz as Ge,_b as ni,yw as ti,_c as $e,gk as Fe,_d as te,_e as ie,xg as ii,w1 as We,w6 as Sn,w4 as oi,v_ as ai,x9 as ci,w8 as si,xi as ri,_f as Ae,xr as fn,xp as fe,xn as ue,xm as di,_g as In,yF as Ze,_h as li,vW as hn,_i as Re,fI as Ie,wh as De,we as je,wr as Cn,wq as Te,wb as ui,wk as kn,wt as ae,VI as En,vZ as Oe,wo as gi,wp as vi,wn as mi,_j as pi,w$ as Si,wX as yn,_k as bn,vJ as Xe,_l as fi,vF as Ii,_m as hi,yL as Ci,yP as Q,yK as ki,xT as he,_n as Ei,_o as xn,yY as Je,_p as yi,yV as bi,_q as An,xW as xi,xX as H,x_ as Ai,_r as Dn,y8 as Ee,_s as Di,xh as jn,Ue as Ln,_t as ji,yi as Li,_u as _n,_v as _i,_w as Pi,_x as wi,zN as $i,_y as Fi,_z as Pn,z3 as wn,_A as $n,zL as ye,_B as Ri,zI as Ti,_C as Oi,_D as Mi,_E as Ni,_F as Ui,_G as Bi,_H as Ye,_I as Vi,ei as Hi,zR as qi,_J as Me,xB as Qi,xw as zi,_K as ge,xM as Fn,xE as ve,xD as Ki,xH as Rn,_L as Gi,xC as Wi,_M as Tn,z9 as On,zA as en,zv as Zi,_N as Xi,za as Ji,_O as Yi,zB as eo,zF as no,_P as Ne,wB as Mn,zm as to,wC as io,_Q as oo,_R as Nn,c9 as ao,mv as co,mw as so,_S as nn,wA as me,go as ro,mC as lo,zs as Un,A1 as uo,zp as Bn,v1 as go,uR as vo,hV as mo,UH as tn,UI as po,Gn as Vn,z_ as So,hN as fo,zX as Io,_T as ho,_U as Co,A7 as ko,A6 as Eo,_V as yo,_W as Hn,A4 as bo,_X as xo,_Y as Ao,ym as Do,_Z as jo}from"./zeni-epic-state-EEoBiaeS.js";import{M as Lo}from"./MobileAppDrawer-5FBCjy6b.js";import{q as pe}from"./QBOConnectionScreen-D1I_iW5h.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.js";import"./InboxNotificationsProvider-DNSMQBKV.js";import"./useTaskManagerAccess-21llCh7a.js";import"./empty-BlDbR96Q.js";import"./pdf-lib-CTa71n8-.js";import"./index-9ZQLuzDm.js";import"./url-b7gVrWYV.js";import"./index-BBiUi3gN.js";import"./decodeURIComponentSafe-CLAUpL82.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]="c6522e08-1fd8-4609-985a-ba3d81b5202e",t._sentryDebugIdIdentifier="sentry-dbid-c6522e08-1fd8-4609-985a-ba3d81b5202e")}catch{}})();const $=({event:t,isReady:e=!0})=>e?c.jsx(Yn,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function _o(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:p,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(Ht),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((P,U)=>{const T=qt(D,P,U,E);T!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{entity:P,entityId:U,fromScreen:"audit_log",toScreen:P}),e(T))}),[E,e,D]);r.useEffect((()=>{const P=setTimeout((()=>u(a)),300);return()=>clearTimeout(P)}),[a]),r.useEffect((()=>{i&&t(qe({filters:y,keepExistingListItems:!1,sort:v}))}),[i,y,v,t]);const A=m==="Not-Started"||m==="In-Progress"&&f.length===0,C=m==="In-Progress"&&f.length>0,j=m==="Completed";return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingAuditLogPage,isReady:j}),c.jsx(et,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:p,isLoading:A,isLoadingMore:C,searchValue:a,sortState:l,onEntityLinkClick:b,onLoadMore:()=>{p&&I!=null&&t(qe({cursor:I,filters:y,keepExistingListItems:!0,sort:v}))},onSearchChange:o,onSortChange:S})]})}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(re({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(re({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function Y(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const S=l.current==="In-Progress";l.current=t,t==="Completed"&&S&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((S=>S+1)))}),[s,e]),a}const Po=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(d.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(ln({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(we({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemEdited,{itemId:i}),t(dn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(Qt({action:o,id:a,parentItemId:i}))}}}))(nt);function $o(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=F(),[a]=Z(),{areTenantIdsInSync:o}=R(),s=(u=a.get("kind"))!=null&&Po.has(u)?u:"plan";var u;const l=k((y=>Pe(y,n))),{pageFetchState:S}=l,v=S.fetchState;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(be({id:n,kind:s}))}),[o,n,s,t]);const m=r.useCallback((y=>t(be({cacheOverride:!0,id:y,kind:s}))),[t,s]),p=Y(l.fetchState,l.isFormLoading,n,m),f=v==="Completed"&&!l.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&&(v==="Not-Started"||v==="In-Progress"||l.isFormLoading);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(wo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:l},p)]})}const Fo=new Set(["addon","charge","plan"]),Ro=new Set(["plan"]),To=O((function(t,e){const n=Pe(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(d.Event.invoicingCatalogItemFormCancelled),t(de({id:a})),e.navigate(`${n}/catalog`)},onChange:s=>{t(we({id:a,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemSaved,{mode:i}),t(dn({id:a}))}}}))(tt);function Oo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=F(),[a]=Z(),{areTenantIdsInSync:o}=R(),s=n!=null,u=a.get("type"),l=u!=null&&Fo.has(u)?u:void 0,S=(v=a.get("kind"))!=null&&Ro.has(v)?v:"plan";var v;const m=k((p=>Pe(p,n)));return Ce(o,!0),r.useEffect((()=>{o&&t(be({id:n,kind:S}))}),[o,n,S,t]),r.useEffect((()=>{s||l==null||m.localData.catalogType===l||t(we({localData:{...m.localData,catalogType:l}}))}),[s,l,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const p=m.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(de({id:n}))}}),[m.fetchState,m.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCatalogItemFormPage}),c.jsx(To,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:s,itemId:n})]})}const Mo={addons:"addon",all:"item",charges:"charge",plans:"plan"},No=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(d.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Mo[e.activeTab];g.trackInvoicingActionClick(d.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onCatalogItemLifecycleAction:(s,u)=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemLifecycleAction,{action:u,fromScreen:"catalog_list",itemId:s}),t(ln({action:zt(u),id:s}))},onLoadMore:()=>{if(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(ze({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(re({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?ze({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):re({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(it);function Uo(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[l,S]=r.useState(""),[v,m]=r.useState(null),p=r.useMemo((()=>v!=null?{dir:v.direction,field:v.columnKey}:void 0),[v]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((P=>G(P))),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 P=setTimeout((()=>S(a)),300);return()=>clearTimeout(P)}),[a]),r.useEffect((()=>{i&&t(Qe({cacheOverride:!1,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[i,t,I,E,p]),r.useEffect((()=>{i&&(f!==y||p?.field!==D?.field||p?.dir!==D?.dir)&&t(Qe({cacheOverride:!0,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[y,D,i,t,I,E,f,p]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCatalogPage,isReady:C}),c.jsx(No,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:v,planFilters:I,productFilters:E,sort:p,planNextCursor:b,productNextCursor:A,runningCatalogItemActionId:j,onSearchChange:o,onTabChange:u,onSortChange:m})]})}const Bo=O((function(t,e){const n=un(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(d.Event.invoicingCouponFormCancelled),t(le({id:i})),e.navigate(`${n}/discounts`)},onChange:s=>{t(Gt({id:i,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCouponSaved,{mode:a}),t(Kt({id:i}))}}}))(ot);function Vo(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,savedCouponId:s}=k((u=>un(u,n)));return r.useEffect((()=>{a&&t(xe({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,l=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(l),t(le({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCouponFormPage}),c.jsx(Bo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Ho=O((function(t){const e=gn(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(d.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(mn(a))},onSubmit:()=>{const a=Xt(t.localData);g.trackInvoicingActionClick(d.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(Jt(a))}}}))(ct);function qo(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),[i]=Z(),{areTenantIdsInSync:a}=R(),o=i.get("customerId"),s=k((b=>gn(b))),u=s.fetchState,l=s.localData,S=s.savedInvoiceId,v=k(vn),m=k((b=>Wt(b))),p=k(Se),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&v==null,I=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,E=f||I,h=m.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(Ke()),()=>{t(Ke())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||l.customerId!==""||(y.current=!0,t(mn({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{a&&t(Zt({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=S!=null?`/${n}/invoicing/invoices/${encodeURIComponent(S)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,S,e,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(at,{}):c.jsx(Ho,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(st);function zo(){const t=L(),e=_(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>Yt(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(ei({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Ko=O((function(t){const e=pn(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(d.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ti({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(rt);function Go(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=pn(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Ge({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ge({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCreditsListPage,isReady:y}),c.jsx(Ko,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ni(D)),onSortChange:S})]})}const qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t(Ae({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new`)},onDiscardEdit:()=>{t(fe(ue)),t(di({id:i}))},onOpenAddress:()=>{const a=qn(e.tenantEmailDomain??"",ue,i),o=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerEdited,{customerId:i}),t(Ae({id:i,localData:a})),t(fn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(ri({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(si({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(ut);function Zo(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((T=>$e(T,i))),u=s.pageFetchState.fetchState,l=u==="Completed"&&!s.isFormLoading,[S,v]=r.useState(!1),[m,p]=r.useState(!1),[f,I]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&I(i)}),[i,l]);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(Fe({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(te()),t(ie()),()=>{t(te()),t(ie())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(p(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(ii({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(We({customerId:i}))}),[o,i,t,A]);const P=r.useCallback((T=>t(Sn({id:T}))),[t]),U=Y(s.fetchState,s.isFormLoading,i,P);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCustomerDetailPage,isReady:l}),c.jsx(Wo,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(te()),i!=null&&A&&t(We({customerId:i})),v(!0)},onCreatePromotionalCredits:()=>{t(ie()),p(!0)}},U),c.jsx(dt,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:S,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(ai({customerId:i}))},onClose:()=>{v(!1),t(te())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(d.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(oi({customerId:i,data:T})))}}),c.jsx(lt,{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:m,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ie())},onSubmit:({amount:T,description:ne})=>{i!=null&&(g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(ci({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:ne})))}})]})}const Xo=O((function(t,e){const n=$e(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(d.Event.invoicingCustomerFormCancelled),t(In({id:i})),t(fe(ue)),e.navigate(`${n}/customers`)},onChange:s=>{t(Ae({id:i,localData:s}))},onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const s=qn(e.tenantEmailDomain??"",ue,i),u=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerSaved,{mode:a}),t(fn({id:i}))}}}))(gt);function Jo(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCustomerId:u}=k((l=>$e(l,i)));return r.useEffect((()=>{o&&i!=null&&t(Sn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const l=u??i,S=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(S),t(In({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCustomerFormPage}),c.jsx(Xo,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const Yo=O((function(t){const e=Se(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(d.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(d.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(hn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(vt);function ea(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=Se(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ze({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingCustomersListPage,isReady:y}),c.jsx(Yo,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(li(D)),onSortChange:S})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),na=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],l=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:l==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:l==="Not-Started"||l==="In-Progress",isLoadingMore:l==="In-Progress"&&(u?.items.length??0)>0,session:Le(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],l=Le(s,a),S=s.actionStateByKind.retry?.fetchState==="In-Progress",v=s.actionStateByKind.rollback?.fetchState==="In-Progress",m=l?.status==="done"&&l.rollback_available_until!=null&&new Date(l.rollback_available_until).getTime()>Date.now()&&!v;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Fe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(je({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:l?.status!=="failed"||S?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Te(a)))},onRollback:m?()=>{a!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(Cn(a)))}:void 0}}))(mt);function ta(){const t=L(),e=_(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),[o,s]=r.useState({}),u=k(Re),l=k(Ie),S=r.useMemo((()=>{const E=W.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:l.tenantId}}),[l.tenantId]),v=Le(u,n),m=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(De(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(je({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const p=v?.status==="scanning"||v?.status==="importing";r.useEffect((()=>{if(!a||n==null||!p)return;const E=setInterval((()=>{t(De(n)),t(je({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,p,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`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=m?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDataImportDetailPage,isReady:v!=null&&I!=="Not-Started"}),c.jsx(na,{authParams:S,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const Qn=t=>`invoicing_active_migration:${t}`,ce=(t,e)=>{if(t!=null&&t!=="")try{const n=Qn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ia=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(ae(s)),ce(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(d.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Te(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(Cn(o))},onViewSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(pt);function oa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(Re);r.useEffect((()=>{i&&(t(ui()),t(kn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ia,{navigate:e,tenantEmailDomain:n,view:a})]})}const aa=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:l,sessionDetail:S,sessions:v}=u,m=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),p=n!=null?S[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(m?.isValid??!1),chargebeeConnectorAvailable:m!=null,chargebeeSite:o?.chargebee_site,connectError:l.connect?.error?.message,connecting:l.connect?.fetchState==="In-Progress",retrying:l.retry?.fetchState==="In-Progress",session:p??v.find((f=>f.id===n)),starting:l.start?.fetchState==="In-Progress",uploading:l.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Fe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(d.Event.invoicingChargebeeConnectClicked),t(mi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(Te(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportStarted),n!=null&&t(vi(n))},onUpload:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportFileUploaded),t(gi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(St);function ca(){const t=L(),e=_(),{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=`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,l=o.companyId??W.getSignedInUserTenant(n??"")?.companyId,S=k((h=>En(h,l))),v=k(Re),{activeMigrationSessionId:m}=v,p=m??void 0,f=p!=null?v.sessionDetail[p]??v.sessions.find((h=>h.id===p)):void 0;r.useEffect((()=>{i&&(t(Oe()),t(kn()))}),[i,t]),r.useEffect((()=>{if(m!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Qn(y))}catch{return null}})(n);h!=null&&t(ae(h))}),[m,t,n]),r.useEffect((()=>{ce(n,m)}),[m,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||p==null||!E)return;const h=setInterval((()=>{t(De(p))}),3e3);return()=>clearInterval(h)}),[i,p,E,t]),r.useEffect((()=>{I==="done"&&(t(ae(null)),ce(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDataImportMigratePage}),c.jsx(aa,{activeId:p,authParams:s,integrationsView:S,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:v,onBack:()=>{t(ae(null)),ce(n,null),e(`/${n}/invoicing/data_import`)}})]})}const sa=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(d.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(yn({action:a,id:i}))},onSaveEdit:a=>{g.trackInvoicingActionClick(d.Event.invoicingCouponEdited,{couponId:i}),t(Si({data:a,id:i}))}}}))(ft);function ra(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((I=>pi(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,l=u==="Completed",[S,v]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&v(n)}),[n,l]);const m=S===n;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(xe({id:n}))}),[a,n,t]);const p=r.useCallback((I=>t(xe({cacheOverride:!0,id:I}))),[t]),f=Y(o.fetchState,o.isFormLoading,n,p);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDiscountDetailPage,isReady:l}),c.jsx(sa,{hasLoadedRecord:m,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=bn(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(d.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(d.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(yn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(Ii({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(It);function la(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=bn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(fi(b)),onSortChange:S})]})}const ua=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(d.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(Q({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(Q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(Q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(Q({action:"retry",id:i}))}:void 0}}))(Ct);function ga(){const t=L(),e=_(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((C=>hi(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[l,S]=r.useState("idle"),[v,m]=r.useState(!1),[p,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{S("idle"),m(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(Ci({id:n})),S("idle"),m(!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&&l!=="pending"&&(m(!1),S("pending"),g.trackInvoicingActionClick(d.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,l,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(ki({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(he({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{S("idle"),m(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(S("idle"),m(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&p==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,p,I]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?v&&o.actionState.fetchState==="Completed"?(n!=null&&t(Ei({id:n})),h()):v&&o.actionState.fetchState==="Error"&&S("failed"):m(!0))}),[n,h,t,l,v,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:d.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(ua,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(ht,{initialDraft:p,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const va=O((function(t){const e=xn(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(d.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...i(a),action:o}),t(Q({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(bi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(kt);function ma(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=xn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Je({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDunningListPage,isReady:D}),c.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(yi(b)),onSortChange:S})]})}const pa=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(d.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(d.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(H({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail"}),t(Ai({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(d.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(H({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(H({action:"void",invoiceId:i,body:s}))}}}))(Et);function Sa(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((f=>An(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[l,S]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&S(n)}),[n,u]);const v=l===n;r.useEffect((()=>{a&&n!=null&&t(xi({invoiceId:n}))}),[a,n,t]);const m=r.useCallback((f=>t(he({invoiceId:f}))),[t]),p=Y(o.actionState.fetchState,o.fetchState==="In-Progress",n,m);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(pa,{invoiceId:n??"",hasLoadedRecord:v,navigate:e,tenantEmailDomain:i,view:o},p)]})}const fa=O((function(t){const e=Dn(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(d.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(d.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(d.Event.invoicingInvoiceReminderSent,i(a)),t(H({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(d.Event.invoicingInvoiceRegenerated,i(a)),t(H({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,i(a)),t(H({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,i(a)),t(H({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(jn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(yt);function Ia(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=Dn(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}}),q),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&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ee({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(fa,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(Di(A)),t(Ee({cacheOverride:!1,filters:m,sort:v}))},onSortChange:S})]})}function on(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),i=bt(),a=rn(),[o,s]=r.useState(!1),{acceptTermsState:u,status:l}=k(Ln),S=ji(i?.loggedInUserRoleMap),v=`/${n}/invoicing`,m=p=>{s(p)};return l==="completed"?c.jsx(V,{to:`${v}/overview`,replace:!0}):l==="settings"&&S?c.jsx(V,{to:`${v}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingPromoPage}),c.jsx(Lo,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),c.jsx(xt,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!S,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(d.Event.invoicingTermsAccepted),t(Li())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const ha=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(Fi({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t($i())}}}))(At);function Ca(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:l,submitState:S}=k((f=>_n(f,n??""))),v=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(_i()),m.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(he({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&m.current!==n&&(m.current=n,t(Pi({localData:wi(s)})))}),[t,o,s,n]);const p=r.useRef(S.fetchState);return r.useEffect((()=>{const f=p.current;p.current=S.fetchState,f!=="Completed"&&S.fetchState==="Completed"&&l!=null&&e(`${v}/credits/${encodeURIComponent(l)}`)}),[l,e,S.fetchState,v]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(ha,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ka=O((function(t){return{invoicingOverview:Pn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(d.Event.invoicingOverviewRefreshed),t(wn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(d.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(d.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Dt);function Ea(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>Pn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(wn(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingOverviewPage,isReady:o}),c.jsx(ka,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const ya=O((function(t){const e=$n(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Ti({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(jt);function ba(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:p,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const P=$n(j);return{activeType:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,transactionListFetchState:P.fetchState,transactions:P.transactions}}),q),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const P=y.find((T=>T.id===j)),U=P?.linkedInvoices?.[0]?.invoiceID??P?.invoiceID;U!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const P=y.find((U=>U.id===j))?.customerID;P!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:P,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(P)}`))}),[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&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(ya,{navigate:e,tenantEmailDomain:n,activeType:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(Ri(j)),t(ye({cacheOverride:!1,filters:m,sort:v}))},onSortChange:S,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const xa=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 an(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=n!=null&&n!=="",s=k(Se),u=k((C=>Oi(C))),l=k(Mi),S=k((C=>An(C,n??""))),v=S.invoice,m=`/${i}/invoicing`,p=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ni()),p.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?he({invoiceId:n}):hn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&v!=null&&n!=null&&S.fetchState==="Completed"&&p.current!==n&&(p.current=n,t(Ui({contextInvoiceId:n,localData:Bi(v)})))}),[t,v,n,S.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(jn({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(Ye({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=l.fetchState,C!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:xa(C)})))),[s.customers]),h=k((C=>Vi(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,P=Hi.currencySymbol,Pt("0,0.00",j,P)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,P}))),[h]),D=r.useMemo((()=>{if(!o||v==null)return;const C=v.currencyCode??"USD",j=v.amountDue?.amount??0;return{amountDue:Lt("0,0.00",v.amountDue),amountDueValue:j,currencyCode:C,customerName:v.customerName??v.customerID,invoiceId:v.id,invoiceNumber:v.invoiceNumber??v.id}}),[v,o]),b=o?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,A=!o||S.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(_t,{customers:E,fieldHelp:u.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:l.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(Ye({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(d.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 zn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Aa=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:l}=e.editView;g.trackInvoicingActionClick(d.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:l?.mrr?.amount,customerId:l?.customerID,fromScreen:"subscription_detail",status:l?.status,subscriptionId:i}),t(Rn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(ge({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(d.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(fe(ve)),t(Ki({id:i}))},onOpenAddress:()=>{const s=zn(e.tenantEmailDomain??"",ve,i),u=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onSaveEdit:s=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ge({id:i,localData:s})),t(Fn({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 Da(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((y=>Me(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:S}=s,v=s.pageFetchState.fetchState,m=v==="Completed"&&!s.isFormLoading,[p,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=p===i;Ce(o),r.useEffect((()=>{o&&i!=null&&t(Qi({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(zi({id:y}))),[t]),h=Y(s.fetchState,s.isFormLoading,i,E);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingSubscriptionDetailPage,isReady:m}),c.jsx(Aa,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:S,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const ja=O((function(t,e){const n=Me(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionFormCancelled),t(Tn({id:i})),t(fe(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(ge({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const o=zn(e.tenantEmailDomain??"",ve,i),s=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionSaved,{mode:a}),t(Fn({id:i}))}}}))($t);function La(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),[o]=Z(),{areTenantIdsInSync:s}=R(),u=o.get("customerId"),{fetchState:l,savedSubscriptionId:S}=k((p=>Gi(p,i))),v=k((p=>Me(p,i).localData));Ce(s),r.useEffect((()=>{s&&t(Wi({subscriptionId:i}))}),[s,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||u==null||u===""||v.customerId!==""||(m.current=!0,t(ge({id:i,localData:{...v,customerId:u}})))}),[u,i,v,t]),r.useEffect((()=>{if(l==="Completed"){const p=S??i,f=p!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(p)}`:`/${a}/invoicing/subscriptions`;e(f),t(Tn({id:i}))}}),[l,S,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingSubscriptionFormPage}),c.jsx(ja,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const _a=O((function(t){const e=On(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((l=>l.id===a));g.trackInvoicingActionClick(d.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Rn({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(d.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.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(d.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(Ji({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ft);function Pa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=On(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}}),q),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(en({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(Zi())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(_a,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(Xi(C)),onSortChange:S})]})}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(d.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(d.Event.invoicingTransactionCaptured,{transactionId:i}),t(no({action:"capture",id:i}))}:void 0}}))(Rt);function $a(){const t=L(),e=_(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>Yi(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(eo({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(wa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Kn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=R(),u=k(Ne),l=u.connection?.connected===!0,S=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&S!=="Not-Started"||o(Mn()),n&&o(to()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&l&&i&&o(io())}),[s,o,e,l,i]),{isQboConnected:l,qboView:u}}const Fa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ee(t){const e=L(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=F(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:l,stripeConnectState:S}=k(oo),{configError:v,configFetchState:m,dunningScheduleActionOptions:p,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Nn),h=k(Ne);Kn({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=>En(w,b))),C=ao(y.userRole??[]),j=y.tenantId??"",P=W.getSignedInUser(),U={userId:P?.userId??"",sessionId:P?.zeniSessionId??"",tenantId:j},T=s?.fileId,ne=k((w=>T!=null&&T!==""?co(w,T):void 0)),Ue=k((w=>T!=null&&T!==""?so(w,T):void 0)),Gn=T!=null&&T!==""&&ne!=null?{[T]:ne}:{},Wn=T!=null&&T!==""&&Ue!=null?{[T]:Ue}:{};r.useEffect((()=>(e(nn()),()=>{e(nn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Oe()))}),[n,e,a]),r.useEffect((()=>{n&&D&&m==="Not-Started"&&e(me())}),[n,e,m,D]),r.useEffect((()=>{if(!n)return;const w=P?.userId;w!=null&&w!==""&&j!==""&&He.shouldFetchActiveTenant(j)&&(He.markActiveTenantFetchStarted(j),e(ro(w,j,P?.zeniSessionId)))}),[n,e,P?.userId,P?.zeniSessionId,j]);const Zn=p.length>0||f.length>0,Xn=a==="Not-Started"||a==="In-Progress"&&l==null||D&&!Zn&&(m==="Not-Started"||m==="In-Progress"),Jn=a==="Completed"&&(!D||m==="Completed"),Be=A.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,ke=se?.invoicingMicroServiceBaseUrl,Ve=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:S.fetchState==="In-Progress",onConnectStripe:w=>{g.trackInvoicingActionClick(d.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(Io(w))},onDisconnect:(w,B)=>{j!==""&&(g.trackInvoicingActionClick(d.Event.invoicingIntegrationDisconnected,{entity:B,entityId:w,fromScreen:t??"hub"}),e(fo(j,w,tn(B))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(d.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(So())},onReconnectQBO:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const w=y.tenantEmailDomain??i??"";pe.init("/connection/auth",w),pe.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Vn()))},onSaveChargeBeeCredentials:(w,B)=>{Be!=null&&j!==""&&(g.trackInvoicingActionClick(d.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(mo(j,Be,tn("revenue"),po("chargebee"),{api_key:w,site:B})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve};return{authParams:U,deleteFileStatusById:Gn,fieldHelp:o,dunningScheduleActionOptions:p,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:z,isInvoicingPageReady:Jn,isLoading:Xn,isSaving:u.fetchState==="In-Progress",isStripeBusy:S.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&&m==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve,updateFileStatusById:Wn,onConnectStripe:z.onConnectStripe,onDeleteFile:w=>{g.trackInvoicingActionClick(d.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(vo(w,j))},onDisconnectStripe:z.onDisconnectStripe,onEditFileName:(w,B)=>{g.trackInvoicingActionClick(d.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(go(w,B.split(".")[0],j))},onReconnectQBO:z.onReconnectQBO,onRefreshQBO:z.onRefreshQBO,onRetryQboSyncTask:w=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"retry_task",entityId:w,fromScreen:t??"hub"}),e(Bn(w))},onSave:w=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{fieldsChanged:Object.keys(w).filter((B=>JSON.stringify(w[B])!==JSON.stringify(l?.[B]))),tab:t??"hub"}),e(uo({settings:w,snackbarSection:Fa[t??""]}))},onStartQboBackfill:w=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Un(w))},updateFilesEntity:w=>{g.trackInvoicingActionClick(d.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(lo({files:w}))}}}function cn({appContent:t}){const e=_(),n=X(),i=L(),{tenantEmailDomain:a}=F(),o=ee("branding"),s=k((l=>ho(l)));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&i(Co())}),[s.saveState.fetchState,i]);const u=_e(s.saveState.fetchState);return r.useEffect((()=>{u==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[u,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Tt,{address:s.address,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:l=>{i(yo({localData:l}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const l=`/${a}/invoicing/settings/branding/${Eo}/`,S=J(n.state?.pathnameStackToGoBack,n.pathname);e(l,{state:{pathnameStackToGoBack:S}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{tab:"branding"}),i(ko())},updateFilesEntity:o.updateFilesEntity})]})}function Ra(){const t=_(),e=ee("dunning");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Ot,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Ta(){const t=_(),e=ee("integrations");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Mt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Oa(){const t=_(),e=ee("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Nt,{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 Ma=["autoCreateItems","closedPeriodVoidAsCreditMemo","customerMatching","isSyncEnabled","syncStartDate","trackingCategoriesEnabled"],Na=O((function(t){const e=Hn(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,e){return{onChange:n=>{t(Ao({localData:n}))},onReset:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(xo())},onRetryTask:n=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"retry_task",entityId:n,fromScreen:"settings_qbo"}),t(Bn(n))},onSave:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{fieldsChanged:e.changedFields,tab:"quickbooks"}),t(bo())},onStartBackfill:n=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Un(n))}}}))(Ut);function Ua(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),i=k(Ie),{configFetchState:a,localData:o,savedLocalData:s,saveState:u,settingsFetchState:l}=k(Hn),S=r.useMemo((()=>{return m=o,p=s,[...[...new Set([...Object.keys(m.accountIdByMappingCode),...Object.keys(p.accountIdByMappingCode)])].some((f=>(m.accountIdByMappingCode[f]??"")!==(p.accountIdByMappingCode[f]??"")))?["account_mappings"]:[],...Ma.filter((f=>m[f]!==p[f]))];var m,p}),[o,s]),v=_e(u.fetchState);return r.useEffect((()=>{v==="In-Progress"&&u.fetchState==="Completed"&&e("..")}),[e,v,u.fetchState]),r.useEffect((()=>{l!=="Not-Started"&&l!=="Error"||t(Oe())}),[t,l]),r.useEffect((()=>{a==="Not-Started"&&t(me())}),[a,t]),Kn({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingQboSettingsPage}),c.jsx(Na,{changedFields:S,onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),pe.init("/connection/auth",i.tenantEmailDomain??n??""),pe.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Vn())}})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=rn(),e=L(),n=_(),[i,a]=Z(),o=ee(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:l,isQboConfigured:S,isStripeConnected:v}=k(Nn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const p=Ba[m];a({},{replace:!0}),p!=null&&n(p,{replace:!0})}),[m,n,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:d.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Bt,{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:S,isStripePaymentsReady:v,onEnableInvoicingClick:l?void 0:()=>{g.trackInvoicingActionClick(d.Event.invoicingEnableClicked),e(Do())}})]})}function sn(){return c.jsxs(oe,{children:[c.jsx(x,{index:!0,element:c.jsx(Va,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Oa,{})}),c.jsx(x,{path:"branding",element:c.jsx(cn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(cn,{appContent:c.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Ta,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Ra,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ua,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:"..",replace:!0})})]})}function Sc(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),{enableState:a,fetchState:o,status:s}=k(Ln),u=_e(a.fetchState),l=`/${n}/invoicing`,S=r.useRef(!1),v=k((m=>Ne(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||S.current||(S.current=!0,t(me({cacheOverride:!1}))):t(me({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&v==="Not-Started"&&t(Mn())}),[i,t,v]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),t(jo()))}),[u,a.fetchState,l,t,e]),s==null&&o!=="Error"?c.jsx(Vt,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(oe,{children:[c.jsx(x,{path:"promo",element:c.jsx(on,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:`${l}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(oe,{children:[c.jsx(x,{path:"promo",element:c.jsx(on,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(sn,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:`${l}/settings`,replace:!0})})]}):c.jsxs(oe,{children:[c.jsx(x,{path:"/",element:c.jsx(V,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(Ea,{})}),c.jsx(x,{path:"promo",element:c.jsx(V,{to:`${l}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(ea,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(Jo,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(Zo,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(Pa,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(La,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(Da,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"invoices",element:c.jsx(Ia,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(qo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(Sa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(an,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(Ca,{})}),c.jsx(x,{path:"payments",element:c.jsx(ba,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(an,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx($a,{})}),c.jsx(x,{path:"credits",element:c.jsx(Go,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(zo,{})}),c.jsx(x,{path:"discounts",element:c.jsx(la,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Vo,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(ra,{})}),c.jsx(x,{path:"dunning",element:c.jsx(ma,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ga,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Uo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(Oo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx($o,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(sn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(_o,{})}),c.jsx(x,{path:"data_import",element:c.jsx(oa,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(ca,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ta,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{Sc as default};
@@ -1,12 +0,0 @@
1
- import{j as u}from"./liveblocks-BOLtmXrt.js";import{a as g}from"./sentry-CXDuPEuw.js";import{u as O,g as w,h as _,t as V,j as l,N as U}from"./core-BTxe1IJ4.js";import{z as r,E as M,G as P,R as A,k as N,S as R,Z as $,$ as G,V as W}from"./index-t_YINWfi.js";import{fI as X,U3 as Z,Uw as q,Un as B,gl as H,gn as J,Us as K,gX as Q,dk as Y,Ux as ee,Uy as te}from"./zeni-epic-state-EEoBiaeS.js";import{n as ne}from"./mui-CoXsq-BK.js";import{u as se}from"./useDeviceId-Bb0qVsLr.js";import{f as ie}from"./analyticsHelper-CR4O3yZF.js";import{t as ae}from"./getLocaleForTenant-AQFwGK3G.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.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]="0e5c437f-e796-4106-b45c-9bc145644ffc",t._sentryDebugIdIdentifier="sentry-dbid-0e5c437f-e796-4106-b45c-9bc145644ffc")}catch{}})();const T=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function Te(){const t=O(),i=w(),m=_(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),a=se(),{otpChallenge:c,twoFAPhoneNumber:x,magicLinkEmail:d,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:C}=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=>X(e))),k=l((e=>Z(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&a!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(q(n,a,f)))}),[n,p,t,a,f,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(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),P.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=W();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Y(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,i.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{a!=null&&c!=null&&d!=null&&t(ee(a,d,c))}),[a,c,t,d]),F=g.useCallback((e=>{a!=null&&n!=null&&d!=null&&c!=null&&t(te(e,a,d,c))}),[a,n,t,d,c]);if(h==="Completed"&&c!=null)return u.jsx($,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,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(U,{to:e,state:{...i.state,origin:""}})}if(!T(n,p)||f==null||h==="Error"){const e=i.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(U,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(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};