@zeniai/web-app-ui 5.3.81-dev → 5.3.82-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.
- package/dist/assets/{AccountMappingScreen-BqrHv3lf.js → AccountMappingScreen-C1ayPIAG.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-h8TCOzmP.js → ActualMatchingMatchDetailScreen-WhvwIzcC.js} +1 -1
- package/dist/assets/AddressRoutes-y8YhHSJR.js +1 -0
- package/dist/assets/AddressScreen-De5NyEzZ.js +9 -0
- package/dist/assets/AiCfoScreen-DFAyr8gH.js +22 -0
- package/dist/assets/{AppDrawer-O4ZEFSY7.js → AppDrawer-DI_vp2xj.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-CEnfa_wS.js → BillPayApprovalRoutes-DcY6lBge.js} +1 -1
- package/dist/assets/{BillPayRoutes-lyhC_q-2.js → BillPayRoutes-Cfhufn9I.js} +18 -18
- package/dist/assets/BusinessVerificationPageScreen-DC4WfK27.js +9 -0
- package/dist/assets/{CardsAiCfoScreen-DrIgNEMk.js → CardsAiCfoScreen-B5X7-nvK.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-BOqQM_C6.js → ChargeCardRoutes-DKflGNQM.js} +7 -7
- package/dist/assets/{CompanyPassportScreen-CxZJl1bJ.js → CompanyPassportScreen-y7X0MJz8.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-DbBitMLj.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-LSIDUzax.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-Q5ECv8HT.js → CustomerOnboardingRoutes-DOhBde9s.js} +7 -7
- package/dist/assets/{DashboardRoutes-BKSV9vko.js → DashboardRoutes-DUDSVl0J.js} +4 -4
- package/dist/assets/{DefaultTenantHome-BBKs-l6f.js → DefaultTenantHome-BPmXauyS.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-C8qRoekM.js → DomesticWireDetailScreen-BtVT1jo7.js} +3 -3
- package/dist/assets/{DrawerScreen-CN9HYciY.js → DrawerScreen-DEO6aDXv.js} +1 -1
- package/dist/assets/EntityDetailRoutes-DWi6isSB.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-DGlzQW9f.js → ExpenseAutomationRoutes-CWCG6f-Z.js} +4 -4
- package/dist/assets/{FeaturePreviewScreen-C6K1_63v.js → FeaturePreviewScreen-Bcz_KiRo.js} +1 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-BCD_byli.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-EoJhdrtc.js → InboxNotificationsProvider-CnIopK35.js} +1 -1
- package/dist/assets/InvoicingRoutes-By0wmZnY.js +3 -0
- package/dist/assets/{MagicLinkRoutes-DatBzzr0.js → MagicLinkRoutes-CrNQ1d6Y.js} +9 -9
- package/dist/assets/MagicLinkSignInScreen-CVv9wx7_.js +12 -0
- package/dist/assets/{MobileAppDrawer-CgJ60E2m.js → MobileAppDrawer-DeMnqMws.js} +1 -1
- package/dist/assets/NotFoundScreen-DiKdubNF.js +1 -0
- package/dist/assets/NotificationRoutes-DXwqR_6J.js +1 -0
- package/dist/assets/OAuthConsentScreen-D-7AI34s.js +1 -0
- package/dist/assets/{PandLWithForecastRoutes-U9sR4r18.js → PandLWithForecastRoutes-DwmnvviI.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-DwyYqfzu.js → PaymentLinkScreen-sxUNJ-ai.js} +1 -1
- package/dist/assets/PeopleRoutes-Dpf-nOzf.js +22 -0
- package/dist/assets/PerformanceRoutes-9mPYusWH.js +1 -0
- package/dist/assets/{Preview-Dfm6FKNt.js → Preview-CxGDVP6M.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DFycm_ki.js → QBOConnectionScreen-fOrpVwph.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-B13CHT4T.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-C_dMNpou.js → ReimbursementApprovalRuleDetailScreen-DyHV9hua.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-CverQIks.js → ReimbursementRoutes-BIilRUCw.js} +4 -4
- package/dist/assets/{ReportsRoutes-BCJIsVHt.js → ReportsRoutes-DGD0Kisc.js} +1 -1
- package/dist/assets/RewardsRoutes-DOe7osW-.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BKYsisUv.js → ScheduleDetailsPrepaidExpensesScreen-mgDC8nA3.js} +5 -5
- package/dist/assets/ScreenRoutes-B6CsF55P.js +2 -0
- package/dist/assets/{SettingsRoutes-C6bz6i-5.js → SettingsRoutes-DsKTn4YF.js} +6 -6
- package/dist/assets/{SetupPagesScreen-B2ZhtNLX.js → SetupPagesScreen-1DRsRGaO.js} +5 -5
- package/dist/assets/SignInScreen-old3vVaI.js +1 -0
- package/dist/assets/SignOutScreen-C9nuOKax.js +9 -0
- package/dist/assets/TaskListScreen-BvZ3nUhV.js +9 -0
- package/dist/assets/TaskRoutes-vQ9Qc0Wt.js +9 -0
- package/dist/assets/TransactionDetailRoutes-BnI9Ohm4.js +1 -0
- package/dist/assets/{TransactionDetailScreen-JD8O14oY.js → TransactionDetailScreen-gg_jzjg4.js} +2 -2
- package/dist/assets/{TransactionListRoutes-Cn4w6j8O.js → TransactionListRoutes-DXtggfuW.js} +1 -1
- package/dist/assets/TreasuryRoutes-lxwEfAXe.js +37 -0
- package/dist/assets/{VendorsRoutes-BwM6t0j-.js → VendorsRoutes-BuuNVNIw.js} +12 -12
- package/dist/assets/WiseConfirmationScreen-Bm5Jwnlz.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-CGLFu0Ov.js → ZeniAccountRoutes-DDXr_ULo.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-B61YBb2s.js +9 -0
- package/dist/assets/{accountMappingHelper-DKrp-2iY.js → accountMappingHelper-DSmoEgXo.js} +1 -1
- package/dist/assets/{analytics-k_LuQgHs.js → analytics-ff6bapqe.js} +1 -1
- package/dist/assets/{analyticsHelper-CnJWG9bB.js → analyticsHelper-kcXI5tFD.js} +1 -1
- package/dist/assets/{core-Beu9kTtR.js → core-C32E0M-A.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-0ml5lsEu.js → decodeURIComponentSafe-C5UecJ4I.js} +1 -1
- package/dist/assets/{dnd-BD4CdaiB.js → dnd-C_Bep5ai.js} +1 -1
- package/dist/assets/{empty-C_-q3sdl.js → empty-DAPHCQXk.js} +1 -1
- package/dist/assets/{empty-N5VvFHKn.js → empty-DqCrlpnK.js} +1 -1
- package/dist/assets/{emptyVideoElement--WG9qJqH.js → emptyVideoElement-CBVQNEap.js} +1 -1
- package/dist/assets/epic-uAZSWoZy.js +2 -0
- package/dist/assets/expenseAutomationHelper-DLsy_Ty8.js +1 -0
- package/dist/assets/{getLocaleForTenant-YwW4TLUd.js → getLocaleForTenant-B7DrNxDF.js} +1 -1
- package/dist/assets/{index-B5QcNvR2.js → index-B4RhNvku.js} +1 -1
- package/dist/assets/{index-DUM1Dz7Q.js → index-BcLofI65.js} +1 -1
- package/dist/assets/{index-DPHHyNze.js → index-BukMmlEq.js} +2 -2
- package/dist/assets/{index-Dxjgx_aK.js → index-CfrgrNvU.js} +1 -1
- package/dist/assets/{index-CMLe_P16.js → index-CtLBLCty.js} +1 -1
- package/dist/assets/{index-BfNeAGgC.js → index-DCtJNiUy.js} +7 -7
- package/dist/assets/{index-DfjWlew7.js → index-DIaTP7_M.js} +1 -1
- package/dist/assets/{index-pVZIHhft.js → index-DuYo1zmY.js} +1 -1
- package/dist/assets/{lexical-ae4wZrjx.js → lexical-Byw8jdWu.js} +1 -1
- package/dist/assets/{liveblocks-DwoS2LTS.js → liveblocks-CcAJDSgG.js} +1 -1
- package/dist/assets/{lottie-BGwNmPax.js → lottie-DW03v0-7.js} +1 -1
- package/dist/assets/{mui-DEiF_Hb4.js → mui-Ba-vLBC4.js} +1 -1
- package/dist/assets/{pathToGoBack-DlfSGzqF.js → pathToGoBack-BbG758cW.js} +1 -1
- package/dist/assets/{pdf-CuKXyKjy.js → pdf-B6gXz38d.js} +4 -4
- package/dist/assets/{pdf-lib-jUWLVDc9.js → pdf-lib-DW7wIt2i.js} +1 -1
- package/dist/assets/{plaid-UFuUhVwC.js → plaid-CEp7her_.js} +1 -1
- package/dist/assets/{pusher-Dk2WejFj.js → pusher-CeHXXfqs.js} +1 -1
- package/dist/assets/{react-DOpmw48o.js → react-BEdnfLLu.js} +1 -1
- package/dist/assets/{react-DLObBre3.js → react-BQt0qic3.js} +1 -1
- package/dist/assets/{react-C-VUuuL3.js → react-CTPAIO5c.js} +1 -1
- package/dist/assets/{react-BM64rH6B.js → react-DcC_IWpk.js} +1 -1
- package/dist/assets/{react-DRcOWQ_U.js → react-MOydQ4XL.js} +1 -1
- package/dist/assets/{react-DUTB_3h5.js → react-wmLhO00N.js} +1 -1
- package/dist/assets/{recharts-MD3a-5g4.js → recharts-g8-bInqc.js} +1 -1
- package/dist/assets/{routePaths-uZogBPDo.js → routePaths-BGf6E4zO.js} +1 -1
- package/dist/assets/{sentry-BF2EAQwc.js → sentry-Bo3euLoP.js} +1 -1
- package/dist/assets/{stripSplatSuffix-6CTGoq-D.js → stripSplatSuffix-IWd2is7o.js} +1 -1
- package/dist/assets/{url-CcLycjqh.js → url-CzSmdUOo.js} +1 -1
- package/dist/assets/{url-DTzy9das.js → url-DjGKFjyy.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-D8RZjK70.js +1 -0
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-4BNh0D5K.js → useAiCfoDashboardSuggestedQuestionsChips-Dc6ROsau.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-B4mYX3VH.js → useAskAiCfoHostNavButtonProps-BO9PbO4e.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-DIeSIWcP.js → useChargeCardPusherEvents-mHgU3OkI.js} +1 -1
- package/dist/assets/{useDeviceId-gZ0JJcev.js → useDeviceId-D1tbmD3W.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DICe2M-2.js +1 -0
- package/dist/assets/{useInitialThreadRequest-BhgsGG5D.js → useInitialThreadRequest-DitWfieX.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-IxEInAYM.js → useTaskManagerAccess-DP5KTNvW.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-DIUFIhyQ.js → useTaskManagerPusherEvents-mQG4ptVc.js} +1 -1
- package/dist/assets/{utils-CaDQp8mU.js → utils-CY3YGcdR.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DH0DiNtU.js → withTransactionSidePanel-DIBSJL4n.js} +3 -3
- package/dist/assets/{zeni-epic-state-1d5RmIXy.js → zeni-epic-state-yHa8unrA.js} +7 -7
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-CevDzchV.js +0 -1
- package/dist/assets/AddressScreen-Goy7OAa3.js +0 -9
- package/dist/assets/AiCfoScreen-CRBP1pbJ.js +0 -22
- package/dist/assets/BusinessVerificationPageScreen-CRJRFoBF.js +0 -9
- package/dist/assets/ConnectionAuthScreen-CxIPuBQD.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-r36YH7JA.js +0 -1
- package/dist/assets/EntityDetailRoutes-DvnbYoBF.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-COzUIs57.js +0 -1
- package/dist/assets/InvoicingRoutes-DxRpDPHw.js +0 -3
- package/dist/assets/MagicLinkSignInScreen-BJzYh3J4.js +0 -12
- package/dist/assets/NotFoundScreen-DK36JFcR.js +0 -1
- package/dist/assets/NotificationRoutes-DRUjl08J.js +0 -1
- package/dist/assets/OAuthConsentScreen-DBjBNnQJ.js +0 -1
- package/dist/assets/PeopleRoutes-CN01cV2T.js +0 -22
- package/dist/assets/PerformanceRoutes-sPgEs3ei.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-BUzBZ8wT.js +0 -1
- package/dist/assets/RewardsRoutes-DL4U3zKu.js +0 -1
- package/dist/assets/ScreenRoutes-ChqMx09J.js +0 -2
- package/dist/assets/SignInScreen-BhdMuyKL.js +0 -1
- package/dist/assets/SignOutScreen-DhNypZcK.js +0 -9
- package/dist/assets/TaskListScreen-uIZd6Y1d.js +0 -9
- package/dist/assets/TaskRoutes-CmCsn1P4.js +0 -9
- package/dist/assets/TransactionDetailRoutes-Vh6CRIwx.js +0 -1
- package/dist/assets/TreasuryRoutes-C3gzhi0V.js +0 -37
- package/dist/assets/WiseConfirmationScreen-BrP-8WW4.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-TsXZSj_4.js +0 -9
- package/dist/assets/epic-Cdaahdr-.js +0 -2
- package/dist/assets/expenseAutomationHelper-dXFQtPOw.js +0 -1
- package/dist/assets/useActualMatchingMatchDetail-4m9qzYbe.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-DjE-2Sye.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-
|
|
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-DCtJNiUy.js"></script><link rel="modulepreload" crossorigin href="/assets/sentry-Bo3euLoP.js"><link rel="modulepreload" crossorigin href="/assets/core-C32E0M-A.js"><link rel="modulepreload" crossorigin href="/assets/zeni-epic-state-yHa8unrA.js"><link rel="modulepreload" crossorigin href="/assets/mui-Ba-vLBC4.js"><link rel="modulepreload" crossorigin href="/assets/analytics-ff6bapqe.js"><link rel="modulepreload" crossorigin href="/assets/utils-CY3YGcdR.js"><link rel="stylesheet" crossorigin href="/assets/index-BQ3cXEYt.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.
|
|
3
|
+
"version": "5.3.82-dev",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/**/*"
|
|
6
6
|
],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@sentry/react": "^9.42.1",
|
|
30
30
|
"@stripe/stripe-js": "^4.4.0",
|
|
31
31
|
"@zeniai/client-analytics": "2.1.2",
|
|
32
|
-
"@zeniai/client-epic-state": "5.2.
|
|
33
|
-
"@zeniai/web-components": "4.4.
|
|
32
|
+
"@zeniai/client-epic-state": "5.2.79",
|
|
33
|
+
"@zeniai/web-components": "4.4.20",
|
|
34
34
|
"color": "3.1.3",
|
|
35
35
|
"crypto-js": "4.2.0",
|
|
36
36
|
"dnd-core": "^16.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-DwoS2LTS.js";import{A as i}from"./AddressScreen-Goy7OAa3.js";import s from"./NotFoundScreen-DK36JFcR.js";import"./sentry-BF2EAQwc.js";import{n as d,o as r}from"./core-Beu9kTtR.js";import"./zeni-epic-state-1d5RmIXy.js";import"./recharts-MD3a-5g4.js";import"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.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-DwoS2LTS.js";import{a as h}from"./sentry-BF2EAQwc.js";import{h as T,u as P,g as j,i as E,j as B,l as L}from"./core-Beu9kTtR.js";import{_ as M,z as V,V as $,a5 as D,a6 as K,j as C,Q as S,a1 as U,U as b,a2 as z}from"./index-BfNeAGgC.js";import{VH as _,it as F,fI as R,VI as G,c9 as H,VJ as N,mL as O}from"./zeni-epic-state-1d5RmIXy.js";import{u as q,n as J}from"./mui-DEiF_Hb4.js";import Q from"./NotFoundScreen-DK36JFcR.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]="85dac346-a733-433d-9ab1-6389ac3f01f7",e._sentryDebugIdIdentifier="sentry-dbid-85dac346-a733-433d-9ab1-6389ac3f01f7")}catch{}})();const W=J.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
|
-
`,X=L((function(e,s){const{addressId:o,isSubPage:i,addressType:c}=s,l=R(e),a=s.roleMap!=null&&G(s.roleMap),d=i||c==="user_address"||H(l?.userRole??[])||a?void 0:"readonly";if(o==null){const t=N(c,e);return{addressToEdit:t?.addressToCreate,loadingState:t?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:s.dontShowSaveConfirmation}}const r=_(e,o);return{addressToEdit:r.address,loadingState:r.fetchState,googleAPIKey:b.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=z(d?.pathnameStackToGoBack);let t=r.poppedPathname??I();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(t=`${t}?${g}`)}o(t,{state:{pathnameStackToGoBack:r.newStack}})}};return{onSubmitHandler:a=>{const d=Y(a);e(O({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(S.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)}}}))(U);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(),g=M(),v=q(),w=V.getSignedInUser(),[f,k]=h.useState(t==null),p=B((m=>t!=null?_(m,t).fetchState:"Not-Started")),x=$();if(w==null)throw Error("Can't access address page without signing in...");const A=m=>m.trackPageLoaded(t!=null?S.Event.editAddress:S.Event.addAddress),y=l??u;return h.useEffect((()=>{f||t==null||(k(!0),d(F(t,!1)))}),[f,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)?!f&&p==="Not-Started"||f&&p==="In-Progress"?n.jsx(D,{fetchState:p,style:{backgroundColor:v.colors.grey5}}):t!=null&&p==="Error"?(a(`${I(1)}/new`,{replace:!0}),n.jsx(n.Fragment,{})):n.jsxs(n.Fragment,{children:[n.jsx(K,{analytics:C,onLoad:A}),n.jsx(W,{windowSize:g,children:n.jsx(X,{location:r,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:s,addressId:t,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):n.jsx(Q,{})}const I=(e=2)=>{let s="../";for(let o=0;o<e;o++)s=`${s}../`;return s},Y=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,Y as t};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as S}from"./liveblocks-DwoS2LTS.js";import{a}from"./sentry-BF2EAQwc.js";import{u as Dt,h as Lt,i as Ft,g as Bt,j as v,l as Mt}from"./core-Beu9kTtR.js";import{e4 as Nt,a as $t,g as Vt,e5 as Gt,z as Ht,_ as zt,e6 as qt,e7 as Wt,e8 as Jt,bn as Fe,e9 as We,ea as Yt,bm as Je,a2 as ge,a6 as ce,j as N,eb as me,ec as Kt,ed as Zt,as as Xt,Q as es,w as ts,ee as ss,ef as as,at as ns,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Be,ek as ds}from"./index-BfNeAGgC.js";import{fH as M,gw as R,Up as cs,a2D as ms,a2E as Ss,jQ as hs,a2F as ps,jN as fs,a2G as Se,jt as Y,jW as K,jz as Ie,jg as he,je as gs,jY as Is,jI as Ye,Uy as Me,gy as $,gN as Cs,Ux as ks,Ui as Ne,fI as bs,j7 as vs,a2H as Es,gb as Ps,jp as ys,jl as ws,fJ as pe,gi as xs,a2I as Rs,a2J as Ts,a2K as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2L as He,jZ as _s,ji as Qs,jC as Us,jU as ze,jF as Ds,gA as Ls,gB as Fs,gC as Bs,gD as Ms}from"./zeni-epic-state-1d5RmIXy.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-DEiF_Hb4.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-4BNh0D5K.js";import{p as Hs}from"./pathToGoBack-DlfSGzqF.js";import{j as zs}from"./routePaths-uZogBPDo.js";import{u as qs}from"./useTaskManagerPusherEvents-DIUFIhyQ.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="2af2a811-739a-448e-8b0b-a5f980ed0d76",t._sentryDebugIdIdentifier="sentry-dbid-2af2a811-739a-448e-8b0b-a5f980ed0d76")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ke="chat-response-generated";function Js(t,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 h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Ys=Mt((function(t,r){const h=M(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=as(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=js(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${ns}/tableDownload`,exportDownloadEndPoint:rs(),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(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:K(t).detail,skillDetailError:K(t).fetchState==="Error",skillDetailLoading:K(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,F=s.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===Ke&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,j=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:O,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Je(g,E);j!=="answer"?N.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):N.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Fs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Bs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,j,E)=>{n&&Be(t,n,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Ye())},onOpenSkill:n=>{t(Ie({macroId:n})),t(Ds({macroId:n}))},onSaveSkill:(n,o)=>{t(ze({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";t(ze({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{t(Us({macroId:n,version:o}))},onDeleteSkill:n=>{t(Qs({macroId:n}))},onSetSkillVisibility:(n,o)=>{t(_s({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(n,o)=>{t($()),t($e()),Be(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,n),t(He())},updateCurrentInput:n=>{t(Ge(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{t(As(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??Hs(1);l(o,{state:{...h.state,pathnameStackToGoBack:n.newStack}}),t(Ge(""))},togglePageView:()=>{const n=ge(h.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{i!=null&&o?.messageId!=null&&t(Ve(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const n=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{t(Os({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${F}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${F}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),ka=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Ft(),i=Bt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=a.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),F=v((e=>R(e).skillsEnabled)),n=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=a.useState(void 0),[G,A]=a.useState(!1),[Ze,Ce]=a.useState(void 0),Xe=a.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=a.useCallback((e=>{O(e),A(!0)}),[]),tt=a.useCallback((()=>{O(void 0),A(!1)}),[]),st=a.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),O(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),at=a.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{s(P!=null?Y({scheduleId:P}):Se())}),[s,P]);const B=ke?.macroId,nt=v((e=>K(e))),be=B!=null&&B!==""&&nt.fetchState==="Not-Started";a.useEffect((()=>{be&&B!=null&&s(Ie({macroId:B}))}),[s,be,B]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=a.useState(!0);a.useEffect((()=>{T!=null&&s(Y({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(Y({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=a.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=a.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=a.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);a.useEffect((()=>{n&&s(he())}),[s,n]);const Pe=v((e=>R(e).skills)),Z=a.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=a.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=a.useCallback((()=>{s(Ye()),s(Me())}),[s]),ct=a.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();a.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),w=Ht.getSignedInUser();a.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ne()),void s(Me())):(T==null&&s(Se()),s(Ne()),void s($()))),[s,T,g,l]);const ft=zt(),_=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,y=b.tenantEmailDomain,D=y!=null&&y!=="",ee=a.useCallback((e=>{D&&d(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,y]),te=a.useCallback((()=>{D&&d(`/${y}/ai-cfo/routines`)}),[D,d,y]),se=a.useCallback(((e,m)=>{const Q=e.sessionId??C.sessionId;Q!=null&&D&&d(`/${y}/ai-cfo/${Q}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,y]),gt=a.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:qt(k),skillName:k.isAdHoc===!0?void 0:Z.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:y}),ae=Jt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:F,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,z=H?.aiCfoInitialQuestion,ye=!!H?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;f(!0);const m={...e};delete m[Fe],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ne]=a.useState(null),[Et,oe]=a.useState(!1),[Pt,ie]=a.useState(void 0),[yt,re]=a.useState(void 0),we=a.useRef(!1);a.useEffect((()=>{if(!we.current&&z!=null&&z!==""){const e=i.state;ne(z),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),we.current=!0}}),[z,ye,i.state]);const wt=a.useCallback((()=>{ne(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=a.useRef(!1);a.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(s(vs("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,w]);const q=I.uiState.lastContextMessage;a.useEffect((()=>{q!=null&&q!==""&&u!=null&&(ne(q),oe(!0),ie(void 0),re(void 0),s(Es()))}),[q,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Yt(u),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Oe=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(_e,u),Tt=Rt.length===0;a.useEffect((()=>{x||_||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,d,i.state]);const jt=a.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),Qe=a.useRef(void 0),Ue=a.useRef(void 0);a.useEffect((()=>{const e=l!==Qe.current,m=u!==Ue.current;Qe.current=l,Ue.current=u,l!==u&&(!e||l==null||zs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=a.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ke}`)),eventCallback:(e,m,Q)=>Q.onEventReceived(e,m)})),[je]);a.useEffect((()=>{W!=="In-Progress"&&J&&s(ys())}),[W,J,s]),a.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(l===u||W==="Completed"&&!J)&&s(ws(u,w.userId))}),[Oe,W,Ae,J,u,w,l,s]);const ue=w?.userId,At=a.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=a.useCallback((e=>{const m=e!=null&&(e===P||e===T);(n||m)&&s(he()),m&&s(Y({scheduleId:e}))}),[s,n,T,P]);qs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const Q=(de=>{if(de==null||typeof de!="object")return null;const U=de;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);Q!=null&&De(Q.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||l==null)throw Error("Can't access AI Controller page without signing in...");const _t=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:N,onLoad:Le}),ae.drawerElement,S.jsx(Xs,{children:S.jsx(qe,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const Qt=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:N,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ks,{children:[S.jsx(ce,{analytics:N,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),_&&ae.drawerElement,S.jsx(Ys,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:w.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:_t,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:wt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:yt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:_?ae.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:n,routineCanCreate:j,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:Z,routines:o.routines,onRoutineCreate:Xe,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:at,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:F,promoDismissalScope:y}),p&&_?S.jsx(Ns,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ea,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(qe,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!_?S.jsx(Kt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:Qt})}):null]})},qe=V($s)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,Ks=V.div`
|
|
6
|
-
height: 100vh;
|
|
7
|
-
width: 100%;
|
|
8
|
-
`,Zs=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
|
-
`,ea=V(Vs)`
|
|
20
|
-
box-shadow: ${({theme:t})=>t.colors.elevation2};
|
|
21
|
-
color: ${({theme:t})=>t.colors.grey4};
|
|
22
|
-
`;export{ka as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./sentry-BF2EAQwc.js";import{u as K,j as h,h as se,g as oe,i as ie,N as ce,l as re}from"./core-Beu9kTtR.js";import{fI as z,HR as ue,I3 as de,Lf as pe,O5 as le,OL as me,PA as fe,Zt as ye,BQ as Se,SE as ge,Zu as Ie,Zv as he,Zw as be,Zx as Te,Zy as De,Zz as Oe,VI as Ce,Yz as ke,VX as Ve,Mr as Ae,Mj as we,VY as Ne,Mn as Fe,mL as ve,gJ as _e,gI as Ee,gH as xe,v2 as Be,uV as ze,uS as Re,mD as Le,BZ as Pe,BX as R,bF as L,C9 as P,cF as Me}from"./zeni-epic-state-1d5RmIXy.js";import{bR as Ue,V as je,W as Ze,bg as Ge,z as B,a6 as Ke,j as M,n as E,Q as x,bT as qe,ac as He,p as U,aE as j}from"./index-BfNeAGgC.js";import{n as Qe}from"./mui-DEiF_Hb4.js";import{j as A}from"./liveblocks-DwoS2LTS.js";import{d as Z}from"./routePaths-uZogBPDo.js";import{M as We}from"./MobileAppDrawer-CgJ60E2m.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},c=new e.Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="029ca357-4255-4c03-96ae-f0ac3dc9eb4a",e._sentryDebugIdIdentifier="sentry-dbid-029ca357-4255-4c03-96ae-f0ac3dc9eb4a")}catch{}})();function it(){const e=K(),c=h((u=>z(u))),a=c?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:p}=Ue(a),l=h((u=>u.billPaySetupApproverViewState.fetchState));C.useEffect((()=>{a==null||p||l==="Not-Started"&&e(ue(!0,!0,s))}),[a,p,s,l,e])}function G(e,c,a,s=!1){switch(c){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(le(a,!0,s));break;case"charge_cards":e(pe(a,!0,s));break;default:e(de(a,!0,s))}}const Xe=Qe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`,Ye=re((function(e,c){const{businessVerificationDetails:a}=c,s=z(e),p=B.getSignedInUser(),l=s.tenantId,u={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:l??""},b=Ce(c.roleMap)&&a.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=ke(e.companyConfigState),o=Ve(e.userRoleConfigState);return{businessVerificationDetails:a,verficationDetailsFetchState:a.fetchState,isRefreshingViewInBackground:a.isRefreshingViewInBackground,allNationalityCountries:a.allNationalityCountries,filesEndPoint:`${He.fileMicroServiceBaseUrl}`,authParams:u,isDisabled:b,allIndustries:t.companyIndustries??[],companyTitles:o.companyTitles}}),(function(e,c){const{companyId:a,productType:s,currentTenant:p,navigate:l,location:u}=c,{tenantEmailDomain:b}=p;return{onCompanyDetailsChanged:t=>{const{companyDescription:o,companyIndustry:m,companyIndustryType:k,companyLegalName:V,companyTaxId:y,companyWebsite:f,companyPhone:S,primaryContactEmail:d,primaryContactName:i,primaryContactUserId:T,primaryContactSyncToken:D,syncToken:r,fileIds:O,incDate:n,typeOfIncorporation:g,stateOfIncorporation:w,sourceOfFunds:N,companySubIndustry:F,countriesOfOperations:I,companySourceOfFunds:q,companySourceOfFundsDescription:H,transactionVolume:Q,transactionVolumeDescription:W,purposeOfAccount:X,purposeOfAccountDescription:Y,regulatedStatus:$,regulatedStatusDescription:J,usNexus:ee,usNexusTypes:te}=t,v=k?.selectedOption,ae={companyId:a,companyDescription:o,companyIndustry:m.selectedOption,companyIndustryType:v==null||v===""?void 0:v,companyLegalName:V,taxIdOrEIN:y,website:f!=""&&f!=null?Me(f):void 0,phone:S,syncToken:r,fileIds:O,incDate:n!=null?L(n?.toString()):n,typeOfIncorporation:g?.selectedOption??"",stateOfIncorporation:w?.selectedOption??"",sourceOfFunds:N?.selectedOption??"",companySubIndustry:F?.selectedOption??"",countriesOfOperations:I?.selectedOptions.map((_=>_.length===2?_:j(_)))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:H,transactionVolume:Q?.selectedOption??"",transactionVolumeDescription:W,purposeOfAccount:X?.selectedOption??"",purposeOfAccountDescription:Y,regulatedStatus:$??"",regulatedStatusDescription:J,usNexus:ee,usNexusTypes:te?.selectedOptions??[]},ne={userId:T,firstName:i.firstName,lastName:i.lastName,email:d,syncToken:D};e(P({companyDetails:ae,primaryContactDetails:ne}))},onCompanyOfficerUpdated:t=>{const o=t.map((m=>{const{officerType:k,userId:V,name:y,email:f,nationalityCountryCode:S,ssn:d,dob:i,phone:T,syncToken:D,selectDocument:r,role:O,ownership:n,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F}=m;let I;return r.selectDocumentType==="driverLicense"?I="driving_license":r.selectDocumentType==="passport"?I="passport":r.selectDocumentType==="stateId"?I="id_document":r.selectDocumentType==="ssnCard"&&(I="social_security_card"),{officerType:k,userId:V,firstName:y.firstName,lastName:y.lastName,email:f,ssn:d,nationalityCountryCode:S?.selectedOption!=null?j(S.selectedOption):void 0,phone:T,birthday:i!=null?L(i?.toString()):i,syncToken:D,titleAtCompany:O.selectedOption,ownershipInCompany:n,documentTypeSelectedForVerification:I,isSelectedForVerification:g,userVerificationStatus:w,treasuryUserVerificationStatus:N,fileIds:F,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));e(P({officers:o}))},onSaveDetailsClick:t=>{e(R(a,t,s))},onSendForVerificationClick:t=>{e(R(a,t,s,!0))},onAddressClick:t=>{const o=Z(b,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);l(o,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:t=>{const o=Z(b,t),m=U(u.state?.pathnameStackToGoBack,u.pathname);l(o,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{e(Pe({companyId:a})),l("../setup")},updateFilesEntity:t=>{e(Le({files:t}))},onDeleteFile:t=>{e(Re(t))},onDeleteFileList:t=>{e(ze(t))},onEditFileName:(t,o)=>{e(Be(t,o.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Ee(t,"SpendManagementSetup"))},onVerifyOtp:(t,o)=>{e(_e(t,o,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,o)=>{e(ve({addressType:t,addressToCreate:o}))},onIdentityDocumentUploadedForAutofill:t=>{if(a==null)return;const o=Ne(t.documentType);o!=null&&e(Fe({target:"setup",companyId:a,officerType:t.officerType,fileId:t.fileId,documentType:o}))},onCompanyDocumentUploadedForAutofill:t=>{a!=null&&e(we({target:"setup",companyId:a,fileId:t.fileId,documentType:t.documentType}))},onResetKycKybClick:()=>{e(Ae())}}}))(qe),ct=({productType:e})=>{const c=se(),a=oe(),s=K(),[p,l]=C.useState(!1),[u,b]=C.useState(!1),{tenantEmailDomain:t}=ie(),o=je(),{useDynamicConfig:m}=Ze(),{configValue:k}=m(Ge.zeniAccountsConfig),V=ye(k),y=h((n=>{switch(e){case"zeni_accounts":return n.zeniAccountSetupViewState.fetchState;case"reimbursement":return n.remiSetupViewState.fetchState;case"charge_cards":return n.chargeCardSetupViewState.fetchState;case"zeni_treasury":return n.treasurySetupViewState.fetchState;default:return n.billPaySetupViewState.fetchState}})),f=h((n=>n.companyConfigState.fetchState)),S=h((n=>n.userRoleConfigState.fetchState)),d=h((n=>z(n))),i=d.companyId??B.getSignedInUserTenant(t)?.companyId;C.useEffect((()=>{f==="Not-Started"&&s(Se()),S==="Not-Started"&&s(ge(!0))}),[f,S,s]),C.useEffect((()=>{p||y!=="Not-Started"||i==null||(l(!0),G(s,e,i))}),[p,y,i,s]);const T=h((n=>{switch(e){case"zeni_accounts":return De(n,i);case"zeni_treasury":return Te(n,i);case"charge_cards":return be(n,i);case"reimbursement":return he(n,i);default:return Ie(n,i)}})),D=T.kycKybResetStatus.fetchState;if(C.useEffect((()=>{D==="Completed"&&i!=null&&(G(s,e,i,!0),s(Oe()))}),[D,i,e,s]),B.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let r;switch(e){case"zeni_accounts":r=d.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":r=d.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":r=d.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||d.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":r=d.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:r=d.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=n=>{b(n)};return r===!1?A.jsx(ce,{to:"../promo"}):A.jsxs(Xe,{children:[A.jsx(Ke,{analytics:M,onLoad:n=>(g=>{switch(e){case"zeni_accounts":return g.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return g.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return g.trackPageLoaded(x.Event.billPayBusinessVerification,E(a)?"Settings":void 0)}})(n)}),E(a)?A.jsx(We,{isAppContentDrawerOpen:u,handleDrawerToggle:O}):null,A.jsx(Ye,{businessVerificationDetails:T,navigate:c,location:a,companyId:i,analytics:M,currentTenant:d,productType:e,isSettings:E(a),roleMap:o?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:V.maxInsuredAmount})]})};export{ct as B,G as d,it as u};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{j as I}from"./liveblocks-DwoS2LTS.js";import{a as o}from"./sentry-BF2EAQwc.js";import{u as k,h as R,g as H,j as C,N as w}from"./core-Beu9kTtR.js";import{Ud as q,fI as z,go as G,pW as Q,gP as U,gn as V,gl as W,UD as B,gk as A}from"./zeni-epic-state-1d5RmIXy.js";import{u as J,z as E,L as T,G as K,F as M}from"./index-BfNeAGgC.js";import{n as X}from"./mui-DEiF_Hb4.js";import{P as b,a as _}from"./AccountMappingScreen-BqrHv3lf.js";import{t as Y}from"./getLocaleForTenant-YwW4TLUd.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-DFycm_ki.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";import"./MobileAppDrawer-CgJ60E2m.js";import"./InboxNotificationsProvider-EoJhdrtc.js";import"./useTaskManagerAccess-IxEInAYM.js";import"./accountMappingHelper-DKrp-2iY.js";import"./empty-C_-q3sdl.js";import"./pdf-lib-jUWLVDc9.js";import"./index-Dxjgx_aK.js";import"./url-CcLycjqh.js";import"./index-CMLe_P16.js";import"./decodeURIComponentSafe-0ml5lsEu.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]="0d6dbe04-649d-494c-abdb-b26aaa946f5a",t._sentryDebugIdIdentifier="sentry-dbid-0d6dbe04-649d-494c-abdb-b26aaa946f5a")}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 ${M.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
-
`;function we(){const t=k(),i=R(),v=H(),{setLoading:c,clearAllLoading:m}=J(),h=o.useRef(!1),S=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:O,realmId:$,state:F}=Z(v.search),f=O!==""&&$!==""&&F!=="";f&&(N.current=!0);const j=sessionStorage.getItem(b),u=j===_.pending,L=j===_.ready,x=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,d=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{c(T.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{h.current||a==null||g==null||(h.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(T.TENANT_FETCHING),t(G(a.userId,g))))}),[h,n,c]),o.useEffect((()=>{e.tenantId==null&&!S.current&&a!=null&&(S.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(Q(a.userId)))}),[S,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(T.CONNECTION_AUTH),t(U(a.userId,e.tenantId)))}),[d]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(V(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),W(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((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.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&&d==="In-Progress"&&(p.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||D)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&d==="Completed"?(sessionStorage.setItem(b,_.ready),m(),void i(s,{replace:!0})):p.current&&d==="Error"?(sessionStorage.removeItem(b),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(f||N.current||p.current||y!==!0||(sessionStorage.removeItem(b),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,D,d,f,y,e.tenantEmailDomain,m,t,i]),D)return null;if(f||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const P=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return L?I.jsx(w,{to:P,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-DwoS2LTS.js";import{z as m}from"./index-BfNeAGgC.js";import{g as n}from"./QBOConnectionScreen-DFycm_ki.js";import"./sentry-BF2EAQwc.js";import{g as p,N as a}from"./core-Beu9kTtR.js";import"./zeni-epic-state-1d5RmIXy.js";import"./recharts-MD3a-5g4.js";import"./mui-DEiF_Hb4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";import"./empty-C_-q3sdl.js";import"./pdf-lib-jUWLVDc9.js";import"./index-Dxjgx_aK.js";import"./url-CcLycjqh.js";import"./index-CMLe_P16.js";import"./decodeURIComponentSafe-0ml5lsEu.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-DwoS2LTS.js";import{a as c}from"./sentry-BF2EAQwc.js";import{h as A,u as G,g as X,i as q,j as d,N as W,l as F,n as N,o as O}from"./core-Beu9kTtR.js";import{Xf as _,fI as M,Ww as R,n3 as Y,Sx as I,Xk as $,X9 as z,m3 as V,Sy as S,WB as H,WC as J,Xb as K,Xa as L}from"./zeni-epic-state-1d5RmIXy.js";import{b6 as Q,j as U,a2 as Z,p as tt}from"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import{d as k}from"./decodeURIComponentSafe-0ml5lsEu.js";import{w as et}from"./withTransactionSidePanel-DH0DiNtU.js";import{f as at,c as nt}from"./routePaths-uZogBPDo.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";import"./useAskAiCfoHostNavButtonProps-B4mYX3VH.js";import"./TransactionDetailScreen-JD8O14oY.js";import"./useInitialThreadRequest-BhgsGG5D.js";import"./expenseAutomationHelper-dXFQtPOw.js";import"./stripSplatSuffix-6CTGoq-D.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]="c222fd5a-c590-4c28-89c3-9ef1e79a557a",a._sentryDebugIdIdentifier="sentry-dbid-c222fd5a-c590-4c28-89c3-9ef1e79a557a")}catch{}})();const ot=F((function(a,t){const e=t.entity,o=$(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:U,isAccountingClassesEnabled:V(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,l=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:l}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(K({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(H()),a(J()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??C();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(I(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(Q),it=et((function({entityType:a,...t}){const e=A(),o=G(),l=X(),[m,T]=c.useState(!1),[h,D]=c.useState(!1),{tenantEmailDomain:b,entityIdEncoded:x,entityNameEncoded:j}=q(),r=k(x??""),p=k(j??""),f=rt(r,p),w=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=d((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),v=d((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),u=d((n=>R(n.trendWithTransactionsState,i,"EntityDetail")));c.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(Y(i)))}),[m,f,i]);const E=d((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??g,B=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,g);return c.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(I(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:v,tenantEmailDomain:b,location:l,navigate:e,entity:i,defaultTransactionTimePeriod:B,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(W,{to:C(w.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,C=(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{a as i}from"./sentry-BF2EAQwc.js";import{u as f,h as l,g as m}from"./core-Beu9kTtR.js";import{i0 as p,UT as g,UU as _}from"./zeni-epic-state-1d5RmIXy.js";import{u as b,L as h,z as y}from"./index-BfNeAGgC.js";import"./liveblocks-DwoS2LTS.js";import"./recharts-MD3a-5g4.js";import"./mui-DEiF_Hb4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.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]="3a817b4c-87f7-4e7d-964e-fd2d1ac22f81",e._sentryDebugIdIdentifier="sentry-dbid-3a817b4c-87f7-4e7d-964e-fd2d1ac22f81")}catch{}})();function j(){const e=f(),n=l(),r=m(),{setLoading:o,clearAllLoading:u}=b(),s=i.useRef(!1);return i.useLayoutEffect((()=>{o(h.CONNECTION_AUTH)}),[o]),i.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(r.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"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-DwoS2LTS.js";import{a as r}from"./sentry-BF2EAQwc.js";import{u as L,h as _,i as $,j as k,t as Z,l as O,s as Q,g as X,N as H,n as ce,o as x}from"./core-Beu9kTtR.js";import{a6 as ct,j as g,ao as F,Q as l,ca as st,cb as rt,cc as dt,cd as lt,ce as ut,cf as gt,cg as mt,ch as vt,ci as pt,cj as St,ck as ft,cl as It,p as ee,cm as ht,cn as Ct,z as J,ac as de,co as kt,cp as Et,cq as yt,cr as bt,cs as xt,ct as At,cu as Dt,cv as jt,cw as Lt,cx as _t,V as Pt,ag as un,cy as wt,cz as $t,cA as Rt,cB as Ft,cC as Tt,cD as Ot,cE as Mt,cF as Nt,cG as Ut,cH as Bt,cI as Vt,t as ze,h as $e,cJ as Ht,cK as qt,cL as Qt,cM as zt,cN as Kt,cO as Gt,cP as Yt}from"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import{A as G}from"./AddressScreen-Goy7OAa3.js";import M from"./NotFoundScreen-DK36JFcR.js";import{_7 as Wt,_8 as Jt,vw as Ke,v as Zt,_9 as Y,v$ as le,_a as Re,_b as ue,wC as xe,wJ as Xt,dX as gn,wN as mn,_c as Fe,wG as ei,yj as Ge,v_ as Ye,_d as vn,wY as Ae,_e as ge,x0 as ni,_f as ti,xa as ii,_g as pn,x3 as Sn,ze as oi,_h as fe,_i as We,_j as fn,vY as ai,_k as ci,vQ as si,_l as ri,yw as di,_m as In,yF as Je,_n as li,yC as ui,_o as Te,gk as Oe,_p as oe,_q as ae,xi as gi,w4 as Ze,w9 as hn,w7 as mi,w1 as vi,xb as pi,wb as Si,xk as fi,c_ as Cn,_r as De,xt as kn,xr as Ie,xp as me,xo as Ii,_s as En,yL as Xe,_t as hi,vZ as yn,_u as Me,fI as he,wk as je,wh as Le,wu as bn,wt as Ne,we as Ci,wn as xn,ww as se,VU as An,w0 as Ue,wr as ki,ws as Ei,wq as yi,_v as bi,x1 as xi,wZ as Dn,_w as jn,vK as en,_x as Ai,vG as Di,_y as ji,yR as Li,yV as z,yQ as _i,xZ as Ce,_z as Pi,_A as Ln,z2 as nn,_B as wi,y$ as $i,_C as _n,y0 as Ri,y1 as q,y4 as Fi,_D as Pn,ye,_E as Ti,xj as wn,Uq as $n,_F as Oi,yo as Mi,_G as Rn,_H as Ni,_I as Ui,_J as Bi,zT as Vi,_K as Hi,_L as Fn,z9 as Tn,_M as On,zR as be,_N as qi,zO as Qi,_O as zi,_P as Ki,_Q as Gi,_R as Yi,_S as Wi,_T as tn,_U as Ji,ei as Zi,zX as Xi,_V as Be,xD as eo,xy as no,d0 as _e,_W as W,xG as Mn,xM as Nn,_X as Un,xH as ve,xR as to,xU as Bn,_Y as io,xQ as oo,_Z as Vn,zf as Hn,zG as on,zB as ao,__ as co,zg as so,_$ as ro,zH as lo,zL as uo,$0 as Ve,wE as qn,zs as go,wF as mo,$1 as vo,$2 as Qn,c9 as po,mw as So,mx as fo,$3 as an,wD as pe,go as Io,mD as ho,zy as zn,A7 as Co,zv as Kn,v2 as ko,uS as Eo,hW as yo,UT as cn,UU as bo,Gt as Gn,A4 as xo,hO as Ao,A1 as Do,$4 as jo,$5 as Lo,Ad as _o,Ac as Po,$6 as wo,$7 as Yn,Aa as $o,$8 as Ro,$9 as Fo,ys as To,$a as Oo}from"./zeni-epic-state-1d5RmIXy.js";import{M as Mo}from"./MobileAppDrawer-CgJ60E2m.js";import{q as Se}from"./QBOConnectionScreen-DFycm_ki.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";import"./InboxNotificationsProvider-EoJhdrtc.js";import"./useTaskManagerAccess-IxEInAYM.js";import"./empty-C_-q3sdl.js";import"./pdf-lib-jUWLVDc9.js";import"./index-Dxjgx_aK.js";import"./url-CcLycjqh.js";import"./index-CMLe_P16.js";import"./decodeURIComponentSafe-0ml5lsEu.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]="a5d10509-90ec-4451-879d-2e1ca778c35c",t._sentryDebugIdIdentifier="sentry-dbid-a5d10509-90ec-4451-879d-2e1ca778c35c")}catch{}})();const w=({event:t,isReady:e=!0})=>e?c.jsx(ct,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function No(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:v,hasMore:p,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(Wt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((R,U)=>{const T=Jt(D,R,U,E);T!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:R,entityId:U,fromScreen:"audit_log",toScreen:R}),e(T))}),[E,e,D]);r.useEffect((()=>{const R=setTimeout((()=>u(a)),300);return()=>clearTimeout(R)}),[a]),r.useEffect((()=>{i&&t(Ke({filters:y,keepExistingListItems:!1,sort:m}))}),[i,y,m,t]);const A=v==="Not-Started"||v==="In-Progress"&&f.length===0,C=v==="In-Progress"&&f.length>0,j=v==="Completed";return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(st,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:p,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{p&&I!=null&&t(Ke({cursor:I,filters:y,keepExistingListItems:!0,sort:m}))},onSearchChange:o,onSortChange:S})]})}const Wn=["company","email","firstName","invoiceNotes","lastName","notes","phone","vatNumber"],Pe=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(Pe):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).map((([e,n])=>[e,Pe(n)]))):null;function B(t,e,n=[]){const i=t,a=e,o=[...new Set([...Object.keys(i),...Object.keys(a??{})])].filter((u=>{if(a==null)return(d=i[u])!=null&&d!==""&&(Array.isArray(d)?d.length>0:typeof d!="object"||Object.keys(d).length>0);var d;return!(i[u]==null&&a[u]==null)&&!Zt(i[u],a[u])})).sort(),s=Object.fromEntries(o.filter((u=>!n.includes(u))).map((u=>[u,Pe(i[u])])));return{fieldsChanged:o,formValues:s}}function ke(t,e=!1){const n=L(),i=k((s=>Y(s).productNextCursor!=null)),a=k((s=>Y(s).productNextCursor)),o=k((s=>Y(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ne(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const S=d.current==="In-Progress";d.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 Uo=new Set(["plan"]),Bo=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(ei({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(Fe({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i,mode:"edit",...B(e.view.localData,gn(e.view.plan))}),t(mn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(Xt({action:o,id:a,parentItemId:i}))}}}))(rt);function Vo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=$(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=(u=a.get("kind"))!=null&&Uo.has(u)?u:"plan";var u;const d=k((y=>Re(y,n))),{pageFetchState:S}=d,m=S.fetchState;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:s}))}),[o,n,s,t]);const v=r.useCallback((y=>t(xe({cacheOverride:!0,id:y,kind:s}))),[t,s]),p=ne(d.fetchState,d.isFormLoading,n,v),f=m==="Completed"&&!d.isFormLoading;ke(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(m==="Not-Started"||m==="In-Progress"||d.isFormLoading);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(Bo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},p)]})}const Ho=new Set(["addon","charge","plan"]),qo=new Set(["plan"]),Qo=O((function(t,e){const n=Re(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,savedItem:n.plan,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e,a=i!=null?`${n}/catalog/${encodeURIComponent(i)}`:`${n}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(ue({id:i})),e.navigate(`${n}/catalog`)},onChange:o=>{t(Fe({id:i,localData:o}))},onSubmit:()=>{t(mn({id:i}))}}}),(function({savedItem:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{itemId:i.itemId,mode:e.mode,...B(e.localData,t!=null?gn(t):void 0)}),n.onSubmit()}}}))(dt);function zo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=$(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=n!=null,u=a.get("type"),d=u!=null&&Ho.has(u)?u:void 0,S=(m=a.get("kind"))!=null&&qo.has(m)?m:"plan";var m;const v=k((p=>Re(p,n)));return ke(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:S}))}),[o,n,S,t]),r.useEffect((()=>{s||d==null||v.localData.catalogType===d||t(Fe({localData:{...v.localData,catalogType:d}}))}),[s,d,v.localData?.catalogType,t]),r.useEffect((()=>{if(v.fetchState==="Completed"){const p=v.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(ue({id:n}))}}),[v.fetchState,v.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Qo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Go=O((function(t,e){const n=Y(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{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,planRows:n.planRows,productRows:n.productRows}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Ko[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(Ye({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Ye({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(lt);function Yo(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,S]=r.useState(""),[m,v]=r.useState(null),p=r.useMemo((()=>m!=null?{dir:m.direction,field:m.columnKey}:void 0),[m]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((j=>Y(j))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed";return r.useEffect((()=>{const j=setTimeout((()=>S(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(Ge({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(Ge({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(w,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:m,planFilters:I,productFilters:E,sort:p,planNextCursor:b,productNextCursor:A,onSearchChange:o,onTabChange:u,onSortChange:v})]})}const Wo=O((function(t,e){const n=vn(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,savedCoupon:n.coupon,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ge({id:i})),e.navigate(`${n}/discounts`)},onChange:o=>{t(ti({id:i,localData:o}))},onSubmit:()=>{t(ni({id:i}))}}}),(function({savedCoupon:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{couponId:i.couponId,mode:e.mode,...B(e.localData,t!=null?ii(t):void 0)}),n.onSubmit()}}}))(ut);function Jo(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),{fetchState:o,savedCouponId:s}=k((u=>vn(u,n)));return r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ge({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCouponFormPage}),c.jsx(Wo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Zo=O((function(t){const e=pn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(fn(a))},onSubmit:()=>{const a=ci(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length,mode:"create",...B(t.localData,void 0,["memo"])}),e(si(a))}}}))(mt);function Xo(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),[i]=Z(),{areTenantIdsInSync:a}=F(),o=i.get("customerId"),s=k((b=>pn(b))),u=s.fetchState,d=s.localData,S=s.savedInvoiceId,m=k(Sn),v=k((b=>oi(b))),p=k(fe),f=v.fetchState==="Not-Started"||v.fetchState==="In-Progress"&&m==null,I=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,E=f||I,h=v.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(We()),()=>{t(We())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(fn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(ai({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(w,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(gt,{}):c.jsx(Zo,{navigate:e,tenantEmailDomain:n})]})}const ea=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(vt);function na(){const t=L(),e=_(),{credit_note_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),o=k((u=>ri(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(di({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(ea,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const ta=O((function(t){const e=In(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ui({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(pt);function ia(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=In(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(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Je({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(ta,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(li(D)),onSortChange:S})]})}const Jn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},oa=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t(De({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`)},onDiscardEdit:()=>{t(Ie(me)),t(Ii({id:i}))},onOpenAddress:()=>{const a=Jn(e.tenantEmailDomain??"",me,i),o=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i,mode:"edit",...B(a,e.editView.record.invoicingCustomer!=null?Cn(e.editView.record.invoicingCustomer):void 0,Wn)}),t(De({id:i,localData:a})),t(kn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(fi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(Si({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(It);function aa(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=F(),s=k((T=>Te(T,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[S,m]=r.useState(!1),[v,p]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;C.current!=="Error"&&T==="Error"&&t(Oe({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(oe()),t(ae()),()=>{t(oe()),t(ae())})),[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(gi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(Ze({customerId:i}))}),[o,i,t,A]);const R=r.useCallback((T=>t(hn({id:T}))),[t]),U=ne(s.fetchState,s.isFormLoading,i,R);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(oa,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(oe()),i!=null&&A&&t(Ze({customerId:i})),m(!0)},onCreatePromotionalCredits:()=>{t(ae()),p(!0)}},U),c.jsx(St,{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(vi({customerId:i}))},onClose:()=>{m(!1),t(oe())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(mi({customerId:i,data:T})))}}),c.jsx(ft,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:v,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ae())},onSubmit:({amount:T,description:ie})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(pi({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:ie})))}})]})}const ca=O((function(t,e){const n=Te(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,savedCustomer:n.record.invoicingCustomer}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(En({id:i})),t(Ie(me)),e.navigate(`${n}/customers`)},onChange:o=>{t(De({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const o=Jn(e.tenantEmailDomain??"",me,i),s=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{t(kn({id:i}))}}}),(function({savedCustomer:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{customerId:i.customerId,mode:e.mode,...B(e.localData,t!=null?Cn(t):void 0,Wn)}),n.onSubmit()}}}))(ht);function sa(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=F(),{fetchState:s,savedCustomerId:u}=k((d=>Te(d,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,S=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(S),t(En({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerFormPage}),c.jsx(ca,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ra=O((function(t){const e=fe(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(yn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ct);function da(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),Q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Xe({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ra,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(hi(D)),onSortChange:S})]})}const we=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),la=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:we(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=we(s,a),S=s.actionStateByKind.retry?.fetchState==="In-Progress",m=s.actionStateByKind.rollback?.fetchState==="In-Progress",v=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Oe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Le({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||S?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Ne(a)))},onRollback:v?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(bn(a)))}:void 0}}))(kt);function ua(){const t=L(),e=_(),{sessionId:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),[o,s]=r.useState({}),u=k(Me),d=k(he),S=r.useMemo((()=>{const E=J.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),m=we(u,n),v=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(je(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const p=m?.status==="scanning"||m?.status==="importing";r.useEffect((()=>{if(!a||n==null||!p)return;const E=setInterval((()=>{t(je(n)),t(Le({...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`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=v?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportDetailPage,isReady:m!=null&&I!=="Not-Started"}),c.jsx(la,{authParams:S,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const Zn=t=>`invoicing_active_migration:${t}`,re=(t,e)=>{if(t!=null&&t!=="")try{const n=Zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ga=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(se(s)),re(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Ne(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(bn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Et);function ma(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),a=k(Me);r.useEffect((()=>{i&&(t(Ci()),t(xn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ga,{navigate:e,tenantEmailDomain:n,view:a})]})}const va=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:S,sessions:m}=u,v=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||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:p??m.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Oe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(yi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(Ne(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(Ei(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(ki({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(yt);function pa(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),a=k(Sn),o=k(he),s=r.useMemo((()=>{const h=J.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??J.getSignedInUserTenant(n??"")?.companyId,S=k((h=>An(h,d))),m=k(Me),{activeMigrationSessionId:v}=m,p=v??void 0,f=p!=null?m.sessionDetail[p]??m.sessions.find((h=>h.id===p)):void 0;r.useEffect((()=>{i&&(t(Ue()),t(xn()))}),[i,t]),r.useEffect((()=>{if(v!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Zn(y))}catch{return null}})(n);h!=null&&t(se(h))}),[v,t,n]),r.useEffect((()=>{re(n,v)}),[v,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||p==null||!E)return;const h=setInterval((()=>{t(je(p))}),3e3);return()=>clearInterval(h)}),[i,p,E,t]),r.useEffect((()=>{I==="done"&&(t(se(null)),re(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(va,{activeId:p,authParams:s,integrationsView:S,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:m,onBack:()=>{t(se(null)),re(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(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(Dn({action:a,id:i}))},onSaveEdit:a=>{const{coupon:o}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i,mode:"edit",...B(a,{invoice_name:o?.invoiceName,invoice_notes:o?.invoiceNotes,max_redemptions:o?.maxRedemptions,name:o?.name},["invoice_notes"])}),t(xi({data:a,id:i}))}}}))(bt);function fa(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),o=k((I=>bi(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[S,m]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&m(n)}),[n,d]);const v=S===n;r.useEffect((()=>(t(ge({id:n})),()=>{t(ge({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]);const p=r.useCallback((I=>t(Ae({cacheOverride:!0,id:I}))),[t]),f=ne(o.fetchState,o.isFormLoading,n,p);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(Sa,{hasLoadedRecord:v,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const Ia=O((function(t){const e=jn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(Dn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(xt);function ha(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=jn(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(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(en({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(Ai(b)),onSortChange:S})]})}const Ca=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(z({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(z({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(z({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(z({action:"retry",id:i}))}:void 0}}))(Dt);function ka(){const t=L(),e=_(),{case_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),o=k((C=>ji(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,S]=r.useState("idle"),[m,v]=r.useState(!1),[p,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(Li({id:n})),S("idle"),v(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(v(!1),S("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(z({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(_i({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(Ce({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(S("idle"),v(!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((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?m&&o.actionState.fetchState==="Completed"?(n!=null&&t(Pi({id:n})),h()):m&&o.actionState.fetchState==="Error"&&S("failed"):v(!0))}),[n,h,t,d,m,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(At,{initialDraft:p,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const Ea=O((function(t){const e=Ln(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(z({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t($i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(jt);function ya(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=Ln(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(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(nn({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(wi(b)),onSortChange:S})]})}const ba=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(q({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail",mode:"edit",...B(s,{due_date:a?.dueDate?.format("YYYY-MM-DD")??"",notes:(a?.notes??[]).map((u=>u.note)).filter((u=>u!=null&&u!=="")).join(`
|
|
2
|
-
`),po_number:a?.poNumber??""},["notes"])}),t(Fi({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
|
|
3
|
-
`).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(q({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(q({action:"void",invoiceId:i,body:s}))}}}))(Lt);function xa(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),o=k((f=>_n(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,S]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&S(n)}),[n,u]);const m=d===n;r.useEffect((()=>{a&&n!=null&&t(Ri({invoiceId:n}))}),[a,n,t]);const v=r.useCallback((f=>t(Ce({invoiceId:f}))),[t]),p=ne(o.actionState.fetchState,o.fetchState==="In-Progress",n,v);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(ba,{invoiceId:n??"",hasLoadedRecord:m,navigate:e,tenantEmailDomain:i,view:o},p)]})}const Aa=O((function(t){const e=Pn(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(q({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(q({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(wn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(_t);function Da(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=Pn(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(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Aa,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(Ti(A)),t(ye({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}function sn(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),i=Pt(),a=un(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=k($n),S=Oi(i?.loggedInUserRoleMap),m=`/${n}/invoicing`,v=p=>{s(p)};return d==="completed"?c.jsx(H,{to:`${m}/overview`,replace:!0}):d==="settings"&&S?c.jsx(H,{to:`${m}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPromoPage}),c.jsx(Mo,{isAppContentDrawerOpen:o,handleDrawerToggle:v}),c.jsx(wt,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!S,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(Mi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{v(!0)}})]})}const ja=O((function(t,e){const n=Rn(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(Hi({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Vi())}}}))($t);function La(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:S}=k((f=>Rn(f,n??""))),m=`/${i}/invoicing`,v=r.useRef(null);r.useEffect((()=>{t(Ni()),v.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(Ce({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&v.current!==n&&(v.current=n,t(Ui({localData:Bi(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"&&d!=null&&e(`${m}/credits/${encodeURIComponent(d)}`)}),[d,e,S.fetchState,m]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(ja,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const _a=O((function(t){return{invoicingOverview:Fn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingOverviewRefreshed),t(Tn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Rt);function Pa(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>Fn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Tn(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(_a,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const wa=O((function(t){const e=On(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Qi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ft);function $a(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:p,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const R=On(j);return{activeType:R.activeTab,appliedSearch:R.filters.search,appliedSort:R.sort,nextCursor:R.nextCursor,transactionListFetchState:R.fetchState,transactions:R.transactions}}),Q),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const R=y.find((T=>T.id===j)),U=R?.linkedInvoices?.[0]?.invoiceID??R?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const R=y.find((U=>U.id===j))?.customerID;R!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:R,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(R)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(be({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(be({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(wa,{navigate:e,tenantEmailDomain:n,activeType:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(qi(j)),t(be({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const Ra=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 rn(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=F(),o=n!=null&&n!=="",s=k(fe),u=k((C=>zi(C))),d=k(Ki),S=k((C=>_n(C,n??""))),m=S.invoice,v=`/${i}/invoicing`,p=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Gi()),p.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?Ce({invoiceId:n}):yn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&m!=null&&n!=null&&S.fetchState==="Completed"&&p.current!==n&&(p.current=n,t(Yi({contextInvoiceId:n,localData:Wi(m)})))}),[t,m,n,S.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(wn({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(tn({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=d.fetchState,C!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${v}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${v}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,v]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:Ra(C)})))),[s.customers]),h=k((C=>Ji(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,R=Zi.currencySymbol,Mt("0,0.00",j,R)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,R}))),[h]),D=r.useMemo((()=>{if(!o||m==null)return;const C=m.currencyCode??"USD",j=m.amountDue?.amount??0;return{amountDue:Tt("0,0.00",m.amountDue),amountDueValue:j,currencyCode:C,customerName:m.customerName??m.customerID,invoiceId:m.id,invoiceNumber:m.invoiceNumber??m.id}}),[m,o]),b=o?`${v}/invoices/${encodeURIComponent(n??"")}`:`${v}/payments`,A=!o||S.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(Ot,{customers:E,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(tn({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Xi(o?n??void 0:void 0))}})]})}const Xn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Fa=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,estimate:n.estimate,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Bn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(W({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Ie(ve)),t(to({id:i}))},onOpenAddress:()=>{const s=Xn(e.tenantEmailDomain??"",ve,i),u=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onCloseEstimate:()=>{t(Un())},onRequestEstimate:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,{mode:"edit",subscriptionId:i,...B(s,_e(e.editView.subscription))}),t(W({id:i,localData:s})),t(Nn({id:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{mode:"edit",subscriptionId:i,...B(s,_e(e.editView.subscription))}),t(W({id:i,localData:s})),t(Mn({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}}))(Nt);function Ta(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=F(),s=k((y=>Be(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:S}=s,m=s.pageFetchState.fetchState,v=m==="Completed"&&!s.isFormLoading,[p,f]=r.useState(v?i:void 0);r.useEffect((()=>{i!=null&&v&&f(i)}),[i,v]);const I=p===i;ke(o),r.useEffect((()=>{o&&i!=null&&t(eo({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(no({id:y}))),[t]),h=ne(s.fetchState,s.isFormLoading,i,E);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionDetailPage,isReady:v}),c.jsx(Fa,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:S,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const Oa=O((function(t,e){const n=Be(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,estimate:n.estimate,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,savedSubscription:n.subscription,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e;return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(Vn({id:i})),t(Ie(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{t(W({id:i,localData:a}))},onCloseEstimate:()=>{t(Un())},onRequestEstimate:()=>{t(Nn({id:i}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const a=Xn(e.tenantEmailDomain??"",ve,i),o=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onSubmit:()=>{t(Mn({id:i}))}}}),(function({savedSubscription:t,...e},n,i){const a=()=>({mode:e.mode,subscriptionId:i.subscriptionId,...B(e.localData,t!=null?_e(t):void 0)});return{...i,...e,...n,onRequestEstimate:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,a()),n.onRequestEstimate()},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,a()),n.onSubmit()}}}))(Ut);function Ma(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=$(),[o]=Z(),{areTenantIdsInSync:s}=F(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:S}=k((p=>io(p,i))),m=k((p=>Be(p,i).localData));ke(s),r.useEffect((()=>{s&&t(oo({subscriptionId:i}))}),[s,i,t]);const v=r.useRef(!1);return r.useEffect((()=>{v.current||i!=null||u==null||u===""||m.customerId!==""||(v.current=!0,t(W({id:i,localData:{...m,customerId:u}})))}),[u,i,m,t]),r.useEffect((()=>{if(d==="Completed"){const p=S??i,f=p!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(p)}`:`/${a}/invoicing/subscriptions`;e(f),t(Vn({id:i}))}}),[d,S,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(Oa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Na=O((function(t){const e=Hn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Bn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(so({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Bt);function Ua(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Hn(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(on({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(on({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(ao())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(Na,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(co(C)),onSortChange:S})]})}const Ba=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(uo({action:"capture",id:i}))}:void 0}}))(Vt);function Va(){const t=L(),e=_(),{tenantEmailDomain:n,transaction_id:i}=$(),{areTenantIdsInSync:a}=F(),o=k((u=>ro(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(lo({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(Ba,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function et(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=F(),u=k(Ve),d=u.connection?.connected===!0,S=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&S!=="Not-Started"||o(qn()),n&&o(go()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(mo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const Ha={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function te(t){const e=L(),{areTenantIdsInSync:n}=F(),{tenantEmailDomain:i}=$(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:S}=k(vo),{configError:m,configFetchState:v,dunningScheduleActionOptions:p,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Qn),h=k(Ve);et({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(he),D=t==="dunning"||t==="quickbooks",b=y.companyId??J.getSignedInUserTenant(i??"")?.companyId,A=k((P=>An(P,b))),C=po(y.userRole??[]),j=y.tenantId??"",R=J.getSignedInUser(),U={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:j},T=s?.fileId,ie=k((P=>T!=null&&T!==""?So(P,T):void 0)),He=k((P=>T!=null&&T!==""?fo(P,T):void 0)),nt=T!=null&&T!==""&&ie!=null?{[T]:ie}:{},tt=T!=null&&T!==""&&He!=null?{[T]:He}:{};r.useEffect((()=>(e(an()),()=>{e(an())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Ue()))}),[n,e,a]),r.useEffect((()=>{n&&D&&v==="Not-Started"&&e(pe())}),[n,e,v,D]),r.useEffect((()=>{if(!n)return;const P=R?.userId;P!=null&&P!==""&&j!==""&&ze.shouldFetchActiveTenant(j)&&(ze.markActiveTenantFetchStarted(j),e(Io(P,j,R?.zeniSessionId)))}),[n,e,R?.userId,R?.zeniSessionId,j]);const it=p.length>0||f.length>0,ot=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!it&&(v==="Not-Started"||v==="In-Progress"),at=a==="Completed"&&(!D||v==="Completed"),qe=A.externalConnections?.revenue?.find((P=>P.connectionName==="chargebee"))?.connectionId,Ee=de?.invoicingMicroServiceBaseUrl,Qe=Ee!=null&&Ee.length>0?`${Ee}/1.0/webhooks/stripe`:"",K={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:S.fetchState==="In-Progress",onConnectStripe:P=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(Do(P))},onDisconnect:(P,V)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:V,entityId:P,fromScreen:t??"hub"}),e(Ao(j,P,cn(V))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(xo())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const P=y.tenantEmailDomain??i??"";Se.init("/connection/auth",P),Se.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Gn()))},onSaveChargeBeeCredentials:(P,V)=>{qe!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(yo(j,qe,cn("revenue"),bo("chargebee"),{api_key:P,site:V})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Qe};return{authParams:U,deleteFileStatusById:nt,fieldHelp:o,dunningScheduleActionOptions:p,filesEndPoint:de?.fileMicroServiceBaseUrl??"",integrationsSectionProps:K,isInvoicingPageReady:at,isLoading:ot,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&&v==="Error"?m?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Qe,updateFileStatusById:tt,onConnectStripe:K.onConnectStripe,onDeleteFile:P=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(Eo(P,j))},onDisconnectStripe:K.onDisconnectStripe,onEditFileName:(P,V)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(ko(P,V.split(".")[0],j))},onReconnectQBO:K.onReconnectQBO,onRefreshQBO:K.onRefreshQBO,onRetryQboSyncTask:P=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:P,fromScreen:t??"hub"}),e(Kn(P))},onSave:P=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:Object.keys(P).filter((V=>JSON.stringify(P[V])!==JSON.stringify(d?.[V]))),tab:t??"hub"}),e(Co({settings:P,snackbarSection:Ha[t??""]}))},onStartQboBackfill:P=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(zn(P))},updateFilesEntity:P=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(ho({files:P}))}}}function dn({appContent:t}){const e=_(),n=X(),i=L(),{tenantEmailDomain:a}=$(),o=te("branding"),s=k((d=>jo(d)));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&i(Lo())}),[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(w,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ht,{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:d=>{i(wo({localData:d}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const d=`/${a}/invoicing/settings/branding/${Po}/`,S=ee(n.state?.pathnameStackToGoBack,n.pathname);e(d,{state:{pathnameStackToGoBack:S}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"branding"}),i(_o())},updateFilesEntity:o.updateFilesEntity})]})}function qa(){const t=_(),e=te("dunning");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Qa(){const t=_(),e=te("integrations");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Qt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function za(){const t=_(),e=te("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(zt,{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 Ka=["autoCreateItems","closedPeriodVoidAsCreditMemo","customerMatching","isSyncEnabled","syncStartDate","trackingCategoriesEnabled"],Ga=O((function(t){const e=Yn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(Fo({localData:e}))},onReset:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(Ro())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Kn(e))},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(zn(e))}}}))(Kt);function Ya(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),i=k(he),{configFetchState:a,localData:o,savedLocalData:s,saveState:u,settingsFetchState:d}=k(Yn),S=r.useMemo((()=>{return v=o,p=s,[...[...new Set([...Object.keys(v.accountIdByMappingCode),...Object.keys(p.accountIdByMappingCode)])].some((f=>(v.accountIdByMappingCode[f]??"")!==(p.accountIdByMappingCode[f]??"")))?["account_mappings"]:[],...Ka.filter((f=>v[f]!==p[f]))];var v,p}),[o,s]),m=$e(u.fetchState);return r.useEffect((()=>{m==="In-Progress"&&u.fetchState==="Completed"&&e("..")}),[e,m,u.fetchState]),r.useEffect((()=>{d!=="Not-Started"&&d!=="Error"||t(Ue())}),[t,d]),r.useEffect((()=>{a==="Not-Started"&&t(pe())}),[a,t]),et({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Ga,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Se.init("/connection/auth",i.tenantEmailDomain??n??""),Se.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Gn())},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:S,tab:"quickbooks"}),t($o())}})]})}const Wa={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Ja(){const t=un(),e=L(),n=_(),[i,a]=Z(),o=te(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:S,isStripeConnected:m}=k(Qn),v=i.get("tab");return r.useEffect((()=>{if(v==null)return;const p=Wa[v];a({},{replace:!0}),p!=null&&n(p,{replace:!0})}),[v,n,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Gt,{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:m,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(To())}})]})}function ln(){return c.jsxs(ce,{children:[c.jsx(x,{index:!0,element:c.jsx(Ja,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(za,{})}),c.jsx(x,{path:"branding",element:c.jsx(dn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(dn,{appContent:c.jsx(G,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Qa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(qa,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ya,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:"..",replace:!0})})]})}function xc(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=F(),{enableState:a,fetchState:o,status:s}=k($n),u=$e(a.fetchState),d=`/${n}/invoicing`,S=r.useRef(!1),m=k((v=>Ve(v).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||S.current||(S.current=!0,t(pe({cacheOverride:!1}))):t(pe({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&m==="Not-Started"&&t(qn())}),[i,t,m]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(Oo()))}),[u,a.fetchState,d,t,e]),s==null&&o!=="Error"?c.jsx(Yt,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(ce,{children:[c.jsx(x,{path:"promo",element:c.jsx(sn,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ce,{children:[c.jsx(x,{path:"promo",element:c.jsx(sn,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(ln,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ce,{children:[c.jsx(x,{path:"/",element:c.jsx(H,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(Pa,{})}),c.jsx(x,{path:"promo",element:c.jsx(H,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(da,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(sa,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(aa,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(Ua,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(Ma,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(Ta,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"invoices",element:c.jsx(Da,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Xo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(xa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(rn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(La,{})}),c.jsx(x,{path:"payments",element:c.jsx($a,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(rn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Va,{})}),c.jsx(x,{path:"credits",element:c.jsx(ia,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(na,{})}),c.jsx(x,{path:"discounts",element:c.jsx(ha,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Jo,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(fa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(ya,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ka,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Yo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(zo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Vo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(ln,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(No,{})}),c.jsx(x,{path:"data_import",element:c.jsx(ma,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(pa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ua,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{xc as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-DwoS2LTS.js";import{a as g}from"./sentry-BF2EAQwc.js";import{u as F,g as _,h as w,t as M,j as l,N as U}from"./core-Beu9kTtR.js";import{z as r,G as P,O as V,j as A,Q as N,X as Y,Y as G,S as J}from"./index-BfNeAGgC.js";import{fI as K,Uf as Q,UI as R,Uz as W,gl as X,gn as $,UE as q,gY as B,dk as H,UJ as Z,UK as ee}from"./zeni-epic-state-1d5RmIXy.js";import{u as te,n as ne}from"./mui-DEiF_Hb4.js";import{u as ae}from"./useDeviceId-gZ0JJcev.js";import{f as se}from"./analyticsHelper-CnJWG9bB.js";import{t as ie}from"./getLocaleForTenant-YwW4TLUd.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="2a258b7b-a904-4766-ae2a-0c5e178f0cef",t._sentryDebugIdIdentifier="sentry-dbid-2a258b7b-a904-4766-ae2a-0c5e178f0cef")}catch{}})();const T=(t,s)=>t!=null&&t.length>0&&s==="magic_links";function Te(){const t=F(),s=_(),m=w(),[b]=M(),n=b.get("token"),p=b.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=ae(),{otpChallenge:d,twoFAPhoneNumber:z,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:C}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),a=l((e=>e.tenantState.loggedInUser)),o=l((e=>K(e))),k=l((e=>Q(e))),D=r.getSignedInUser(),v=te().mode;g.useEffect((()=>{a?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(R(n,i,f)))}),[n,p,t,i,f,a?.zeniSessionId]),g.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&y!=="Completed"||a?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(a,a.zeniSessionId),r.saveSignedInUserTenants(W(k.tenantsInOrder),a.zeniSessionId),X(a.userId,a.zeniSessionId,o.tenantId),t($(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(q("Completed")),P.updateAppLocaleID(ie(o)),se(a,o,v,void 0,k.tenantsInOrder),B().then((()=>{const e=J();e!=null&&V(e)})),setTimeout((()=>{A.trackLogin(N.Event.loginSuccess,"email",H(o.productSettings))}),2e3))}),[I,S,y,a,o,k,v,s.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(Z(i,c,d))}),[i,d,t,c]),O=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(ee(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(Y,{phoneNumber:z,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:j,onVerifyOtp:O,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&a?.zeniSessionId!=null&&o!=null||D!=null){const e=s.state?.origin??"/";return u.jsx(U,{to:e,state:{...s.state,origin:""}})}if(!T(n,p)||f==null||h==="Error"){const e=s.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(U,{to:e,state:{...s.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&a?.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-DwoS2LTS.js";import{h as r,l as i}from"./core-Beu9kTtR.js";import{ak as n}from"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import"./sentry-BF2EAQwc.js";import"./zeni-epic-state-1d5RmIXy.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="e1fe4b0b-a509-4443-892f-577d1dfd5036",o._sentryDebugIdIdentifier="sentry-dbid-e1fe4b0b-a509-4443-892f-577d1dfd5036")}catch{}})();const a=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-DwoS2LTS.js";import ut from"./NotFoundScreen-DK36JFcR.js";import{a as k}from"./sentry-BF2EAQwc.js";import{h as ht,g as pt,i as kt,u as gt,j as S,l as St,n as bt,o as O}from"./core-Beu9kTtR.js";import{cB as It,Uj as Y,fI as z,h5 as Tt,Un as b,a1i as Q,Ut as m,Uh as y,AD as F,Gk as Ct,a1j as At,Ug as yt,Uv as Et,AI as _t,a1k as j,br as $,gk as x,AM as X,a1l as Nt,cN as Bt,cG as wt}from"./zeni-epic-state-1d5RmIXy.js";import{ao as xt,c as Ut,W as vt,A as Dt,aq as Gt,dI as Rt,p as B,dJ as Pt,w as Mt,dK as jt,i as $t,a2 as Ft}from"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-B4mYX3VH.js";import{u as qt}from"./useTaskManagerAccess-IxEInAYM.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="f26dc158-724f-4e70-9e17-e711be4947a7",t._sentryDebugIdIdentifier="sentry-dbid-f26dc158-724f-4e70-9e17-e711be4947a7")}catch{}})();const Lt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),Wt=St((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=z(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:v}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(j([a],$())));let i=`/${h}/${r[1]}`;const T=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(Q(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(F("task_manager","dashboard",d))}else v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(j([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Lt(o,I).then((()=>{t(j(o,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=Ft(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt(jt)),Ht=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=Ut(),[I,v]=k.useState(!1),a=S((e=>Y(e))),s=S((e=>z(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Gt({isDataReady:!0});const Z=Tt(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),q=S((e=>b(e).currentTab)),D=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),G=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:w,isLoading:E,hasFetchedAll:C,isFetchingMore:R,fetchMore:ot}=mt(),{threads:L,isLoading:W,fetchMore:H,isFetchingMore:J,hasFetchedAll:K}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(q!==c&&c!=null&&o(Q(c)),c==null){const e=`../${q}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&w!=null){const e=`dashboard_${s.companyId}`,p=w.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(y({unreadCount:p},"comments"))}}),[E,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(F("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=E||R===!0||C!==!0||E||R===!0||C!==!0;k.useEffect((()=>{P&&G!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||G!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,G]),k.useEffect((()=>{o(y({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(v(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&W===!1&&w!=null&&L!=null){const e=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===e)).filter((u=>Pt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=L.find((dt=>{return dt.id===((U=u).kind==="thread"?U.threadId:"subjectId"in U?U.subjectId:void 0);var U}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(J||K===!0||H==null||H(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,R,J,C,K,W,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if($t(p)){const A=yt(p.mode);if(A==="dashboard"&&o(y({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),o(F("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=qt(f);return N.jsx(Wt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(O,{path:"/:selectedTab",element:N.jsx(Ht,{})}),N.jsx(O,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-DwoS2LTS.js";import{a as r}from"./sentry-BF2EAQwc.js";import{u as A,g as j,j as o,N as C}from"./core-Beu9kTtR.js";import{UW as P,fI as x,gp as z,UX as D,UY as M,UZ as R,U_ as L,pW as k,TB as N}from"./zeni-epic-state-1d5RmIXy.js";import{z as h,af as I}from"./index-BfNeAGgC.js";import"./mui-DEiF_Hb4.js";import"./recharts-MD3a-5g4.js";import"./analytics-k_LuQgHs.js";import"./plaid-UFuUhVwC.js";import"./dnd-BD4CdaiB.js";import"./stripe-cKAAJElX.js";import"./lottie-BGwNmPax.js";import"./lexical-ae4wZrjx.js";import"./pdf-CuKXyKjy.js";import"./utils-CaDQp8mU.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="1983f4bc-c445-4053-a2f1-166e1326ea81",n._sentryDebugIdIdentifier="sentry-dbid-1983f4bc-c445-4053-a2f1-166e1326ea81")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>P(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),p=h.isSignedIn(),a=h.getSignedInUser(),f=o((e=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),U=o(M),c=o(R),[v,S]=r.useState(null),[b,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&a!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[p,a,d,n]),r.useEffect((()=>{c!=null&&c!==""&&(window.location.href=c)}),[c]);const _=r.useMemo((()=>{if(f?.tenantId!=null)return f.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[f?.tenantId,l]),u=v??_;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):p?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:S,approveError:b??U,isApproving:y==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&a!=null&&u!=null&&n(N(a.userId,a.zeniSessionId??void 0,u,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(C,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
|