@zeniai/web-app-ui 5.1.62-dev → 5.1.63-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/assets/AddressRoutes-DiGYiZdH.js +1 -0
  2. package/dist/assets/{AddressScreen-D7DCNUGo.js → AddressScreen-GAHyIX-c.js} +2 -2
  3. package/dist/assets/{AiCfoScreen-Bv6DgXwH.js → AiCfoScreen-D2sAwMZS.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-DxIJLeU6.js → BillPayApprovalRoutes-BglCJxi-.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CxAjptk9.js → BillPayRoutes-7zp9D6x8.js} +17 -17
  6. package/dist/assets/{BusinessVerificationPageScreen-HLhTZBjl.js → BusinessVerificationPageScreen-DMq3tKTs.js} +2 -2
  7. package/dist/assets/CardsAiCfoScreen--ED2OEzt.js +14 -0
  8. package/dist/assets/ChargeCardRoutes-CMdGvjPJ.js +71 -0
  9. package/dist/assets/CompanyPassportScreen-DMJdNz2u.js +1 -0
  10. package/dist/assets/ConnectionAuthScreen-CC4jwpJn.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-Bqsz81r8.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-B4tFhrDj.js → CustomerOnboardingRoutes-DfaM8hGj.js} +6 -6
  13. package/dist/assets/{DashboardRoutes-uPgpLI1W.js → DashboardRoutes-BCVeePc3.js} +3 -3
  14. package/dist/assets/{DefaultTenantHome-Bhp_uriR.js → DefaultTenantHome-BKFAUyCt.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-YZRErnfJ.js → DomesticWireDetailScreen-WRSPX-4X.js} +4 -4
  16. package/dist/assets/DrawerScreen-DaMuYUCn.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-Bcvb-t4n.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-ChVJkArc.js → ExpenseAutomationRoutes-BMNILnav.js} +4 -4
  19. package/dist/assets/{FeaturePreviewScreen-kp5WtNsg.js → FeaturePreviewScreen-D4Ah53J7.js} +1 -1
  20. package/dist/assets/HubSpotOAuthCallbackScreen-DRjMsB35.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-Dtjlc8Bf.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-D1bS19KK.js +12 -0
  23. package/dist/assets/MobileAppDrawer-PDN1hPUR.js +1 -0
  24. package/dist/assets/NotFoundScreen-CKyavEYX.js +1 -0
  25. package/dist/assets/{NotificationRoutes-B06j6V42.js → NotificationRoutes-BP3RNHOU.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-CWy6K8Uy.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-BCTBlqwg.js +1 -0
  28. package/dist/assets/PeopleRoutes-84yTwmWw.js +22 -0
  29. package/dist/assets/PerformanceRoutes-BQUXWKZE.js +1 -0
  30. package/dist/assets/{Preview-lrK4F27Y.js → Preview-C7zW6Q7F.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-Cx74YOuE.js → QBOConnectionScreen-BDzJBSaJ.js} +1 -1
  32. package/dist/assets/{ReferralListScreen-G8WgDfU8.js → ReferralListScreen-CXBkdn17.js} +2 -2
  33. package/dist/assets/ReimbursementApprovalRoutes-DFKDTo2d.js +1 -0
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-s9Cc-PAW.js → ReimbursementApprovalRuleDetailScreen-77M2HLZ2.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes-vHQ3hpWm.js → ReimbursementRoutes-YhP6hHRt.js} +7 -7
  36. package/dist/assets/{ReportsRoutes-DIUc8s5q.js → ReportsRoutes-wzqHii7q.js} +1 -1
  37. package/dist/assets/RewardsRoutes-DfmbXNc8.js +1 -0
  38. package/dist/assets/ScreenRoutes-DvRF1Ugr.js +2 -0
  39. package/dist/assets/{SettingsRoutes-B4g8CJnG.js → SettingsRoutes-xpOSQOkw.js} +7 -7
  40. package/dist/assets/{SetupPagesScreen-BkPb95y9.js → SetupPagesScreen-CrjLDbOm.js} +5 -5
  41. package/dist/assets/SignInScreen-Ck9zXfCr.js +1 -0
  42. package/dist/assets/SignOutScreen-DSoi64zr.js +9 -0
  43. package/dist/assets/{TaskListScreen-DGOHeeuZ.js → TaskListScreen-Cs7VLiUm.js} +2 -2
  44. package/dist/assets/TaskRoutes-dkq9ikjL.js +9 -0
  45. package/dist/assets/{TransactionDetailRoutes-BXwhj2nX.js → TransactionDetailRoutes-2AtDo3dT.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-DUZV5JDK.js → TransactionDetailScreen-CWpk0UU1.js} +2 -2
  47. package/dist/assets/{TransactionListRoutes-CDDcflri.js → TransactionListRoutes-lHRZBvxi.js} +1 -1
  48. package/dist/assets/{TreasuryRoutes-CZyF8G2k.js → TreasuryRoutes-C4iGPRK3.js} +6 -6
  49. package/dist/assets/{VendorsRoutes-B0mGOZoL.js → VendorsRoutes-7KkgbfcW.js} +27 -27
  50. package/dist/assets/WiseConfirmationScreen-DshLBzeW.js +12 -0
  51. package/dist/assets/{ZeniAccountRoutes-BeZsG6M5.js → ZeniAccountRoutes-pWTshbAJ.js} +10 -10
  52. package/dist/assets/{ZeniAccountStatementScreen-CU5lpB3Y.js → ZeniAccountStatementScreen-DEwEWZ2Q.js} +2 -2
  53. package/dist/assets/{accountMappingHelper-CSvCSQoY.js → accountMappingHelper-BPzhOzDQ.js} +1 -1
  54. package/dist/assets/{analytics-DCrhd8oB.js → analytics-Bqx0zRxd.js} +1 -1
  55. package/dist/assets/{analyticsHelper-CQXeRvKo.js → analyticsHelper-d524teZu.js} +1 -1
  56. package/dist/assets/{core-DmAftQ4g.js → core-Bv1T7LZC.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-C70tsXnj.js → decodeURIComponentSafe-CgJ-EbJc.js} +1 -1
  58. package/dist/assets/{dnd-3F1D24DQ.js → dnd-CrtLd1r-.js} +1 -1
  59. package/dist/assets/{empty-CDCfsLV4.js → empty-BGU_c4p_.js} +1 -1
  60. package/dist/assets/{empty-B3YzB_Zh.js → empty-DZLujeFc.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-CFNhZ55F.js → emptyVideoElement-D0DWhAqS.js} +1 -1
  62. package/dist/assets/epic-C0x_kZHk.js +2 -0
  63. package/dist/assets/getLocaleForTenant-DTwWZ3TG.js +1 -0
  64. package/dist/assets/{index-EyTFjAAZ.js → index-B-VkC3pW.js} +1 -1
  65. package/dist/assets/{index-DPrh5XVZ.js → index-BcMhlMw0.js} +1 -1
  66. package/dist/assets/{index-BJ17Ijlb.js → index-Bf0yAk1h.js} +2 -2
  67. package/dist/assets/{index-B2dyNLwa.js → index-BfDh5m3J.js} +1 -1
  68. package/dist/assets/{index-DniSRtks.js → index-Bgxmla6x.js} +1 -1
  69. package/dist/assets/{index-BpGaPboJ.js → index-C7MHnpYf.js} +1 -1
  70. package/dist/assets/{index-DsVH62ZK.js → index-CwcEF-q7.js} +10178 -10150
  71. package/dist/assets/{index-BTn1WqO7.js → index-Dvxx9UaB.js} +1 -1
  72. package/dist/assets/{lexical-PVlNGkpS.js → lexical-DtmspfR6.js} +1 -1
  73. package/dist/assets/{liveblocks-evjZPqs_.js → liveblocks-DC3GaKoW.js} +1 -1
  74. package/dist/assets/{lottie-CmTLY-9t.js → lottie-BAdftm7g.js} +1 -1
  75. package/dist/assets/{mui-PcDpEhsm.js → mui-VYhJrGDQ.js} +1 -1
  76. package/dist/assets/{pathToGoBack-Dt8AwbCr.js → pathToGoBack-BPhnwklb.js} +1 -1
  77. package/dist/assets/{pdf-CbXlPYUs.js → pdf-DyfSqkK5.js} +4 -4
  78. package/dist/assets/{pdf-lib-CU5FhbnZ.js → pdf-lib-CPh8no6v.js} +1 -1
  79. package/dist/assets/{plaid-DSnXUEUK.js → plaid-BlhDSPsk.js} +1 -1
  80. package/dist/assets/{pusher-Cwyg5VVV.js → pusher-DGAKVhUw.js} +1 -1
  81. package/dist/assets/{react-CJ1HWQ69.js → react-B1_zGwIA.js} +1 -1
  82. package/dist/assets/{react-EoTfQhVb.js → react-BJZHoUnV.js} +1 -1
  83. package/dist/assets/{react-ymB_cbpE.js → react-D4kHPPtw.js} +1 -1
  84. package/dist/assets/{react-CY1ZQ6op.js → react-D_wg-5Ag.js} +1 -1
  85. package/dist/assets/{react-Cf5hLxOq.js → react-EkeFt_9c.js} +1 -1
  86. package/dist/assets/{react-CDqmK3AW.js → react-mFsTSWE1.js} +1 -1
  87. package/dist/assets/{recharts-CgEqsrFw.js → recharts-D979ncoh.js} +1 -1
  88. package/dist/assets/routePaths-CjJlLbxf.js +1 -0
  89. package/dist/assets/{sentry-CCZGmBkl.js → sentry-CuaXjR5n.js} +1 -1
  90. package/dist/assets/{url-BKaTO14S.js → url-73U0aVt0.js} +1 -1
  91. package/dist/assets/{url-9kg5cual.js → url-DXrWvdUh.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BzB3gTK8.js → useAiCfoDashboardSuggestedQuestionsChips-BQUVbUQb.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-XSnEPSCB.js +1 -0
  94. package/dist/assets/useCashManagementBanner-Cqvytrqk.js +1 -0
  95. package/dist/assets/{useChargeCardPusherEvents-BOkZNaGv.js → useChargeCardPusherEvents-DWEn28bl.js} +1 -1
  96. package/dist/assets/{useDeviceId-DGJPBja9.js → useDeviceId-BVyTAih4.js} +1 -1
  97. package/dist/assets/useEmailConnectResultRefresh-iMxOBvVh.js +1 -0
  98. package/dist/assets/{useInitialThreadRequest-D9ebiXdA.js → useInitialThreadRequest-BsceBU6n.js} +1 -1
  99. package/dist/assets/{utils--mWNe9J7.js → utils-DPYDOv00.js} +1 -1
  100. package/dist/assets/{withTransactionSidePanel-iGXE6khP.js → withTransactionSidePanel-BzY2xiGY.js} +2 -2
  101. package/dist/assets/{zeni-epic-state-vtQ66nN6.js → zeni-epic-state-DuQa9FMz.js} +3 -3
  102. package/dist/index.html +1 -1
  103. package/package.json +2 -2
  104. package/dist/assets/AddressRoutes-DvuqFlm5.js +0 -1
  105. package/dist/assets/CardsAiCfoScreen-BQXIEsXX.js +0 -14
  106. package/dist/assets/ChargeCardRoutes-CF9hoDo5.js +0 -71
  107. package/dist/assets/CompanyPassportScreen-Dd-P8T6z.js +0 -1
  108. package/dist/assets/ConnectionAuthScreen-BWQPD0qS.js +0 -11
  109. package/dist/assets/CustomerOnboardingAuthScreen-BycVZ7K6.js +0 -1
  110. package/dist/assets/DrawerScreen-BqYmVuny.js +0 -1
  111. package/dist/assets/EntityDetailRoutes-DbpAgwXS.js +0 -1
  112. package/dist/assets/HubSpotOAuthCallbackScreen-BAfTUuIq.js +0 -1
  113. package/dist/assets/MagicLinkRoutes-CGh8IMWW.js +0 -72
  114. package/dist/assets/MagicLinkSignInScreen-BFMyglUM.js +0 -12
  115. package/dist/assets/MobileAppDrawer-BuakBUGx.js +0 -1
  116. package/dist/assets/NotFoundScreen-AsC21qGx.js +0 -1
  117. package/dist/assets/OAuthConsentScreen-B6euKfvQ.js +0 -1
  118. package/dist/assets/PandLWithForecastRoutes-DfEV7guz.js +0 -1
  119. package/dist/assets/PeopleRoutes-qz_hXV4C.js +0 -22
  120. package/dist/assets/PerformanceRoutes-v5FcQW2N.js +0 -1
  121. package/dist/assets/ReimbursementApprovalRoutes-yvcY1FyR.js +0 -1
  122. package/dist/assets/RewardsRoutes-lnm6cAkX.js +0 -1
  123. package/dist/assets/ScreenRoutes-CAtz09zv.js +0 -2
  124. package/dist/assets/SignInScreen-Dhh5qz65.js +0 -1
  125. package/dist/assets/SignOutScreen-3sXSL_QM.js +0 -9
  126. package/dist/assets/TaskRoutes-CDomkVrp.js +0 -9
  127. package/dist/assets/WiseConfirmationScreen-B3-wTx7l.js +0 -12
  128. package/dist/assets/epic-Bmb0p0Me.js +0 -2
  129. package/dist/assets/getLocaleForTenant-C55KVru2.js +0 -1
  130. package/dist/assets/routePaths-Dq5U7lhs.js +0 -1
  131. package/dist/assets/useAskAiCfoHostNavButtonProps-uVGdd0zj.js +0 -1
  132. package/dist/assets/useCashManagementBanner-BB3WgTJ-.js +0 -1
  133. package/dist/assets/useEmailConnectResultRefresh-FRZ2xd4V.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-DsVH62ZK.js"></script><link rel="modulepreload" crossorigin href="/assets/sentry-CCZGmBkl.js"><link rel="modulepreload" crossorigin href="/assets/core-DmAftQ4g.js"><link rel="modulepreload" crossorigin href="/assets/zeni-epic-state-vtQ66nN6.js"><link rel="modulepreload" crossorigin href="/assets/mui-PcDpEhsm.js"><link rel="modulepreload" crossorigin href="/assets/analytics-DCrhd8oB.js"><link rel="modulepreload" crossorigin href="/assets/utils--mWNe9J7.js"><link rel="stylesheet" crossorigin href="/assets/index-BUmr5maU.css"></head><body style="margin:0"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div class="app-shell-loader" id="app-shell-loader"><div class="app-shell-sidebar"><div class="app-shell-sidebar-group"><div class="app-shell-bar zeni-logo" style="width:96px;height:20px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:78px;height:16px"></div><div class="app-shell-bar" style="width:46px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:110px;height:16px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div></div><div class="app-shell-sidebar-group"><div class="app-shell-bar" style="width:55px;height:12px"></div><div class="app-shell-bar" style="width:84px;height:16px"></div><div class="app-shell-bar" style="width:64px;height:16px"></div></div></div><div class="app-shell-main"><div class="app-shell-navbar"><div class="app-shell-bar" style="width:106px;height:27px"></div><div class="app-shell-bar" style="width:111px;height:32px"></div></div><div class="app-shell-logo"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.768 0.0270284C16.571 -0.055168 16.348 0.0572476 16.2913 0.267574C16.2713 0.342517 16.2489 0.417461 16.2253 0.491196C16.0094 1.15723 15.6459 1.76645 15.148 2.27776C14.3056 3.14203 13.1847 3.61949 11.9918 3.6207H11.9883C10.7978 3.6207 9.67689 3.14565 8.83445 2.2838C8.33653 1.7737 7.97077 1.16448 7.75367 0.499657C7.73007 0.425922 7.70765 0.350979 7.68641 0.276035C7.62978 0.065709 7.40678 -0.0454978 7.20974 0.0366985C6.05463 0.522624 4.98565 1.17899 4.0323 1.97436C3.91195 2.07468 3.87301 2.24512 3.93083 2.39259C3.9792 2.51589 4.03112 2.63797 4.08539 2.75764C4.51133 3.70894 5.10364 4.5853 5.84815 5.34682C7.48937 7.0246 9.66863 7.9493 11.9871 7.9493H11.9954C14.3162 7.94689 16.4978 7.01855 18.1379 5.33595C18.8812 4.57321 19.4711 3.69564 19.8959 2.74434C19.9502 2.62347 20.0009 2.50138 20.0493 2.37809C20.1071 2.23062 20.0682 2.06018 19.9478 1.95985C18.9933 1.16569 17.9231 0.511745 16.768 0.0270284Z"/><path d="M19.9102 21.2422C19.4843 20.2933 18.8931 19.4194 18.151 18.6603C16.5086 16.9801 14.3223 16.053 12.0038 16.0578C8.50304 16.0614 5.48371 18.1961 4.11031 21.2603C4.05722 21.38 4.0053 21.5009 3.95575 21.623C3.89675 21.7704 3.93569 21.9421 4.05722 22.0436C5.01175 22.8366 6.08073 23.4893 7.23466 23.9728C7.4317 24.055 7.65352 23.9438 7.71134 23.7335C7.73139 23.6573 7.75381 23.5836 7.77859 23.5086C8.37207 21.6979 10.0416 20.3888 12.0073 20.3864H12.012C13.2025 20.3864 14.3234 20.8614 15.1659 21.7233C15.6626 22.231 16.026 22.8378 16.2431 23.5002C16.2679 23.5739 16.2903 23.6489 16.3104 23.7238C16.3682 23.9341 16.59 24.0453 16.787 23.9619C17.9422 23.476 19.01 22.8209 19.9633 22.0255C20.0837 21.9252 20.1226 21.7535 20.0648 21.606C20.0164 21.4828 19.9645 21.3631 19.9102 21.2422Z"/><path d="M0.132148 10.1666C0.158105 9.98769 0.305591 9.85352 0.482575 9.85352L23.5093 9.81726C23.6863 9.81726 23.8338 9.95022 23.8609 10.1291C23.9518 10.7347 23.999 11.3548 23.999 11.9858C24.0001 12.6131 23.9541 13.2284 23.8668 13.8292C23.8408 14.0081 23.6934 14.1422 23.5164 14.1422L0.489654 14.1773C0.312671 14.1773 0.165185 14.0443 0.138047 13.8654C0.0471956 13.2598 0 12.6397 0 12.0088C0 11.3826 0.0448358 10.7673 0.132148 10.1666Z"/></svg></div></div></div></body></html>
1
+ <!DOCTYPE html><html lang="en"><head><meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"><meta http-equiv="expires" content="0"><meta http-equiv="pragma" content="no-cache"><meta charset="UTF-8"><link rel="icon" type="image/svg+xml" href="/assets/favicon-D56XvgAH.ico"><meta name="ROBOTS" content="NOINDEX, NOFOLLOW"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"><meta name="theme-color" content="#000000"><meta name="description" content="Zeni - Modern Finance Team For Startups"><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&family=Manrope:wght@200..800&display=swap"><link rel="apple-touch-icon" href="/assets/logo192-CqcTe-t4.png"><link rel="manifest" href="/assets/manifest-icT4lOF5.json"><title>Zeni - Modern Finance Team For Startups</title><script src="/theme-detect.js"></script><style>:root{--logo-color-from:#D4DCDD;--logo-color-to:#E9F0F0;--bar-color-from:#E9F0F0;--bar-color-to:#D4DCDD;--sidebar-bg:#F3F7F7;--main-bg:#FAFCFC;--divider-color:#D4DCDD}html{background-color:#f3f7f7}html[data-theme=dark]{background-color:#1b1c1c;--logo-color-from:#545B5C;--logo-color-to:#3E4343;--bar-color-from:#3E4343;--bar-color-to:#545B5C;--sidebar-bg:#1B1C1C;--main-bg:#202222;--divider-color:#545B5C}.app-shell-loader{position:fixed;inset:0;display:flex;background-color:var(--sidebar-bg);z-index:9999}.app-shell-sidebar{width:210px;flex-shrink:0;background-color:var(--sidebar-bg);padding:16px 16px 0;display:flex;flex-direction:column;gap:36px;border-right:1px solid var(--divider-color);box-sizing:border-box}.app-shell-sidebar-group{display:flex;flex-direction:column;gap:10px}.app-shell-bar{height:10px;border-radius:5px;background-color:var(--bar-color-from);animation:app-shell-bar-shimmer 1.6s linear infinite}.app-shell-navbar{height:56px;display:flex;flex-direction:row;border-bottom:1px solid var(--divider-color);padding:0 32px;align-items:center;justify-content:space-between;box-sizing:border-box}@keyframes app-shell-bar-shimmer{0%,100%{background-color:var(--bar-color-from)}50%{background-color:var(--bar-color-to)}}.app-shell-main{flex:1;background-color:var(--main-bg)}.app-shell-logo{display:inline-flex;width:100%;height:calc(100vh - 56px);justify-content:center;align-items:center}.app-shell-logo svg path{animation:app-shell-color-cycle 1.6s linear infinite}@keyframes app-shell-color-cycle{0%,100%{fill:var(--logo-color-from)}50%{fill:var(--logo-color-to)}}@media (max-width:899px){.app-shell-sidebar{display:none}.app-shell-main{background-color:var(--sidebar-bg)}}</style><noscript><style>.app-shell-loader{display:none}</style></noscript><script async type="module" crossorigin src="/assets/index-CwcEF-q7.js"></script><link rel="modulepreload" crossorigin href="/assets/sentry-CuaXjR5n.js"><link rel="modulepreload" crossorigin href="/assets/core-Bv1T7LZC.js"><link rel="modulepreload" crossorigin href="/assets/zeni-epic-state-DuQa9FMz.js"><link rel="modulepreload" crossorigin href="/assets/mui-VYhJrGDQ.js"><link rel="modulepreload" crossorigin href="/assets/analytics-Bqx0zRxd.js"><link rel="modulepreload" crossorigin href="/assets/utils-DPYDOv00.js"><link rel="stylesheet" crossorigin href="/assets/index-BUmr5maU.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.1.62-dev",
3
+ "version": "5.1.63-dev",
4
4
  "files": [
5
5
  "dist/**/*"
6
6
  ],
@@ -29,7 +29,7 @@
29
29
  "@stripe/stripe-js": "^4.4.0",
30
30
  "@zeniai/client-analytics": "2.0.23",
31
31
  "@zeniai/client-epic-state": "5.1.6",
32
- "@zeniai/web-components": "4.1.82",
32
+ "@zeniai/web-components": "4.1.83",
33
33
  "color": "3.1.3",
34
34
  "cross-fetch": "^4.0.0",
35
35
  "crypto-js": "4.2.0",
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-evjZPqs_.js";import{A as d}from"./AddressScreen-D7DCNUGo.js";import i from"./NotFoundScreen-AsC21qGx.js";import"./sentry-CCZGmBkl.js";import{o as s,p as r}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./index-DsVH62ZK.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,14 +0,0 @@
1
- import{j as g}from"./liveblocks-evjZPqs_.js";import{a as l}from"./sentry-CCZGmBkl.js";import{u as pe,h as fe,g as he,j as M,i as Ce,n as Se}from"./core-DmAftQ4g.js";import{V as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,x as we,c as V,df as H,dp as Ee,O as ke,e as Ae,a7 as Te,di as xe,dj as Ue,a2 as Oe,dm as _e,b4 as ve,dn as Qe}from"./index-DsVH62ZK.js";import{gj as Fe,eV as G,eW as Ve,fn as $e,iI as je,iE as De,eX as B,g4 as Le,fZ as Re,g1 as N,g5 as qe,g6 as Me,g7 as He,g8 as Be,g9 as Ne}from"./zeni-epic-state-vtQ66nN6.js";import{D as ze,n as j,P as We,S as Ge}from"./mui-PcDpEhsm.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="df46d98c-fdfd-40b9-88da-518b74daf56e",e._sentryDebugIdIdentifier="sentry-dbid-df46d98c-fdfd-40b9-88da-518b74daf56e")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function $(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const n=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&n.uiState.currentChatSessionId==null,aiCfoView:n,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Oe}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:n,currentTenant:c,userId:d,navigate:m,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,h=n.state?.referrer,p=h===Y?Z(i):$(i);return{onEventReceived:(o,t)=>{if(o===K&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,C=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);C!=="answer"?V.trackAICFOChatResponseGenerated(C,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:C,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(o,t,s,C)=>{o&&ve(e,o,t,f,E,d,C,s,U)},updateCurrentInput:o=>{e(N(o))},onStopSubmit:()=>{},onUpdateScrollYOffset:o=>{e(qe(o))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...n.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(n.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{f!=null&&e(Re()),m(function(o){return`/${o}/${X}`}(i),{state:{...n.state}})},onToggleCotCollapsed:(o,t)=>{e(Le({questionAnswerId:o,isCollapsed:t}))},..._e(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m($(i),{state:{...n.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...n.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),n=pe(),c=fe(),d=he(),[m,f]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{n(Fe())},[n]);const i=M(r=>G(r)),h=ye.getSignedInUser(),{session_id:p}=Ce(),o=M(r=>Ve(r)),t=i.uiState.currentChatSessionId,s=o.tenantEmailDomain,{handleUploadPromoClose:C,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,O]=l.useState(null),[ne,_]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(O(u),_(P),v.current=!0)},[u,P]);const oe=l.useCallback(()=>{O(null),_(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=o.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,O(r),_(w),v.current=!1}},[S]);const{visitedSessions:D}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,L=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&n($e({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:D.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[D]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&n(je())},[Q,F,n]),l.useEffect(()=>{t!=null&&L!=="In-Progress"&&R&&h!=null&&Q==="Completed"&&!F&&n(De(t,h.userId))},[L,R,t,h,n]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:V,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>f(!0),userId:h.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:o,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:oe,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:C,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):$(s),{state:{...d.state}})},onCompleteClick:()=>{S||o.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),n(B(o.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>f(!1),onCompleteClick:()=>{S||o.userRoleId==null||n(B(o.userRoleId)),f(!1)}})})})]})},Je=j(Ge)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,et=j.div`
6
- flex: 1 1 auto;
7
- display: flex;
8
- flex-direction: column;
9
- min-height: 0;
10
- width: 100%;
11
- `,tt=j(We)`
12
- box-shadow: ${({theme:e})=>e.colors.elevation2};
13
- color: ${({theme:e})=>e.colors.grey4};
14
- `;export{St as default};
@@ -1,71 +0,0 @@
1
- import{j as c}from"./liveblocks-evjZPqs_.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as ba,s as Dt,n as De,t as In,o as es,p as se}from"./core-DmAftQ4g.js";import{bt as Pe,RR as as,RS as ts,eY as un,RT as kn,f5 as En,RU as An,RV as Dn,RW as _n,RX as Pn,f6 as wn,f7 as vn,RY as Tn,fh as Fn,fi as $a,RZ as xn,R_ as ns,fb as rs,fa as ss,R$ as cs,B$ as Bn,fk as ca,S0 as os,S1 as is,e_ as ds,eZ as ls,fw as ze,fd as Rn,fc as Ln,S2 as us,fe as ms,Bw as Cs,Bv as ps,Bz as hs,BB as fs,fp as gs,eV as On,S3 as Ss,S4 as bs,fu as Un,S5 as ys,fv as bt,BH as Is,BE as ks,eW as fe,S6 as Qa,fz as we,fA as ve,fB as Te,gu as oa,cv as ia,S7 as da,S8 as _t,uO as za,kD as Wa,S9 as Ya,Cf as ka,Ch as Qe,Ci as Pt,kt as jn,Sa as la,C3 as _a,Sb as Es,Sc as As,C6 as Ja,Sd as Ds,Qc as Xa,fg as Mn,Cc as ga,hT as _s,Se as Nn,Sf as ua,bo as Ps,Sg as ws,gf as et,ge as at,CM as vs,gd as tt,PU as Ts,Sh as Vn,co as Hn,cQ as Fs,Qb as wa,Dl as Gn,Si as mn,CX as Pa,Sj as $n,Dm as xs,QB as Bs,Dn as Rs,Es as Ls,u9 as Os,Em as Us,Sk as js,Cg as ra,Sl as Ms,Sm as Ns,Sn as Vs,So as Hs,Sp as Gs,Sq as wt,Sr as $s,Cx as zn,Cq as zs,Ss as Ws,gw as Ys,CG as Wn,CK as Yn,gv as Zs,St as Ks,D7 as Zn,Su as qs,Sv as Qs,Sw as Js,CI as Kn,Ct as qn,C9 as Qn,CC as Jn,CA as Xn,CE as Xs,Sx as er,Sy as ec,fr as ac,fs as tc,ft as nc,Sz as nt,fl as ar,cR as vt,SA as rc,SB as sc,SC as cc,SD as oc,CS as yt,De as ic,Da as dc,CO as lc,Dc as uc,D2 as mc,D4 as Cc,SE as tr,Dk as Ga,Kb as pc,SF as hc,SG as fc,SH as gc,SI as nr,SJ as Sc,DH as bc,CW as rr,CR as je,CV as yc,SK as Ic,SL as kc,C0 as Ec,SM as sr,ff as cr,SN as Ac,C2 as Dc,C1 as Cn,SO as _c,SP as Pc,SQ as wc,MI as vc,SR as Tt,SS as Tc,xO as or,lb as Fc,hJ as xc,DM as Bc,ST as ir,f2 as Rc,f3 as Lc,SU as Oc,di as Uc,fj as jc,DC as Mc,Dw as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,LV as $c}from"./zeni-epic-state-vtQ66nN6.js";import{I as Fe,cp as dr,p as _e,cq as lr,cr as ur,cs as zc,O as Xe,_ as Ft,ct as Wc,cu as Yc,V as mr,a as Cr,Y as pr,q as ye,W as le,U as Z,ar as ya,cv as hr,cw as Zc,cx as Kc,z as re,B as va,ce as rt,cy as qc,cz as Qc,cA as Jc,Z as Ta,aQ as We,br as xt,cB as Xc,y as Fa,i as st,m as Bt,c as J,a7 as ct,cC as eo,bE as Sa,cD as It,cE as ao,x as Rt,cF as to,au as fr,a2 as kt,cG as no,X as gr,e as Sr,cH as ro,cI as so,cJ as co,cK as oo,cL as io,cM as lo,o as Za,cN as uo,cO as mo,cP as pt,v as Co,cQ as po,cR as ho,cS as fo,cT as go,cU as So,a9 as bo}from"./index-DsVH62ZK.js";import{n as Ne,D as br,S as yo}from"./mui-PcDpEhsm.js";import{a as r}from"./sentry-CCZGmBkl.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-uVGdd0zj.js";import{M as Ie}from"./MobileAppDrawer-BuakBUGx.js";import{d as Lt}from"./recharts-CgEqsrFw.js";import{g as Ae,a as Ba,b as yr,c as xe,d as Be,e as Je,f as ea,h as aa,A as Io,i as Ot,P as ko,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Eo,o as Er,p as Ao,S as pn}from"./SetupPagesScreen-BkPb95y9.js";import{u as Ar}from"./useInitialThreadRequest-D9ebiXdA.js";import ot from"./NotFoundScreen-AsC21qGx.js";import{u as jt}from"./useChargeCardPusherEvents-BOkZNaGv.js";import{n as hn}from"./utils--mWNe9J7.js";import{t as Do}from"./AddressScreen-D7DCNUGo.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./analyticsHelper-CQXeRvKo.js";import"./routePaths-Dq5U7lhs.js";import"./BusinessVerificationPageScreen-HLhTZBjl.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]="93e948dd-5224-4ee3-95b4-acc5a3a0e959",e._sentryDebugIdIdentifier="sentry-dbid-93e948dd-5224-4ee3-95b4-acc5a3a0e959")}catch{}})();const _o=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:_o(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),Po=e=>Rn(e,!1),wo=e=>Ln(e.name,!1);function vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(P=>{S(P)},[]),l=r.useCallback(()=>{w(!0)},[w]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const v=o(P=>kn(P.cardPolicyState)),u=o(P=>En(P.cardPolicyState)),M=o(P=>An(P.cardPolicyState)),x=o(P=>Dn(P.cardPolicyState)),B=o(P=>_n(P.cardPolicyState)),p=o(P=>Pn(P.cardPolicyState)),h=o(P=>wn(P.cardPolicyState)),D=o(P=>vn(P.cardPolicyState)),d=o(P=>Tn(P.cardPolicyState)),_=o(P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(P=>P.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(Fn())},[a,v]),r.useEffect(()=>{D==="Completed"&&d===""||D==="In-Progress"||a($a())},[a,D,d]);const j=o(P=>xn(P.createCardPolicyState)),A=o(P=>ns(P.createCardPolicyState)),I=o(P=>rs(P.cardPolicyState)),L=o(P=>ss(P.cardPolicyState)),i=o(P=>cs(P.createCardPolicyState)),C=o(P=>Bn(P));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>u.map(Po),[u]),G=r.useMemo(()=>h.map(wo),[h]),O=r.useMemo(()=>C.cards.filter(P=>!dr(P.status.code)).map(Dr),[C.cards]),U=v==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&i==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:_,suggestedAllowMerchants:M,suggestedBlockMerchants:x,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,i,O,_,M,x,B,p]);const z=r.useMemo(()=>Lt(P=>{a($a(P))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const W=r.useCallback(P=>{z(P)},[z]),b=j.fetchState,T=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const P=_e(n.state?.pathnameStackToGoBack),ee=P.poppedPathname??T;e(ee,{state:{pathnameStackToGoBack:P.newStack}})},[n.state,e,T]),q=r.useCallback(()=>{e(T)},[e,T]),E=r.useCallback(P=>{a(is(P))},[a]),V=r.useCallback(P=>{const ee=lr(P);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(P=>{P.length!==0&&a(ls(P))},[a]),X=r.useCallback(()=>{a(un())},[a]),g=r.useRef(b);r.useEffect(()=>{const P=g.current;g.current=b,b==="Completed"&&P!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))},[a,b,A,e,T]);const F=b==="Error"?j.error?.message??fn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?i==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:l,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(zc,{formDraft:i,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:D==="In-Progress",onVendorSearchTextChange:W,submitState:b,submitErrorMessage:F,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,onCancelClick:q,onClickMenuIcon:l,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:To}}}=Xe.getLocalizedStrings(),Fo=e=>Rn(e,!1),xo=e=>Ln(e.name,!1);function Bo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),y=Fe(),f=Pe(y?.loggedInUserRoleMap),[S,w]=r.useState(!1),l=r.useCallback(F=>{w(F)},[]),m=r.useCallback(()=>{l(!0)},[l]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),u=o(F=>us(F)),M=o(F=>kn(F.cardPolicyState)),x=o(F=>En(F.cardPolicyState)),B=o(F=>An(F.cardPolicyState)),p=o(F=>Dn(F.cardPolicyState)),h=o(F=>_n(F.cardPolicyState)),D=o(F=>Pn(F.cardPolicyState)),d=o(F=>wn(F.cardPolicyState)),_=o(F=>vn(F.cardPolicyState)),k=o(F=>Tn(F.cardPolicyState)),j=o(F=>Bn(F)),A=o(F=>a!=null?ms(F.cardPolicyState,a):void 0),I=r.useMemo(()=>u.templateId===a&&u.formDraft!=null?u.formDraft:A!=null?Cs(A):void 0,[u.templateId,u.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=u.detailFetchState.fetchState;u.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(ps(a))},[s,a,u.templateId,u.detailFetchState.fetchState,A]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(Fn())},[s,M]),r.useEffect(()=>{_==="Completed"&&k===""||_==="In-Progress"||s($a())},[s,_,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{j.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[j.fetchState,s]);const i=r.useMemo(()=>x.map(Fo),[x]),C=r.useMemo(()=>d.map(xo),[d]),N=r.useMemo(()=>j.cards.filter(F=>!dr(F.status.code)).map(Dr),[j.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Wc({draft:I,cardRows:N,categorySearchOptions:i,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:D})},[I,N,i,C,L,B,p,h,D]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const W=r.useCallback(F=>{U(F)},[]),b=r.useMemo(()=>Lt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{b.cancel()},[b]);const T=r.useCallback(F=>{b(F)},[b]),Y=u.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),P=F.poppedPathname??q;e(P,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const P=lr(F);s(hs(P)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const g=Y==="Error"?u.updateFetchState.error?.message??To.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):O!=null&&M==="Completed"&&j.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(Yc,{templateName:u.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:i,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:Y,submitErrorMessage:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:v,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:W,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:u.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:v})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ro,subheadline:Lo,pageTitle:Oo}}}}=Xe.getLocalizedStrings(),Uo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function jo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(b=>{S(b)},[]),l=r.useCallback(()=>{w(!0)},[w]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=m(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),x=o(b=>Ss(b)),B=o(b=>xn(b.createCardPolicyState)),p=o(b=>bs(b.createCardPolicyState)),h=o(b=>p==null?[]:Un(b.aiCfoState,p).filter(T=>T.kind==="creating_policy"),Dt),D=B.fetchState==="In-Progress"?Math.max(h.length,1):0,d=o(b=>ys(b.createCardPolicyState)),_=ya(B.fetchState);r.useEffect(()=>{if(_==="In-Progress"&&B.fetchState==="Completed"&&p!=null)h.forEach(b=>{a(bt({chatSessionId:p,id:b.id,entityIds:d,kind:"created_policy"}))});else if(_==="In-Progress"&&B.fetchState==="Error"&&p!=null){h.forEach(T=>{a(bt({chatSessionId:p,id:T.id,kind:"errored_policy"}))});const b=B.error?.message!=null&&B.error.message.length>0?B.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b}]}))}},[B.error?.message,B.fetchState,a,p,d,h,_]);const k=x.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const j=x.archiveFetchState.fetchState,A=ya(j);r.useEffect(()=>{A==="In-Progress"&&j==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[j,a,A]);const I=r.useMemo(()=>x.templates.map(Uo),[x.templates]);Ft({isDataReady:x.fetchState.fetchState==="Completed"});const L=I.length>0||D>0,i=function(b){const{hasAnyPolicies:T,isChargeCardAdmin:Y,isFileUploadEnabled:q}=b,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:g}=mr(),F=Cr(),P=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=P&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ze=r.useCallback(()=>{g(!0)},[g]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!T&&Y)return{aiAgentName:Oo,headline:Ro,subheadline:Lo,promptChips:Se,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,T,ue,Y,q,ee,ne,Re,Ze,te,Ee,Ye,Se])}({hasAnyPolicies:L,isChargeCardAdmin:y,isFileUploadEnabled:R}),C=v&&i!=null?c.jsx(hr,{...i}):null,N=u&&C==null,G=r.useCallback(()=>{const b=_e(n.state?.pathnameStackToGoBack),T=b.poppedPathname??"..";e(T,{state:{pathnameStackToGoBack:b.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(b=>{t!=null&&e(`/${t}/cards/policy/${b}/edit`)},[e,t]),z=r.useCallback(b=>{a(ks(b))},[a]),W=x.fetchState.fetchState;return!L&&W!=="Completed"&&W!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Zc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:l,isAiCfoAccessEnabled:u,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Kc,{policies:I,archivingTemplateId:x.archiveTargetTemplateId,pendingCreationCount:D,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:l,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:M})]})}function Mo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),y=Fe(),f=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[w,l]=r.useState(!1),m=o(K=>Qa(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(Z.isChargeCardFeatureEnabled),u=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(Z.isDebitCardFeatureEnabled),x=we(s),B=ve(s),p=Te(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),d=Be({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:v,isBookKeepingTenant:B,isDebitCardProductVisible:D,chargeCardsCreditAccountLimit:h}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),j=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),i=!R&&d&&u,C=o(K=>_t(K,n,i,d)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),W=z?.accountingClassIDs[0],b=o(K=>W!=null?Wa(K.classState,{classId:W,reportId:"class_list"}):void 0),T=O?.cardHolderUser?.userId,Y=o(K=>T!=null?za(K.userRoleState,T):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Wa(K.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&w===!1&&V&&(l(!0),setTimeout(()=>{t(Ya()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,w,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,i,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&w===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&d&&u&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&d&&u&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,d,u,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},g=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(d,D,_,u),P=Ba(d,u,f,A,I),ee=yr(g,C);return C.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:d,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:u,productInformation:F,creditAccountInformation:P,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:b?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",No="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Vo=[La,Ra],Ho=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(Jc);function Go(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(M=>fe(M)),{useFeatureGate:y}=le(),{isFeatureEnabled:f}=y(Z.isCardsCommentingEnabled),[S,w]=r.useState(!1),l=o(M=>la(M)),m=Ar(s.companyId,{clearParams:l.fetchState==="Completed"}),R=r.useCallback(()=>{const M=_e(t.state?.pathnameStackToGoBack),x=M.poppedPathname??$o(s.tenantEmailDomain);e(x,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(jt({events:Ca(v,Vo),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||l.fetchState==="Completed"||l.fetchState==="In-Progress"||(w(!0),n(_a()))},[S,l,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const u=l.cashbackSummary?.cashbackEarned?.amount!=null&&l.fetchState!=="Not-Started";return l.fetchState!=="In-Progress"||u?(l.cashbackSummary?.cashbackEarned?.amount??0)===0&&l.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(Ho,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Qc,{onBackClick:R})}const $o=e=>`/${e}/cards`,zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f}=le(),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(!1),x=re.getSignedInUser();if(x==null)throw Error("Can't access onboarding card page without signing in...");const B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,D=o(E=>As(E,s)),d=D.chargeCard,_=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),I=Te(A,B),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),i=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:j,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&i;r.useEffect(()=>{S===!1&&_!=="In-Progress"&&_!=="Completed"&&(t(Ja()),w(!0)),l===!1&&D.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[l,D.fetchState,S,_]);const W=d?.type.code==="business_physical_credit_card"||d?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(R===!1&&(W===!1||W&&d?.status?.code!=="inactive"||d?.cardHolderUserId!==x.userId)){const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&D.isRefreshingViewInBackground===!1&&d?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[D.fetchState,d?.type.code,R,D.isRefreshingViewInBackground]);const b=re.getZeniOtpTokenForCardHolder(s),T=o(E=>Mn(E.userState,x.userId)),Y=()=>{d?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{D.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&d?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Y,3e3),v(!0))},[D.updatePhysicalChargeCardAttemptFetchState.fetchState,d?.cardActivationAttemptHistory]);const q=E=>{M(E)};if(_!=="Completed"||d==null)return c.jsx(va,{fetchState:"In-Progress"});if(d.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(T?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Ko,{children:[c.jsx(Ie,{isAppContentDrawerOpen:u,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:d,shippingAddressId:d.shippingAddressId,phone:T.phone,signedInUser:x,isSandboxEnv:xt(),chargeCardDetailState:D,signedInUserToken:b,navigate:a,currentTenant:B,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Zo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=_s(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),S=n.updateStatus,w=ua(e,!1,!1,!1);let l=!1;w.fetchState==="Completed"&&w.cards.length<=1&&(l=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:l,shippingAddress:y,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:l=>{e(vs(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("onboard")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(Xc),Zo=Ne.div`
2
- display: flex;
3
- flex-direction: column;
4
- width: ${e=>`${zo.containerWidth.value(e.windowSize)}%`};
5
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
6
- `,Ko=Ne.div`
7
- display: flex;
8
- min-height: 100%;
9
- width: 100%;
10
- flex: 1 1 auto;
11
- flex-direction: column;
12
- align-items: center;
13
- background-color: ${e=>e.theme.colors.grey4};
14
- `,Ka=Xe.getLocalizedStrings().dateFormat,qo={overlayWidth:new Fa(100,100,58)},Lr=[Br,it],Qo=new Set(Lr),Jo=De(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Bs(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Rs(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:y,isCashbackInfoFetchStateCompleted:f,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:w,controllerEmails:l,paymentDetails:m,productInformation:R,cashbackInformation:v,paymentSourceInformation:u,creditAccountInformation:M,debitAccountInformation:x,paymentInitiatedDate:B,sourcePage:p}=n,{tenantEmailDomain:h}=a,D=()=>{e(Gn(!0));const d=ea(a);d!=null&&d!==""&&e(Pa(d,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(f&&S&&w&&v!=null&&J.trackCardsPayEarlyFormClick(l,R,v,"Back",m.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:m.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:m.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:m.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:m.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:B?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:B?.format(Ka.visual.MMMDCommaYYYYformat)},u,M,x),p==="cardPaymentHistory")n.closeDrawerHandler(!0),e($n());else{const d=aa(h);t(d)}},onUpdatePaymentAccountStatus:(d,_,k)=>{e(Us(d,_,"bill_pay","bill_pay_detail",k))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:d=>{e(Os("external_account",d))},onEstablishConnectionClick:d=>{e(Ls(d,a.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{s?window.open(`/${h}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{y?window.open(`/${h}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:d=>{Qo.has(d)&&D()},onPusherSubscribed:D}})(ct(eo)),Gt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:y,creditAccountInformation:f,debitAccountInformation:S,cashbackInformation:w,isDebitCardInfoFetchStateCompleted:l,isCreditCardInfoFetchStateCompleted:m,isCashbackInfoFetchStateCompleted:R,paymentInitiatedDate:v,retryRepayment:u})=>{const M=de(),{useDynamicConfig:x}=le(),{configValue:B}=x(We.zeniAccountsConfig),p=Ts(B),h=o(F=>Vn(F)),{creditAccount:D}=o(F=>da(F)),d=o(F=>fe(F)),_=Bt(),k=Ta(),j=pe(),A=re.getSignedInUser(),I=Fe(),[L,i]=r.useState(!1),[C,N]=r.useState(!1),{configValue:G}=x(We.zeniCardsConfig),O=G.credit_card_auto_pay_threshold_by_company_id?.[d.companyId]??G.default_credit_card_auto_pay_threshold??Io,U=Hn(I?.loggedInUserRoleMap),z=Fs(I?.loggedInUserRoleMap),W=!!d.companyZeniAccountInfo?.info?.isZeniAccountEnabled,b=o(F=>wa(F,d.companyId)),T=b.companyChargeCardInfo?.primaryFundingAccount,Y=b.allFundingAccounts.find(F=>F.id===T?.accountId),q=o(F=>oa(F,d.companyId)),E=ia(q.controllers);r.useEffect(()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&j(Gn()),h.fetchState==="Completed"&&!C){const F=d.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,P=h.transferFromAccounts.find(K=>K.id===F);let ee;if(y==="cardPaymentHistory"&&u){const K=u.paymentAccountId!=null?h.transferFromAccounts.find(ke=>ke.id===u.paymentAccountId):void 0;ee={amount:u.amount,isAutoRepayment:d.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:hn(),transferFrom:K??P}}else ee={amount:{amount:D.balance.amount+D.hold.amount,currencyCode:D.balance.currencyCode,currencySymbol:D.balance.currencySymbol},isAutoRepayment:d.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:hn(),transferFrom:P};j(mn(ee)),N(!0)}},[h.fetchState,C,y,u,h.transferFromAccounts,d.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,d.companyChargeCardInfo?.info?.isAutoPayEnabled,D.balance.amount,D.balance.currencyCode,D.balance.currencySymbol,D.hold.amount,j]);const V={isZeniCheckingEnabled:d.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:Y?.accType==="depositAccount",creditCardPaymentSourceAccountName:Y?.label,creditCardPaymentSourceAccountType:Y?.accType,creditCardPaymentSourceLastFourDigits:Y?.accountLast4,creditCardPaymentSourceBalance:Y?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(Pa(d.companyId,!0))},[b.fetchState]),r.useEffect(()=>{h.updateStatus==="Completed"&&w!=null&&R&&m&&l&&J.trackCardsPayEarlyPayNowClick(E,s,w,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:v?.add(3,"day").format(Ka.visual.MMMDCommaYYYYformat),paymentInitiatedDate:v?.format(Ka.visual.MMMDCommaYYYYformat)},V,f,S)},[h.updateStatus,w,R,m,l,v]),r.useEffect(()=>{h.fetchState==="Completed"&&w!=null&&R&&m&&l&&!L&&e&&C&&w!=null&&(J.trackCardsPayEarlyFormView(E,s,w,t,d.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,D.balance.amount,V,f,S),i(!0))},[h,R,m,l,L,e,C]),A==null)throw Error("Can't access invite people page without signing in...");const Q=()=>{n(!0),j($n())},X=ea(d),g={events:e?Ca(X,Lr):[],eventCallback:(F,P,ee)=>{ee.onEventReceived(F)},onSubscribed:F=>{F.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(br,{onClose:()=>{Q()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:qo.overlayWidth.valuePercentage(k),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:_.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(Xo,{onClick:F=>F.stopPropagation(),children:c.jsx(Jo,{...g,closeDrawerHandler:n,navigate:M,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{R&&m&&l&&w!=null&&J.trackCardsPayEarlyFormClick(E,s,w,"Pay Now",h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},V,f,S),j(xs({companyId:d.companyId}))},onDismissClick:Q,onSaveChangesToLocalStore:F=>{j(mn(F))},currentTenant:d,hasZeniAccountsAdminAccess:U,isZeniAccountsUser:z,isZeniAccountSetupEnabled:W,productInformation:s,sourcePage:y,controllerEmails:E,autoPayThreshold:O,paymentSourceInformation:V,creditAccountInformation:f,debitAccountInformation:S,cashbackInformation:w,isCashbackInfoFetchStateCompleted:R,isCreditCardInfoFetchStateCompleted:m,isDebitCardInfoFetchStateCompleted:l,paymentInitiatedDate:v,maxInsuredAmount:p.maxInsuredAmount})})})})},Xo=Ne(yo)`
15
- display: flex;
16
- min-height: 100%;
17
- flex-direction: column;
18
- `,$t=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,Ue=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,qa=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",ft=e=>{if(e==null||typeof e!="object")return!1;const n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!qa(n.transaction_status)&&!!qa(n.transaction_type)},zt=(e,n)=>{const t=e?.card_status;if(!qa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},Et=[wr,vr,Tr,Fr,xr,ma,Mt,it,Nt,Vt,Ht],Or=[La,Ra],ei=new Set([...Et,...Or]),gt=Xe.getLocalizedStrings().dateFormat,ai=De(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:y}=n,f=re.getSignedInUser(),S=e.tenantState.currentTenantId,w={userId:f?.userId??"",sessionId:f?.zeniSessionId??"",tenantId:S??""},l=_t(e,a,t,y),m=Ws(e,a),R=Ys(e);return{chargeCardDetailView:l,chargeCardsRecurringExpensesState:m,vgsVaultId:st.cardVaultId,transactionAttachmentsEndpointToFetch:`${kt}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${kt}/card_transaction_attachment`,authParams:w,isSnackbarOpen:R.isSnackbarOpen,cardsEndPoint:`${fr.cardMicroServiceBaseUrl}`,signedInUserToken:l.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:y,cardProviderId:f,includeCreditAccountInfo:S,setIsPaymentOpen:w,controllerEmails:l,productInformation:m,cashbackInformation:R,primaryFundingAccountDetails:v,creditAccountInformation:u,debitAccountInformation:M,isChargeCardFeatureEnabled:x}=n,{tenantEmailDomain:B}=a;return{onEventReceived:(p,h)=>{(({event:D,data:d,cardId:_,dispatch:k,subscribedEvents:j})=>{const A=$t(d);switch(D){case La:case Ra:return void k(_a(!0));case wr:{const I=ie(A?.card_id);if(I==null||I!==_)return;const L=ie(A?.transaction_id),i=A?.transaction_status;return L!=null&&qa(i)?void k($s({transactionId:L,transactionStatus:i})):void k(ra(_,null,null,!0))}case ma:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=zt(A,I);return L!=null?void k(wt(L)):void k(ga(_,!0))}case Mt:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=ie(A?.currency_code),i=ie(A?.currency_symbol),C=Ue(A?.balance);return L!=null&&i!=null&&C!=null?(k(Gs({cardId:I,currencyCode:L,currencySymbol:i,balance:C,hold:Ue(A?.hold),dailyPurchaseSpends:Ue(A?.daily_purchase_spends),monthlyPurchaseSpends:Ue(A?.monthly_purchase_spends),dailyWithdrawals:Ue(A?.daily_withdrawals),monthlyWithdrawals:Ue(A?.monthly_withdrawals)})),void k(Qe(!0))):(k(ga(_,!0)),void k(Qe(!0)))}case it:{const I=ie(A?.currency_code),L=ie(A?.currency_symbol),i=Ue(A?.available_amount),C=Ue(A?.balance_amount);return I!=null&&L!=null&&i!=null&&C!=null?void k(Hs({currencyCode:I,currencySymbol:L,available:i,balance:C,hold:Ue(A?.hold_amount),cashback:Ue(A?.cashback_amount)})):void k(Qe(!0))}case vr:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=A?.transaction;return ft(L)?void k(Vs({cardId:I,transaction:L})):void k(ra(_,null,null,!0))}case Tr:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=A?.transaction;return ft(L)?void k(Ns({cardId:I,declineReason:ie(A?.decline_reason),transaction:L})):void k(ra(_,null,null,!0))}case Fr:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=A?.transaction;return ft(L)?void k(Ms({cardId:I,transaction:L})):void k(ra(_,null,null,!0))}case xr:{const I=ie(A?.card_id)??_;if(I!==_)return;const L=ie(A?.transaction_id),i=A?.attachment_file_paths;return L!=null&&Array.isArray(i)&&i.every(C=>typeof C=="string")?void k(js({cardId:I,transactionId:L,attachmentFilePaths:i})):void k(ra(_,null,null,!0))}case Nt:case Vt:case Ht:{const I=ie(A?.card_id);if(I==null||I!==_)return;k(ga(_,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ei})},onPusherSubscribed:()=>{e(ga(t,!0)),e(ra(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,x))},onFetchChargeCardTransactionList:(p,h)=>{e(ra(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{f!=null&&e(tt(p,"ChargeCardHolder",t))},onResendOtp:p=>{f!=null&&e(at(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{f!=null&&e(et(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&re.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(Xs(t,p))},onLockChargeCard:(p,h)=>{e(Xn(p,t,h))},onUnlockChargeCard:p=>{e(Jn(p,t))},onCloseChargeCard:p=>{e(Qn(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(qn([t]))},updateChargeCardName:(p,h)=>{e(Kn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(Js({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,D,d)=>{e(Qs({chargeCardId:h,transactionId:p,fetchState:D,error:d}))},updateChargeCardTransactionReceiptsShowTick:(p,h,D)=>{e(qs({chargeCardId:h,transactionId:p,shouldShowTick:D}))},onChargeCardRevokeInviteClick:()=>{e(Zn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,D)=>{e(Ks({chargeCardId:h,transactionId:p,isViewReceiptClicked:D}))},onChargeCardTransactionRowClick:(p,h)=>{const D=ye(y.state?.pathnameStackToGoBack,y.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:D}})},onBackClick:()=>{const p=_e(y.state?.pathnameStackToGoBack),h=aa(B);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Zs())},onUpdateDebitCardPinAttempt:p=>{e(Yn(t,p)),p==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,D,d){e(Wn(p,h,D.code,d))},shouldOpenCreditCardPaymentDrawer(p){p&&R!=null&&J.trackCardsPayEarlyClick(l,m,R,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:v?.accType==="depositAccount",creditCardPaymentSourceAccountName:v?.label,creditCardPaymentSourceAccountType:v?.accType,creditCardPaymentSourceLastFourDigits:v?.accountLast4,creditCardPaymentSourceBalance:v?.accountBalance?.available?.amount??0},u,M),w(p)}}})(ct(to));function ti(){const e=de(),n=pe(),t=Ce(),{cardId:a}=Me(),[s,y]=r.useState(!1),[f,S]=r.useState(!1),{useDynamicConfig:w}=le(),l=re.getSignedInUser(),m=o(H=>fe(H)),R=o(H=>Qa(H).firstViewAfterActivation),v=o(H=>H.classListState.fetchState),{configValue:u}=w(We.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:M}=w(We.zeniCardsConfig),x=M.enable_card_controls_for_company_ids,B=M.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(x)&&x.includes(m.companyId),[p,h]=r.useState(!1),[D,d]=r.useState(!1),{useFeatureGate:_}=le(),{isFeatureEnabled:k}=_(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=_(Z.isDebitCardFeatureEnabled),A=Te(j,m),I=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:A}),{isFeatureEnabled:L}=_(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:i}=_(Z.isCardsCommentingEnabled),C=ve(m),N=we(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:k,isBookKeepingTenant:C,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:G}),U=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!m.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const b=o(H=>wa(H,m.companyId)),{creditAccount:T,creditAccountRepayment:Y}=o(H=>da(H)),q=re.getZeniOtpTokenForCardHolder(a),E=o(H=>_t(H,a,W,O)),{isAiCfoAccessEnabled:V,onAskAiCfoClick:Q}=xa({mobileExploreReferrer:"Card Detail"});Ft({isDataReady:E.fetchState==="Completed"});const X=o(H=>la(H)),g=E.chargeCard,F=Fe(),P=Pe(F?.loggedInUserRoleMap),ee=g?.type.code==="business_physical_debit_card"||g?.type.code==="business_virtual_debit_card",K=g?.type.code==="business_physical_debit_card"||g?.type.code==="business_physical_credit_card",ke=g?.type.code==="business_virtual_debit_card"||g?.type.code==="business_virtual_credit_card",Se=g?.type.code==="business_virtual_debit_card",ge=Ba(O,z,P,T,Y),ae=yr(ee,E),ue=Ot(P,X),oe=Je(O,I,U,z),te=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",Ye=o(H=>oa(H,m.companyId)),Ee=ia(Ye.controllers),ne=o(H=>g?.cardCreatedByUser?.userId!=null?za(H.userRoleState,g?.cardCreatedByUser?.userId):void 0),Ze=o(H=>ne?.accountingClassIDs[0]!=null?Wa(H.classState,{classId:ne?.accountingClassIDs[0],reportId:"class_list"}):void 0),Re=o(H=>g?.cardHolderUser?.userId!=null?za(H.userRoleState,g?.cardHolderUser?.userId):void 0),ce=o(H=>Re?.accountingClassIDs[0]!=null?Wa(H.classState,{classId:Re?.accountingClassIDs[0],reportId:"class_list"}):void 0),Ea=m?.userRole,pa=o(H=>ua(H,!1,I,k).revokeCardInvite),ha=ya(pa.saveStatus.fetchState);if(r.useEffect(()=>{if(ha==="In-Progress"&&pa.saveStatus.fetchState==="Completed"){const H=aa(m.tenantEmailDomain);e(H)}},[ha,pa.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect(()=>{R&&s===!1&&ke&&(y(!0),setTimeout(()=>{n(Ya()),Se&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[R,s,ke,Se]),r.useEffect(()=>{p||E.fetchState==="Completed"||E.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,W,O,!1)))},[p,E,a,n]),r.useEffect(()=>{!D&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ee&&te&&P&&(d(!0),n(zn({depositAccountId:E.chargeCard?.connectedAccountId})))},[D,E,n,te,P]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&P&&n(_a()),v!=="Completed"&&v!=="In-Progress"&&n(jn()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&n(zs({chargeCardId:a})),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&n(Pa(m.companyId,!0))},[X.fetchState,n,P,v,E.transactionStatistics.fetchState,b.fetchState]),r.useEffect(()=>{if(!(E.fetchState!=="Completed"||O&&T.fetchState!=="Completed"||g==null||E.transactionStatistics.fetchState!=="Completed"||ee&&P&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const H=g.type.code.includes("physical"),he=H?g.cardActivationAttemptHistory[0]?.timestamp:g.createTime;J.trackCardsCardDetailView(Ee,oe,{cardId:a,cardName:g.cardName,cardType:g.type.code.includes("credit")?"credit":"debit",cardCategory:H?"physical":"virtual",cardLimit:Sa(g.limit.amount),cardLastFourDigits:g.accountLast4,cardStatus:g.status.code,cardAssignedDate:g.createTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:g.providerCardCreateTime?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(gt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:g.creditLimitFrequency.name,cardSpentAmount:Sa(g.balance.amount),cardAvailableLimit:Sa(g.available.amount),cardUtilizationPercent:g.limit.amount>0?Math.round((g.limit.amount-g.available.amount)/g.limit.amount*100):0,cardUtilizationAmount:Sa(g.limit.amount-g.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:It(g.cardCreatedByUser,!1),cardIssuedByEmail:g.cardCreatedByUser?.email,cardIssuedByUserId:g.cardCreatedByUser?.userId,cardIssuedByRole:ne?.userRoles,cardIssuedByDepartment:Ze?.className},{cardholderName:It(g.cardHolderUser,!1),cardholderEmail:g.cardHolderUser?.email,cardholderRole:Re?.userRoles,cardholderUserId:g.cardHolderUser?.userId,cardholderDepartment:ce?.className},ge,ae)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,T.fetchState,P]),l==null)throw Error("Can't access card detail page without signing in...");const ta=ea(m),Aa=P?[...Et,...Or]:Et,lt={events:Ca(ta,Aa),eventCallback:(H,he,Le)=>{Le.onEventReceived(H,he)},onSubscribed:H=>{H.onPusherSubscribed()}},ut=()=>{if(a!=null&&g!=null){const{ownerName:H,cardName:he,utilisation:Le,limit:Ve,frequency:He,cardColor:Ge}=St(g),$e=g.cardHolderUserId===l.userId;J.trackCardsDetailPageViewed(a,H,he,Le,Ve,He,Ge,$e)}};r.useEffect(()=>{if(E.fetchState==="Completed"){const H=E.chargeCard;if(H?.status.code==="inactive"||ee&&H?.isPinSet===!1||K&&R){const he=Ae(m.tenantEmailDomain,a,l,g,R);e(he)}}},[E.fetchState]);const me=(H,he)=>{if(a!=null&&g!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=St(g),na=g.cardHolderUserId===l.userId;J.trackCardsDetailPageClicked(a,Le,Ve,He,Ge,$e,H,na,he)}},Oa=(H,he)=>{if(a!=null&&g!=null){const{ownerName:Le,cardName:Ve,utilisation:He,limit:Ge,frequency:$e}=St(g),na=g.cardHolderUserId===l.userId;J.trackCardsVerifyPopUpClick(a,Le,Ve,He,Ge,$e,H,na,he)}},Da=T.balance.amount+T.hold.amount,mt=m.companyChargeCardInfo?.info?.primaryFundingAccount,Ua=b.allFundingAccounts.find(H=>H.id===mt?.accountId),ja=E.chargeCard!=null,Ma=E.depositAccountLimit!=null;return E.fetchState!=="Error"||ja?!ja&&(E.fetchState==="In-Progress"||E.fetchState==="Not-Started")||pa.saveStatus.fetchState==="In-Progress"||!Ma&&ee&&P&&E.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(ao,{}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:R}),E.fetchState==="Completed"?c.jsx(Rt,{analytics:J,onLoad:ut}):null,f===!0?c.jsx(Gt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:f,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,creditAccountSpentAmount:Da,isDebitCardInfoFetchStateCompleted:!ee||!P||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||T.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!P||X.fetchState==="Completed",paymentInitiatedDate:Y.initiatedRepaymentDate}):null,c.jsx(ai,{...lt,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:Oa,onFireOnClickAnalytics:me,isSandboxEnv:xt(),signedInUser:l,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:ne?.userRoles,cardIssuedByDepartmentName:Ze?.className,cardHolderRoles:Re?.userRoles,cardHolderDepartmentName:ce?.className,loggedInUserRole:Ea,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:I,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:z,isCardControlsEnabled:B,isEarlyPayEnabled:L,controllerEmails:Ee,chargeCardCashbackDetailState:X,productInformation:oe,creditAccountInformation:ge,debitAccountInformation:ae,cashbackInformation:ue,classListFetchState:v,primaryFundingAccountDetails:Ua,currentTenant:m,cardProviderId:E.chargeCard?.cardProviderID,cardId:a,creditAccount:T,creditAccountRepayment:Y,includeCreditAccountInfo:W,signedInUserToken:q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:u.documentAiReceiptMaxSizeLimitBytes!=null?u.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:V,onAskAiCfoClick:Q,isCardsCommentingEnabled:i})]}):c.jsx(ot,{})}const St=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,y=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:y,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ni,subheadline:ri,pageTitle:si}}}}=Xe.getLocalizedStrings(),Ur=[ma,it,Rr,Ra,La,dt,Ht,No,Nt,Vt,Mt],ci=new Set(Ur),At=Lt((e,n,t,a)=>{e(ca(n,t,a,!0))},400),oi=Ne.div`
19
- display: flex;
20
- width: 100%;
21
- flex: 1 1 auto;
22
- flex-direction: column;
23
- align-items: center;
24
- background-color: ${e=>e.theme.colors.grey4};
25
- `,ii=De(function(e,n){const t=ua(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:rc(e),bulkActionView:sc(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:y,chargeCardListState:f,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:w,isCreditCardProductVisibleForExpressInterest:l,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:R,isDebitCardSetupEnabled:v,isDebitCardTOSAccepted:u,isChargeCardTOSAccepted:M,controllerEmails:x,depositAccountListWithDebitCardIssued:B,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:D,cashbackInformation:d,creditAccountInformation:_,debitAccountInformation:k,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:A}=n,{tenantEmailDomain:I}=a,{cards:L}=f;return{onChargeCardRowClick:(i,C)=>{const N=kr(L,i);let G;N!=null&&((U=>{const z=U.limit.amount-U.available.amount,W=`${U.cardHolderUser?.firstName.toLowerCase()} ${U.cardHolderUser?.lastName.toLowerCase()}`,b=U.cardName,T=U.department?.className??"",Y=U.limit.amount,q=U.creditLimitFrequency.name;J.trackCardsListRowClicked(W,b,T,z,Y,q,y.userId===U.cardHolderUserId)})(N),sa(R,v,B)&&J.trackCardsCardListRowClick(x,D,"Card Row Item","row_clicked",C+1,{cardOwner:It(N.cardHolderUser,!1),cardName:N.cardName,cardType:N.type.code.includes("credit")?"credit":"debit",cardStatus:N.status.code,cardUtilizationAmount:Sa(N.limit.amount-N.available.amount),cardUtilizationPercent:N.limit.amount>0?Math.round((N.limit.amount-N.available.amount)/N.limit.amount*100):0,cardLimit:Sa(N.limit.amount)},d,_,k)),G=N?.status.code==="request_on_hold"&&y.userId===N.cardHolderUserId?Er(I):Ae(I,i,y,N);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(G,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:i=>{e(qn(i))},onFetchDepositAccountLimit:i=>{e(zn({depositAccountId:i}))},onChargeCardResendInviteClick:i=>{e(Cc(i))},onChargeCardRevokeInviteClick:i=>{e(Zn(i))},onLockChargeCardList:(i,C)=>{e(mc(i,C))},onUnlockChargeCardList:i=>{e(uc(i))},onCloseChargeCardList:(i,C)=>{e(lc(i,C))},onRevokeChargeCardList:i=>{e(dc(i))},updateChargeCardListSpendLimit(i,C,N){e(ic(i,C,N.code))},onLockChargeCard:(i,C)=>{e(Xn(A,i,C))},onUnlockChargeCard:i=>{e(Jn(A,i))},onCloseChargeCard:(i,C)=>{e(Qn(i,C))},onUpdateSpendLimit(i,C,N,G){e(Wn(i,C,N.code,G))},updateChargeCardName:(i,C)=>{e(Kn(A,i,C))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),sa(R,v,B)&&d!=null&&J.trackCardsSettingsClick(x,D,d,_,k);const i=Eo(I),C=ye(s.state?.pathnameStackToGoBack,s.pathname);t(i,{state:{pathnameStackToGoBack:C}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),sa(R,v,B)&&d!=null&&J.trackCardsNewCardClick(x,D,d,"New Button","card_creation_initiated","Card List",_,k);const i=di(I),C=ye(s.state?.pathnameStackToGoBack,s.pathname);t(i,{state:{pathnameStackToGoBack:C}})},onColumnSortConfigChanged:(i,C)=>{sa(R,v,B)&&d!=null&&J.trackCardsCardListSortClick(x,D,d,"Sort Icon","sort",i,C==="ascending"?"ASC":"DESC","Cards List",_,k),e(yt({uiState:{sortKey:i,sortOrder:C}}))},onSearchTextChanged:i=>{e(oc(i))},onReloadCards:()=>{e(ca(S,R&&v,w&&m,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{sa(R,v,B)&&d!=null&&J.trackCardsCashbackOverviewClick(x,D,d,"Cashback Overview","cashback_details_viewed",_,k),t("./cashback")},onClickStatementsIcon:()=>{sa(R,v,B)&&d!=null&&J.trackCardsStatementsClick(x,D,d,_,k),t("./statements")},onCreateNowClick:i=>{sa(R,v,B)&&d!=null&&J.trackCardsNewCardClick(x,D,d,"Promo Banner","card_creation_initiated","Card List",_,k),t(`./new?cardType=${i}`)},onPromoCardClick:i=>{t(i==="debit"&&R&&!u||i==="credit"&&l&&!M?`../promo?cardPromoType=${i}`:"./setup")},navigateToCreditCardPaymentPage:(i,C)=>{h==="Completed"&&a.company!=null&&d!=null&&J.trackCardsPayEarlyClick(x,D,d,"Card List",i,C,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},_,k);const N=li(I);t(N)},navigateToCreditCardPaymentHistoryPage:()=>{const i=ui(I),C=ye(s.state?.pathnameStackToGoBack,s.pathname);t(i,{state:{pathnameStackToGoBack:C}})},shouldShowPayNowInfoTooltip:j,onSetRowActionCardId:i=>{e(cc(i))},onSetBulkActionCardIds:i=>{e(er(i))},onEventReceived:i=>{ci.has(i)&&At(e,S,R&&v,w&&m)},onPusherSubscribed:()=>{At(e,S,R&&v,w&&m)}}})(ct(ro));function gn({isPaymentDrawerOpen:e}){const n=de(),t=pe(),a=Ce(),s=r.useCallback(($,Oe)=>{t(er([])),n($,Oe)},[t,n]),[y,f]=r.useState(!1),[S,w]=r.useState(re.getPayNowInfoTooltip()??!1),l=$=>{re.savePayNowInfoTooltip($),w($)},[m,R]=r.useState(!1),v=re.getSignedInUser(),u=o($=>fe($)),[M,x]=r.useState(!1),[B,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Cards"}),d=u.userRole.includes("charge_card_user"),_=!d,k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:j,useDynamicConfig:A}=le(),{isFeatureEnabled:I}=j(Z.isCashbackFeatureEnabled),{isFeatureEnabled:L}=j(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:i}=j(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=j(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:N}=j(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=j(Z.isCardsCommentingEnabled),{isFeatureEnabled:O}=j(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:U}=j(Z.isCardPolicyEnabled),{isFeatureEnabled:z}=j(Z.isAiCardCreationEnabled),W=Te(i,u),b=xe({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:W}),T=we(u),Y=ve(u),q=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Be({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:L,isBookKeepingTenant:Y,isDebitCardProductVisible:b,chargeCardsCreditAccountLimit:q}),V=Ir({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:L,isBookKeepingTenant:Y}),{configValue:Q}=A(We.zeniCardsConfig),X=Fe(),g=Pe(X?.loggedInUserRoleMap),F=o($=>oa($,u.companyId)),P=ia(F.controllers),ee=Q.charge_card_cashback_rate_per_transaction!=null?Q.charge_card_cashback_rate_per_transaction:.0175,K=Q.credit_card_pay_now_threshold_by_company_id?.[u.companyId]??Q.default_credit_card_pay_now_threshold??ko,ke=Q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(Q.enable_card_controls_for_company_ids)&&Q.enable_card_controls_for_company_ids.includes(u.companyId),Se=!!u.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!u.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,ae=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,ue=o($=>Vn($)),oe=ya(ue.updateStatus),te=o($=>ua($,_,b&&k,E&&ae)),Ye=o($=>ec($)),Ee=o($=>ac($)),ne=o($=>tc($)),Ze=o($=>nc($)),Re=o($=>ne==null?[]:Un($.aiCfoState,ne).filter(Oe=>Oe.kind==="creating_cards"),Dt),ce=ya(Ee.fetchState);r.useEffect(()=>{ce==="In-Progress"&&Ee.fetchState==="Completed"&&ne!=null&&Re.forEach($=>{t(bt({chatSessionId:ne,id:$.id,entityIds:Ze,kind:"created_cards"}))})},[t,Ee.fetchState,ne,Ze,Re,ce]);const Ea=te.cards.filter($=>$.type.code.includes("debit")).map($=>$.connectedAccountId),pa=[...new Set(Ea)],ha=o($=>la($)),ta=o($=>nt($,pa)),Aa=o($=>wa($,u.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find($=>$.id===lt?.accountId),me=te.fetchState,Oa=te.creditAccount,Da=r.useCallback(()=>g===!0&&U===!0&&me==="Completed"&&re.getCardPolicyPopupSeen(u.tenantEmailDomain??"")!==!0,[g,U,me,u.tenantEmailDomain]),[mt,Ua]=r.useState(Da);r.useEffect(()=>{Ua(Da())},[Da]);const ja=()=>{re.saveCardPolicyPopupSeen(u.tenantEmailDomain??"",!0),Ua(!1)},Ma=me==="Completed"&&!te.hasCreditCard&&!te.hasDebitCard;no({isDataReady:me==="Completed",pageContext:Ma?"cards_creation":"cards"});const{creditAccountRepayment:H}=o($=>da($)),he=o($=>Qa($).firstViewAfterActivation),{areTenantIdsInSync:Le}=gr(),Ve=Ot(g,ha),He=Ba(E,ae,g,Oa,H),Ge=Ut(b,k,g,ta,te.debitCardSummary),$e=Je(E,b,k,ae),na=te.creditAccount.balance.amount+te.creditAccount.hold.amount;if(r.useEffect(()=>{me==="Completed"&&(re.getPayNowInfoTooltip()==null||na<K*te.creditAccount.limit.amount/100)&&l(!0)},[me,K,na,te.creditAccount.limit.amount]),r.useEffect(()=>{if(e!=null&&e===!0&&H.initiatedRepayments.amount===0&&H.fetchState==="Completed"||oe==="In-Progress"&&ue.updateStatus==="Completed")l(!1),f(!0);else if(H.initiatedRepayments.amount>0&&H.fetchState==="Completed"){f(!1),document.body.style.overflow="auto";const $=aa(u.tenantEmailDomain);s($)}},[e,H.initiatedRepayments.amount,H.fetchState,oe,ue.updateStatus,s,u.tenantEmailDomain]),r.useEffect(()=>{!M&&(ae||k)&&Le&&(x(!0),t(ca(_,b&&k,E&&ae,!1)))},[M,_,t,Le]),r.useEffect(()=>{he&&m===!1&&(R(!0),setTimeout(()=>{t(Ya())},5e3))},[he,m]),r.useEffect(()=>()=>{At.flush()},[]),r.useEffect(()=>{me==="Completed"&&d&&te.cards.length===1&&(te.cards[0].status.code==="inactive"&&te.cards[0].type.code==="business_physical_credit_card"?s(`./${te.cards[0].id}/activate`):te.cards[0].status.code!=="request_on_hold"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${te.cards[0].id}`)))},[me,d,a.state,s,te.cards]),r.useEffect(()=>{if(me==="Completed"&&d){const $=te.cards.length,Oe=te.cards.filter(Ke=>Ke.cardHolderUserId===v?.userId).filter(Ke=>Ke.status.code==="request_on_hold");Oe.length>0&&$===Oe.length&&s("./onboard")}},[me,te.cards,d,s,v?.userId]),r.useEffect(()=>{me!=="Completed"||E&&H.fetchState!=="Completed"||b&&k&&g&&ta.fetchState!=="Completed"||J.trackCardsCardListView(P,$e,Ve,He,Ge)},[me,Oa,H.fetchState,ta.fetchState,g]),v==null)throw Error("Can't access charge card list page without signing in...");const Vr=o($=>ar($.userState,$.userRoleState,$.userListViewState,"cardAdmin")),Wt=vt(X?.loggedInUserRoleMap),Yt=$=>{p($)},Hr=te.creditAccount.limit,Gr=()=>{f(!1),s("..")},$r=u.companyChargeCardInfo?.info!=null&&Ia({cardInfo:u.companyChargeCardInfo.info,isProductVisible:E,isTOSAccepted:Se,isSetupEnabled:ae,isUserHasCardsAdminLevelAccess:g,isUserHasCardsAccess:Wt}),zr=u.companyDebitCardInfo?.info!=null&&Ia({cardInfo:u.companyDebitCardInfo.info,isProductVisible:b,isTOSAccepted:ge,isSetupEnabled:k,isUserHasCardsAdminLevelAccess:g,isUserHasCardsAccess:Wt}),Wr=$r||zr,Zt=function($){const{isEmptyCardsState:Oe,isChargeCardAdmin:Ke,isFileUploadEnabled:qt}=$,Qt=de(),Na=Ce(),{tenantEmailDomain:Va}=Me(),{isAiCfoOpen:qr,setIsAiCfoOpen:Jt}=mr(),Qr=Cr(),Jr=pr(),Xt=o(be=>On(be)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:en,isResolved:an}=Pr("cards_creation"),tn=r.useMemo(()=>_r(en,an,3),[en,an]),[Ha,Ct]=r.useState(""),nn=Jr&&Qr&&Va!=null&&!qr,fa=r.useCallback(be=>{if(Va==null)return;const Xr=ye(Na.state?.pathnameStackToGoBack,Na.pathname);Qt(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Xr,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})},[Na.pathname,Na.state,Qt,Va]),rn=r.useCallback(be=>{be.trim().length!==0&&(Ct(""),fa(be))},[fa]),sn=r.useCallback(()=>{const be=Ha.trim();be.length!==0&&(Ct(""),fa(be))},[Ha,fa]),cn=r.useCallback(()=>{},[]),on=r.useCallback(be=>{Ct(be)},[]),dn=r.useCallback(()=>{Jt(!0)},[Jt]),ln=r.useCallback(()=>{fa(void 0)},[fa]);return r.useMemo(()=>{if(nn&&Oe&&Ke)return{aiAgentName:si,headline:ni,subheadline:ri,promptChips:tn,composer:{currentInput:Ha,isSubmitting:Xt,isFileUploadEnabled:qt,onInputChange:on,onSubmit:sn,onStopSubmit:cn},onPromptClick:rn,onOpenSidePanel:dn,onOpenFullView:ln,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,nn,Ke,Oe,qt,Xt,on,ln,dn,rn,cn,sn,tn])}({isEmptyCardsState:Ma,isChargeCardAdmin:g,isFileUploadEnabled:O}),Kt=z&&Zt!=null?c.jsx(hr,{...Zt}):null,Yr=h&&Kt==null,Zr=ea(u),Kr={events:Ca(Zr,Ur),eventCallback:($,Oe,Ke)=>{Ke.onEventReceived($)},onSubscribed:$=>{$.onPusherSubscribed()}};return ae||k?c.jsxs(c.Fragment,{children:[me==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{analytics:J,onLoad:()=>{J.trackPageLoaded(Sr.Event.cardsListPage),(E&&!ae||b&&!k)&&J.trackCardsPromoView(P,{isCreditCardOffered:E,isDebitCardOffered:b,isDebitCardEnabled:k,isCreditCardEnabled:ae},"Banner",b&&!k?"Debit Card":E&&!ae?"Credit Card":"","Card List")}}),c.jsx(rt,{showConfetti:he})]}):null,y===!0?c.jsx(Gt,{closeDrawerHandler:Gr,isPaymentDrawerOpen:y,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:na,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isDebitCardInfoFetchStateCompleted:!(b&&k&&g)||ta.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||H.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!g||ha.fetchState==="Completed",paymentInitiatedDate:H.initiatedRepaymentDate}):null,c.jsxs(oi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:B,handleDrawerToggle:Yt}),c.jsx(ii,{...Kr,isCashbackFeatureEnabled:I,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:b,isCreditCardProductVisibleForExpressInterest:V,updatePayNowInfoTooltip:l,showPayNowInfoTooltip:S,creditCardPayNowThreshold:K,signedInUser:v,chargeCardListState:te,location:a,admins:Vr.users,navigateAndClearBulkSelection:s,currentTenant:u,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:u.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:g,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{Yt(!0)},creditLimit:Hr,isChargeCardSetupEnabled:ae,isDebitCardSetupEnabled:k,isEarlyPayEnabled:C,isChargeCardPaymentHistoryFeatureEnabled:N,cashbackRate:ee,controllerEmails:P,chargeCardCashbackDetailState:ha,depositAccountListWithDebitCardIssued:ta,isChargeCardTOSAccepted:Se,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:$e,creditAccountInformation:He,debitAccountInformation:Ge,cashbackInformation:Ve,isAiCfoAccessEnabled:Yr,onAskAiCfoClick:D,isCardsCommentingEnabled:G,cardsAiCfoHero:Kt,onClickPolicyIcon:g&&U?()=>n(mi(u.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:mt,onPolicyIntroTooltipClose:ja,pendingCreationCount:Ye})]})]}):(Se||ge)&&g===!0?c.jsx(ba,{to:"../setup"}):Wr?c.jsx(ba,{to:"../promo"}):c.jsx(va,{fetchState:me})}const di=e=>`/${e}/cards/new`,li=e=>`/${e}/cards/payment`,ui=e=>`/${e}/cards/payment-history`,mi=e=>`/${e}/cards/policy`,jr=[Br,Rr],Ci=new Set(jr),pi=De(function(e){const n=re.getSignedInUser(),t=fe(e),a=e.tenantState.currentTenantId,s=tr(e),y={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},f=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:pc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:y,companyName:f,spendManagementEndPoint:`${kt}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=_e(t.state?.pathnameStackToGoBack),y=s.poppedPathname??"..";a(y,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,y)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:y}}})},onFiltersChange:s=>{e(fc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{Ci.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(hc({uiState:{downloadState:s}}))}}})(ct(so));function hi(){const e=de(),n=Ce(),t=pe(),{areTenantIdsInSync:a}=gr(),{useFeatureGate:s}=le();if(re.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const y=o(g=>fe(g)),f=o(g=>tr(g)),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(null),x=!y.userRole.includes("charge_card_user"),B=!!y.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(Z.isDebitCardFeatureEnabled),D=Te(h,y),d=xe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:D}),_=we(y),k=ve(y),j=y.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,A=Be({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:d,chargeCardsCreditAccountLimit:j}),I=!!y.companyChargeCardInfo?.info?.isChargeCardEnabled,L=Fe(),i=Pe(L?.loggedInUserRoleMap),C=o(g=>ua(g,x,d&&B,A&&I)),N=r.useMemo(()=>{const g=C.cards.filter(F=>F.type.code.includes("debit"));return[...new Set(g.map(F=>F.connectedAccountId))]},[C.cards]),G=o(g=>la(g)),O=o(g=>nt(g,N)),{creditAccountRepayment:U}=o(g=>da(g)),z=r.useMemo(()=>Ot(i,G),[i,G]),W=r.useMemo(()=>Ba(A,I,i,C.creditAccount,U),[A,I,i,C.creditAccount,U]),b=r.useMemo(()=>Ut(d,B,i,O,C.debitCardSummary),[d,B,i,O,C.debitCardSummary]),T=r.useMemo(()=>Je(A,d,B,I),[A,d,B,I]),Y=C.creditAccount.balance.amount+C.creditAccount.hold.amount,q=r.useMemo(()=>u!=null?f.repaymentHistory.find(g=>g.cardRepaymentId===u):void 0,[u,f.repaymentHistory]),E=r.useCallback(g=>{M(g),t(ca(x,d&&B,A&&I,!1)),v(!0)},[t,x,d,B,A,I]),V=r.useCallback(()=>{v(!1),M(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{S||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(w(!0),t(Ga()))},[S,t,f.fetchState]),r.useEffect(()=>{!l&&(I||B)&&a&&(m(!0),t(ca(x,!1,A&&I,!1)))},[l,I,B,a,t,x,A]);const Q=ea(y),X={events:Ca(Q,jr),eventCallback:(g,F,P)=>{P.onEventReceived(g)},onSubscribed:g=>{g.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[R?c.jsx(Gt,{closeDrawerHandler:V,isPaymentDrawerOpen:R,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:Y,productInformation:T,creditAccountInformation:W,debitAccountInformation:b,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(d&&B&&i)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!A||U.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!i||G.fetchState==="Completed",paymentInitiatedDate:U.initiatedRepaymentDate,retryRepayment:q}):null,c.jsx(pi,{...X,location:n,navigate:e,accountInfoByAccountId:f.accountInfoByAccountId,onRetryPaymentClick:E})]})}const Sn=Ne.div`
26
- display: flex;
27
- height: 100vh;
28
- width: 100%;
29
- flex: 1 1 auto;
30
- flex-direction: column;
31
- overflow: auto;
32
- align-items: center;
33
- background-color: ${e=>e.theme.colors.grey4};
34
- `,bn=Xe.getLocalizedStrings().months;function fi(){const e=de(),n=pe(),t=Ce(),{creditAccount:a,creditAccountRepayment:s}=o(T=>da(T)),y=`${fr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[f,S]=r.useState(!1),[w,l]=r.useState(!1),m=o(T=>gc(T)),{useFeatureGate:R}=le(),v=o(T=>fe(T)),{isFeatureEnabled:u}=R(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=R(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:x}=R(Z.isCardsCommentingEnabled),B=Ar(x?v.companyId:void 0,{clearParams:x&&m.fetchState==="Completed"}),p=Te(M,v),h=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),D=we(v),d=ve(v),_=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,k=Be({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:u,isBookKeepingTenant:d,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:_}),j=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,A=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,I=o(T=>oa(T,v.companyId)),L=ia(I.controllers),i=o(T=>nr(T)),C=i.cards.filter(T=>T.type.code.includes("debit")).map(T=>T.connectedAccountId),N=[...new Set(C)],G=o(T=>nt(T,N)),O=o(T=>Sc(T));r.useEffect(()=>{w||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))},[f,n,a.fetchState]),r.useEffect(()=>{w||a.fetchState!=="Completed"||a.id==null||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(l(!0),n(bc(a.id)))},[w,n,a.fetchState,a.id,m.fetchState]),r.useEffect(()=>{G.fetchState!=="Completed"&&G.fetchState!=="In-Progress"&&h&&j&&n(rr()),i.fetchState!=="Completed"&&i.fetchState!=="In-Progress"&&n(je()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&j&&n(yc()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&k&&A&&n(Pt())},[G.fetchState,h,j,i.fetchState,O.fetchState,s.fetchState,k,A]),r.useEffect(()=>{if(m.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&i.fetchState==="Completed"&&(!h||!j||G.fetchState==="Completed"&&O.fetchState==="Completed")){let T="",Y="";if(m.statements.length>0){const Q=m.statements[m.statements.length-1].period,[X,g]=Q.split("-"),F=m.statements[0].period,[P,ee]=F.split("-");T=`${bn[parseInt(g)-1]} ${X}`,Y=`${bn[parseInt(ee)-1]} ${P}`}const q=Je(k,h,j,A),E=Ba(k,A,!0,a,s),V=Ut(h,j,!0,G,O);J.trackCardsCreditCardStatementsView(L,q,{numberOfStatements:m.statements.length,oldestStatementMonthYear:T,latestStatementMonthYear:Y},E,V)}},[m.fetchState,a.fetchState,s.fetchState,G.fetchState,i.fetchState,O.fetchState]);const U=()=>{const T=_e(t.state?.pathnameStackToGoBack),Y=T.poppedPathname??"..";e(Y,{state:{pathnameStackToGoBack:T.newStack}})},z=o(T=>la(T)),W=re.getSignedInUser(),b={userId:W?.userId??"",sessionId:W?.zeniSessionId??"",tenantId:v.tenantId??""};if(W==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return c.jsx(Sn,{children:c.jsx(co,{onBackClick:U})});{const T=Je(k,h,j,A);return c.jsx(Sn,{children:c.jsx(oo,{currentTenantCompanyName:v.companyName,statementListView:m,productInformation:T,onBackClick:U,authParams:b,controllerEmails:L,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:j,isChargeCardSetupEnabled:A,isCardsCommentingEnabled:x,initialOpenThreadRequest:B,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:G,debitCardSummary:O,downloadEndPoint:y})})}}const Mr=[ma,dt],gi=new Set(Mr),Si={containerWidth:new Fa(100,58)},bi=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),s=Ce(),{useDynamicConfig:y}=le(),[f,S]=r.useState(!1),[w,l]=r.useState(!1),[m,R]=r.useState(!1),[v,u]=r.useState(!1),M=r.useRef(!1),x=r.useRef(null);r.useEffect(()=>()=>{x.current!=null&&(clearTimeout(x.current),x.current=null)},[]);const[B,p]=r.useState(!1),[h,D]=r.useState(!1),d=re.getSignedInUser();if(d==null)throw Error("Can't access onboarding card page without signing in...");const _=o(V=>fe(V)),{configValue:k}=y(We.zeniCardsConfig),j=o(V=>Ic(V)),{tenantEmailDomain:A}=_,I=o(V=>V.settingsViewState.profile.fetchState),L=o(V=>V.chargeCardListState.fetchState),i=o(V=>V.settingsViewState.profile.userId),C=o(V=>V.chargeCardConfigState.fetchState);r.useEffect(()=>{f===!1&&I!=="In-Progress"&&I!=="Completed"&&(t(kc()),S(!0)),w===!1&&C!=="In-Progress"&&C!=="Completed"&&(t(Ja()),l(!0)),m===!1&&L==="Not-Started"&&(R(!0),t(je()))},[f,m,L,w,C]),r.useEffect(()=>{I==="Completed"&&B===!1&&i!=null&&L==="Completed"&&j.cards.length>0&&(t(Ec({userId:i})),t(sr({cardId:j.cards[j.cards.length-1].id})),p(!0))},[I,B,i,L]),r.useEffect(()=>{if(!v&&j.fetchState==="Completed"&&j.cards.length===0){const V=_e(s.state?.pathnameStackToGoBack),Q=V.poppedPathname??aa(A);a(Q,{state:{pathnameStackToGoBack:V.newStack}})}},[j.fetchState,j.cards,v]);const N=o(V=>Qa(V)),G=ya(N.updateStatus.fetchState),O=N.currentDisplayedCardId,{useFeatureGate:U}=le(),{isFeatureEnabled:z}=U(Z.isChargeCardFeatureEnabled),W=!!_.companyChargeCardInfo?.info?.isChargeCardEnabled,b=!_.userRole.includes("charge_card_user")&&z&&W,T=o(V=>O!=null?cr(V.chargeCardState,O):null),Y=()=>{O!=null&&(M.current=!0,x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{M.current=!1,x.current=null},5e3),t(ka(O,b,!0)),t(je(!0)),u(!0))},q=ea(_);jt({events:Ca(q,Mr),onSubscribed:()=>{t(je(!0))},onEvent:(V,Q)=>{if(!gi.has(V))return;const X=$t(Q),g=M.current;if(V===ma){const P=ie(X?.card_id)??O;if(P!=null){const ee=zt(X,P);if(ee!=null)return t(wt(ee)),void(P!==O||g||Y())}}if(V===dt)return void t(je(!0));const F=ie(X?.card_id)??O;(O==null||F===O)&&O!=null?g||Y():t(je(!0))}}),r.useEffect(()=>{if(v&&O!=null&&T!=null&&T.status.code!=="request_on_hold"){const V=Ae(_.tenantEmailDomain,O,d,T),Q=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Ac()),T?.type.code==="business_virtual_credit_card"&&t(Xa()),a(V,{state:{pathnameStackToGoBack:Q},replace:!0}),M.current=!1,x.current!=null&&(clearTimeout(x.current),x.current=null)}},[v,T?.status.code]),r.useEffect(()=>{G==="In-Progress"&&N.updateStatus.fetchState==="Completed"&&setTimeout(Y,3e3)},[G,N.updateStatus.fetchState]);const E=V=>{D(V)};if(I!=="Completed"||j.cards.length===0)return c.jsxs(yn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:E}),c.jsx(io,{})]});if(i==null)throw Error("Can't access my userId.");return c.jsxs(yn,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:E}),c.jsx(yi,{chargeCardListView:j,cardUserOnboardingView:N,navigate:a,currentTenant:_,myUserId:i,location:s,chargeCardCashbackRatePerTransaction:k.charge_card_cashback_rate_per_transaction!=null?k.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{E(!0)}}),e!=null?c.jsx(Ii,{windowSize:n,children:e}):null]})},yi=De(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const y=ua(e,!1,!1,!1);let f=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(f=!0),{cards:a.cards,showMenuIcon:f,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}},function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:y}=n,{tenantEmailDomain:f}=y;return{updateCardUserOnboardingLocalData:S=>{e(Cn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const w={...a.cardUserOnboardingLocalData,phone:S};e(Cn({localData:w}))}e(tt(S,"CardUserOnboarding"))},onResendOtp:S=>{e(at(S,"CardUserOnboarding"))},onVerifyOtp:(S,w)=>{e(et(S,w,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(Dc()),S!=null&&re.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(sr({cardId:S}))},onBackClick:()=>{const S=_e(s.state?.pathnameStackToGoBack),w=S.poppedPathname??aa(f);t(w,{state:{pathnameStackToGoBack:S.newStack}})}}})(lo),Ii=Ne.div`
35
- display: flex;
36
- flex-direction: column;
37
- width: ${e=>`${Si.containerWidth.value(e.windowSize)}%`};
38
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
39
- `,yn=Ne.div`
40
- display: flex;
41
- min-height: 100%;
42
- width: 100%;
43
- flex: 1 1 auto;
44
- flex-direction: column;
45
- align-items: center;
46
- background-color: ${e=>e.theme.colors.grey4};
47
- `,ki={containerWidth:new Fa(100,58)},Ei=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f,useFeatureGate:S}=le(),[w,l]=r.useState(!1),[m,R]=r.useState(!1),[v,u]=r.useState(!1),[M,x]=r.useState(!1),B=re.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const p=o(b=>fe(b));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=f(We.zeniCardsConfig),D=o(b=>_c(b,s)),{isFeatureEnabled:d}=S(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=S(Z.isDebitCardFeatureEnabled),k=Te(_,p),j=xe({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:k}),A=we(p),I=ve(p),L=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Be({isCardsOnlyTenant:A,isChargeCardFeatureEnabled:d,isBookKeepingTenant:I,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:L}),C=D.chargeCard,N=o(b=>b.chargeCardConfigState.fetchState);r.useEffect(()=>{w===!1&&N!=="In-Progress"&&N!=="Completed"&&(t(Ja()),l(!0)),m===!1&&D.fetchState==="Not-Started"&&(R(!0),t(ka(s,!1,i)))},[m,D.fetchState,w,N]);const G=C?.type.code==="business_physical_debit_card"||C?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(v===!1&&(G===!1||G&&C.status?.code!=="active"||G&&C.status.code==="active"&&C.isPinSet||C.cardHolderUserId!==B.userId)){const b=Ae(p.tenantEmailDomain,s,B,C,!0),T=ye(y.state?.pathnameStackToGoBack,y.pathname);a(b,{state:{pathnameStackToGoBack:T}})}else if(v&&D.isRefreshingViewInBackground===!1&&C?.isPinSet===!0){t(Pc({chargeCardId:s}));const b=Ae(p.tenantEmailDomain,s,B,C,!0),T=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(b,{state:{pathnameStackToGoBack:T}})}}},[D.fetchState,C?.type.code,v,D.isRefreshingViewInBackground]);const O=re.getZeniOtpTokenForCardHolder(s),U=o(b=>Mn(b.userState,B.userId)),z=()=>{C?.isPinSet!==!0&&t(ga(s,!0))};r.useEffect(()=>{D.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),u(!0))},[D.updateDebitCardPinAttemptFetchState.fetchState]);const W=b=>{x(b)};if(N!=="Completed"||C==null)return c.jsx(va,{fetchState:"In-Progress"});if(U?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(_i,{children:[c.jsx(Ie,{isAppContentDrawerOpen:M,handleDrawerToggle:W}),c.jsx(Ai,{cardId:s,card:C,phone:U.phone,signedInUser:B,isSandboxEnv:xt(),debitCardDetailState:D,signedInUserToken:O,navigate:a,currentTenant:p,location:y,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{W(!0)}}),e!=null?c.jsx(Di,{windowSize:n,children:e}):null]})},Ai=De(function(e,{debitCardDetailState:n,cardId:t}){const a=Nn(e,t),s=n.updateStatus,y=ua(e,!1,!1,!1);let f=!1;return y.fetchState==="Completed"&&y.cards.length<=1&&(f=!0),{showMenuIcon:f,vgsVaultId:st.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,debitCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:l=>{e(Yn(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onSetPinSuccess:()=>{e(wc({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("activate")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(uo),Di=Ne.div`
48
- display: flex;
49
- flex-direction: column;
50
- width: ${e=>`${ki.containerWidth.value(e.windowSize)}%`};
51
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
52
- box-shadow: ${e=>`${Za.sp0} 2px ${Za.sp1} ${e.theme.colors.dropShadowNormal}`};
53
- `,_i=Ne.div`
54
- display: flex;
55
- min-height: 100%;
56
- width: 100%;
57
- flex: 1 1 auto;
58
- flex-direction: column;
59
- align-items: center;
60
- background-color: ${e=>e.theme.colors.grey4};
61
- box-shadow: ${e=>`${Za.sp0} 2px ${Za.sp1} ${e.theme.colors.dropShadowNormal}`};
62
- `,Pi={overlayWidth:new Fa(pt[12],pt[12],pt[9])},wi=De(function(e,n){const t=Tt(e,!1,!1),a=n.lineId,s=t.customAddress[a],y=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:y,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:y=>{t!=null&&e(or(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const f=Do(y);e(Fc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:f})),e(xc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Tc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(mo),vi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Bt(),s=Ta(),y=()=>{n()},f=o(S=>vc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S))?.newAddressId;return c.jsx(br,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Pi.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,w)=>(w==="backdropClick"||w==="escapeKeyDown")&&y(),children:c.jsx(wi,{googleAPIKey:st.googleMapsAPIKey,onDismissClick:y,lineId:e,chargeCardTypeOption:t,newCustomAddressId:f})})},Ti=De(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:S}=n,w=Tt(e,t&&f,a&&S);return{issueChargeCards:w,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:y,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:f,isDebitCardSetupEnabled:S,cardHolderCandidates:w.userList.map(l=>l.user).filter(Boolean),allRoles:w.userList.map(l=>l.userRole),allAccountingClasses:w.allAccountingClasses,userList:w.userList}},function(e,n){return{onIssueCardClick:()=>{e(Lc())},onSaveChangesToLocalStore:t=>{e(Rc(t))},onDismissClick:()=>{e(ir()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(or(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(ho);function Fi(){const e=re.getSignedInUser(),n=de(),t=pe(),a=Co(),[s]=In(),y=s.get("cardType"),{useFeatureGate:f}=le(),{isFeatureEnabled:S}=f(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:w}=f(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:l}=f(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=f(Z.isChargeCardFeatureEnabled),R=o(z=>fe(z)),v=Te(l,R),u=xe({isDebitCardFeatureEnabled:l,isBankingOnlyTenant:v}),M=we(R),x=ve(R),B=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:m,isBookKeepingTenant:x,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:B}),[h,D]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{h||(D(!0),t(Bc(u&&_,p&&d,!1)))},[h,D,t]);const d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!!R.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(z=>Tt(z,p&&d,u&&_)),j=k.fetchState,A=k.issueCardStatus.fetchState,I=k.lastSelfIssuedDebitCardId,L=o(z=>I!=null?cr(z.chargeCardState,I):void 0),[i,C]=r.useState(null),[N,G]=r.useState(null),O=()=>{C(null)},U=(z,W)=>{C(z),G(W)};return r.useEffect(()=>{if(A==="Completed"){if(I!=null&&L?.type.code==="business_virtual_debit_card"){let z;z=L?.status.code==="request_on_hold"&&e.userId===L.cardHolderUserId?Er(R.tenantEmailDomain):Ae(R.tenantEmailDomain,I,e,L),n(z)}else n("../");t(ir())}},[A,I]),j==="Completed"?c.jsxs(c.Fragment,{children:[i!==null&&N!==null?c.jsx(vi,{closeDrawerHandler:O,lineId:i,chargeCardTypeOption:N}):null,c.jsx(Ti,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:w,isDebitCardFeatureEnabled:u,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:d,isDebitCardSetupEnabled:_,navigate:n,fetchState:k.fetchState,openAddAddressDrawerHandler:U,defaultCardType:y==="creditCard"||y==="debitCard"?y:void 0})]}):j==="Error"?c.jsx(ot,{}):c.jsx(po,{})}const Nr=[ma,dt],xi=new Set(Nr),Bi=Ne.div`
63
- display: flex;
64
- height: 100vh;
65
- width: 100%;
66
- flex: 1 1 auto;
67
- flex-direction: column;
68
- overflow: auto;
69
- align-items: center;
70
- background-color: ${e=>e.theme.colors.grey4};
71
- `,Ri=De(function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:y,myPendingActivationChargeCardListState:f}=n,{tenantEmailDomain:S}=a,{cards:w}=f;return{onChargeCardRowClick:l=>{const m=kr(w,l),R=Ae(S,l,y,m),v=ye(s.state?.pathnameStackToGoBack,s.pathname);t(R,{state:{pathnameStackToGoBack:v}})},onColumnSortConfigChanged:(l,m)=>{e(yt({uiState:{sortKey:l,sortOrder:m}}))},onReloadCards:()=>{e(je())},onBackClick:()=>{const l=a.userRole.includes("charge_card_user");e(yt({uiState:{sortKey:l?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(fo);function Li(){const e=de(),n=pe(),t=Ce(),a=Bt(),[s,y]=r.useState(!1),f=o(U=>Oc(U)),S=o(U=>fe(U)),w=o(U=>oa(U,S.companyId)),l=ia(w.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=m(Z.isDebitCardFeatureEnabled),u=Te(v,S),M=xe({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:u}),x=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,B=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Fe(),h=we(S),D=ve(S),d=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Be({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:R,isBookKeepingTenant:D,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:d}),k=Pe(p?.loggedInUserRoleMap),j=o(U=>la(U)),{creditAccount:A,creditAccountRepayment:I}=o(U=>da(U)),L=o(U=>nr(U)).cards.filter(U=>U.type.code.includes("debit")).map(U=>U.connectedAccountId),i=[...new Set(L)],C=o(U=>nt(U,i));r.useEffect(()=>{s||f.fetchState==="Completed"||f.fetchState==="In-Progress"||(y(!0),n(je()),n(Ja()))},[s,n,f.fetchState]),r.useEffect(()=>{if(f.fetchState==="Completed"&&f.cards.length===1&&N!=null){const U=Ae(S.tenantEmailDomain,f.cards[0].id,N,f.cards[0]);e(U,{state:{message:t.state?.message}})}},[f.fetchState,f.cards]);const N=re.getSignedInUser();r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&_&&B&&k&&n(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&k&&n(Pt()),C.fetchState!=="Completed"&&C.fetchState!=="In-Progress"&&M&&x&&k&&n(rr())},[A.fetchState,I.fetchState,n,C.fetchState,M,x,k,_,B]);const G=ea(S);if(jt({events:Ca(G,Nr),onEvent:(U,z)=>{if(!xi.has(U))return;const W=$t(z);if(U===ma){const b=ie(W?.card_id);if(b!=null){const T=zt(W,b);if(T!=null)return void n(wt(T))}}n(je(!0))},onSubscribed:()=>{n(je(!0))}}),N==null)throw Error("Can't access address page without signing in...");const O=f.cards!=null&&f.cards.length>0;if(f.fetchState==="Completed"||O){const U=Je(_,M,x,B);return c.jsx(Bi,{children:c.jsx(Ri,{navigate:e,currentTenant:S,signedInUser:N,productInformation:U,myPendingActivationChargeCardListState:f,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:M,isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:B,chargeCardCashbackDetailState:j,creditAccount:A,creditAccountRepayment:I,depositAccountListWithDebitCardIssued:C,controllerEmails:l,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const Oi=De(function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:y,isChargeCardSetupEnabled:f,signedInUser:S,location:w,productInformation:l,isEarlyPayEnabled:m,controllerEmails:R,chargeCardsCreditAccountLimit:v}=n;return{onSetupButtonClick:u=>{if(S!=null&&J.trackCardsPromoPageClicked("enable cards"),s)switch(J.trackCardsEnableCardsClick(R,l,"Cards Promo"),u){case"credit":e(qe(a,!0,"charge_cards",m,!1));break;case"debit":e(qe(a,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(v===0?qe(a,!0,"debit_cards",m,!0):qe(a,!0,"charge_cards__debit_cards",m,!1))}else switch(J.trackCardsSetupCardsClick(R,l,"Cards Promo"),u){case"credit":e(qe(a,!1,"charge_cards",m,!1));break;case"debit":e(qe(a,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(v===0?qe(a,!1,"debit_cards",m,!0):qe(a,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const u=_e(w.state?.pathnameStackToGoBack);let M=u.poppedPathname;M==null&&(M=y||f?"..":"../.."),t(M,{state:{pathnameStackToGoBack:u.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Mc(a))}}})(So),Ui=()=>{const e=de(),{tenantEmailDomain:n}=Me(),[t]=In(),a=t.get("cardPromoType"),s=pe(),{useDynamicConfig:y,useFeatureGate:f}=le(),[S,w]=r.useState(!1),{isFeatureEnabled:l}=f(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:m}=f(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:R}=f(Z.isChargeCardFeatureEnabled),{configValue:v}=y(We.zeniCardsConfig),u=o(ne=>fe(ne)),M=o(ne=>oa(ne,u.companyId)),x=ia(M.controllers),B=v.charge_card_cashback_rate_per_transaction!=null?v.charge_card_cashback_rate_per_transaction:.0175,p=Ce(),h=re.getSignedInUserTenant(n)?.companyId??u.companyId,D=o(ne=>wa(ne,h)),d=D.primaryFundingAccount,_=u.companyBillPayInfo?.info,k=we(u),j=ve(u),A=Te(l,u),I=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=xe({isDebitCardFeatureEnabled:l,isBankingOnlyTenant:A}),i=Be({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:R,isBookKeepingTenant:j,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:I}),C=Ir({isCardsOnlyTenant:k,isChargeCardFeatureEnabled:R,isBookKeepingTenant:j}),N=L&&i===!1,G=_?.businessVerificationStatus?.code==="verified"&&(N||d?.accType==="depositAccount"||Uc(d?.providerVerificationStatus?.code??"")),O=re.getSignedInUser(),U=!!u.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!u.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,W=!!u.company?.companyChargeCardInfo.isChargeCardEnabled,b=!!u.company?.companyDebitCardInfo.isDebitCardEnabled,T=!!u.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,Y=ne=>{w(ne)},q=o(ne=>ne.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Fe(),V=Pe(E?.loggedInUserRoleMap),Q=vt(E?.loggedInUserRoleMap),[X,g]=r.useState(!1),[F,P]=r.useState(!1),[ee,K]=r.useState(!1);r.useEffect(()=>{X===!1&&p.state?.message==="activation"&&g(!0)},[p.state]),r.useEffect(()=>{F||q!=="Not-Started"||h==null||(P(!0),s(Pa(h,!0)))},[F,q,h,s]);const ke=u.companyChargeCardInfo?.info!=null&&Ia({cardInfo:u.companyChargeCardInfo.info,isProductVisible:C,isTOSAccepted:z,isSetupEnabled:W,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:Q}),Se=u.companyDebitCardInfo?.info!=null&&Ia({cardInfo:u.companyDebitCardInfo.info,isProductVisible:L,isTOSAccepted:T,isSetupEnabled:b,isUserHasCardsAdminLevelAccess:V,isUserHasCardsAccess:Q}),ge=L&&Se&&C&&I>=0&&ke?"debit_and_credit":L&&Se?"debit":"credit",ae=Ao(a,ge),ue=D?.chargeCardTermsDetails?.fetchStatus?.fetchState,oe=r.useRef(null);r.useEffect(()=>{ue==="In-Progress"?oe.current=ae:ue!=="Error"&&ue!=="Not-Started"||(oe.current=null)},[ue,ae]);const te=ue!=="In-Progress"&&ue!=="Completed"||oe.current==null?ae:oe.current;r.useEffect(()=>{ae==="credit"&&(W||C===!1&&b)||ae==="debit"&&b||ae==="debit_and_credit"&&b&&W?e("../"):(ae==="debit_and_credit"&&z===!0&&T===!0||ae==="credit"&&(z===!0||C===!1&&T===!0)||ae==="debit"&&T===!0)&&V===!0&&e("../setup")},[G,W,b,ae,z,T]),r.useEffect(()=>{ee||(s(jc("cardAdmin")),K(!0))},[ee]);const Ye=o(ne=>ar(ne.userState,ne.userRoleState,ne.userListViewState,"cardAdmin")),Ee=Je(C,L,b,W);return(ke||Se)&&q==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Rt,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(Sr.Event.cardsPromoPage),!!C&&!W||!!L&&!b||!!C&&!!L&&!b&&!W){const ne=ji({isDebitCardSetupEnabled:b,isChargeCardSetupEnabled:W,isCreditCardProductVisibleForExpressInterest:C,isDebitCardProductVisible:L});J.trackCardsPromoView(x,Ee,"Page",ne,"Promo Page")}}}),c.jsx(rt,{showConfetti:X}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:Y}),c.jsx(Oi,{signedInUser:O,location:p,showEnableCardButton:G,isCompanyBusinessVerificationAndPaymentSetUpDone:G,isChargeCardSetupEnabled:W,isDebitCardSetupEnabled:b,companyLegalName:u.companyName,adminList:Ye.users,isCheckingEnabled:U,navigate:e,companyId:h,cardPromoType:te,controllerEmails:x,productInformation:Ee,isCreditCardProductVisible:i,isDebitCardFeatureEnabled:l,isEarlyPayEnabled:m,cashbackRate:B,chargeCardsCreditAccountLimit:I,onClickMenuIcon:()=>{Y(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:Y}),c.jsx(go,{})]})},ji=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function ld(){const e=Ce(),n=o(E=>fe(E)),{useFeatureGate:t}=le(),{isFeatureEnabled:a}=t(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:y}=t(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:f}=t(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(Z.isCardPolicyEnabled),w=Te(s,n),l=xe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:w}),m=bo(n,a,s),R=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,v=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,u=!!n.company?.companyChargeCardInfo.isChargeCardEnabled,M=!!n.company?.companyDebitCardInfo.isDebitCardEnabled,x=Fe(),B=Pe(x?.loggedInUserRoleMap),p=vt(x?.loggedInUserRoleMap),{isFeatureEnabled:h}=t(Z.isCashbackFeatureEnabled),D=n.userRole.includes("charge_card_user"),d=!D,_=!D&&u,k=n?.userRole!=null&&Nc(n?.userRole),j=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!k)&&Vc(x?.loggedInUserRoleMap),A=Hc(x?.loggedInUserRoleMap),I=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!k)&&Gc(x?.loggedInUserRoleMap),{isFeatureEnabled:L}=t(Z.isDepositAccountsFeatureEnabled),i=L&&!k&&Hn(x?.loggedInUserRoleMap),C=u&&!k,N=M&&!k,G=m&&!k&&Pe(x?.loggedInUserRoleMap),O=$c(x?.loggedInUserRoleMap),U=we(n),z=ve(n),W=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,b=Be({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:a,isBookKeepingTenant:z,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:W}),T=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:b,isTOSAccepted:R,isSetupEnabled:u,isUserHasCardsAdminLevelAccess:B,isUserHasCardsAccess:p}),Y=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:l,isTOSAccepted:v,isSetupEnabled:M,isUserHasCardsAdminLevelAccess:B,isUserHasCardsAccess:p}),q=T||Y;return c.jsxs(es,{children:[B?c.jsx(se,{path:"setup",element:c.jsx(pn,{isBillPayAdminLevelAccess:j,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:i,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,isUserHasOnlyBillPayAccess:A,productType:"charge_cards",type:"setup"})}):null,B?c.jsx(se,{path:"verification",element:c.jsx(pn,{isBillPayAdminLevelAccess:j,isUserHasOnlyBillPayAccess:A,isReimbursementAdminLevelAccess:I,isZeniAccountAdminLevelAccess:i,isChargeCardAdminLevelAccess:G,isUserHasOnlyCardAccess:O,productType:"charge_cards",type:"verification"})}):null,B&&S?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"policy",element:c.jsx(jo,{})}),c.jsx(se,{path:"policy/new",element:c.jsx(vo,{})}),c.jsx(se,{path:"policy/:templateId/edit",element:c.jsx(Bo,{})})]}):null,c.jsx(se,{path:"promo",element:c.jsx(Ui,{})}),C||N?c.jsxs(c.Fragment,{children:[c.jsx(se,{path:"/",element:c.jsx(gn,{isPaymentDrawerOpen:!1})}),G&&y?c.jsx(se,{path:"payment",element:c.jsx(gn,{isPaymentDrawerOpen:!0})}):null,c.jsx(se,{path:"activate",element:c.jsx(Li,{})}),c.jsx(se,{path:"onboard",element:c.jsx(bi,{})}),B?c.jsx(se,{path:"new",element:c.jsx(Fi,{})}):null,h&&d?c.jsx(se,{path:"cashback",element:c.jsx(Go,{})}):null,_?c.jsx(se,{path:"statements",element:c.jsx(fi,{})}):null,G&&f&&u?c.jsx(se,{path:"payment-history",element:c.jsx(hi,{})}):null,c.jsx(se,{path:":cardId/activate",element:c.jsx(Wo,{})}),c.jsx(se,{path:":cardId/setPin",element:c.jsx(Ei,{})}),c.jsx(se,{path:":cardId/addToWallet",element:c.jsx(Mo,{})}),c.jsx(se,{path:":cardId/*",element:c.jsx(ti,{})}),c.jsx(se,{path:"*",element:c.jsx(ot,{})})]}):(R||v)&&B?c.jsx(se,{path:"*",element:c.jsx(ba,{to:"../setup"})}):q?c.jsx(se,{path:"*",element:c.jsx(ba,{to:"../promo",state:e.state})}):c.jsx(se,{path:"*",element:null})]})}export{ld as default};
@@ -1 +0,0 @@
1
- import{j as m}from"./liveblocks-evjZPqs_.js";import{a as g}from"./sentry-CCZGmBkl.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-DmAftQ4g.js";import{z as h,bc as P,x as F,c as A,e as V,af as b,bd as j,au as L,av as U,q as B}from"./index-DsVH62ZK.js";import{eW as N,gh as M,tA as R,gc as _,c6 as z,Ph as G,bn as Y,rA as q,ro as H,l3 as W,mE as S,Pi as Z,bE as $,cy as C,mO as J,mR as K}from"./zeni-epic-state-vtQ66nN6.js";import"./mui-PcDpEhsm.js";import{d as Q}from"./routePaths-Dq5U7lhs.js";import{M as X}from"./MobileAppDrawer-BuakBUGx.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]="1329db67-3963-4e63-9401-6e55a94abcad",a._sentryDebugIdIdentifier="sentry-dbid-1329db67-3963-4e63-9401-6e55a94abcad")}catch{}})();const ee=E(function(a){const t=_(a),i=h.getSignedInUser(),l=N(a),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(a,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const n=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(W({files:e}))},onDeleteFile:e=>{a(H(e))},onEditFileName:(e,n)=>{a(q(e,n.split(".")[0]))}}})(j);function de(){const a=w(),t=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>N(s)),d=r.companyId??h.getSignedInUserTenant(l)?.companyId;if(h.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),t(M(d)))},[c,n,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(R())},[o,t]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,11 +0,0 @@
1
- import{j as C}from"./liveblocks-evjZPqs_.js";import{a}from"./sentry-CCZGmBkl.js";import{u as D,g as v,j as u,N as w}from"./core-DmAftQ4g.js";import{LR as O,eW as _,f$ as A,o7 as L,gq as E,f_ as j,fx as U,LY as $}from"./zeni-epic-state-vtQ66nN6.js";import{u as F,z as m,L as g,O as k,o as H}from"./index-DsVH62ZK.js";import{n as R}from"./mui-PcDpEhsm.js";import{t as z}from"./getLocaleForTenant-C55KVru2.js";import{g as P,Q as q}from"./QBOConnectionScreen-Cx74YOuE.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="e4dfbb67-e431-4f5d-a801-dcb24d61b7f6",t._sentryDebugIdIdentifier="sentry-dbid-e4dfbb67-e431-4f5d-a801-dcb24d61b7f6")}catch{}})();const G=R.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 ${H.sp1} ${t.theme.colors.dropShadowNormal}`};
11
- `;function pe(){const t=D(),i=v(),{setLoading:d,clearAllLoading:h}=F(),p=a.useRef(!1),c=a.useRef(!1),{code:x,realmId:T,state:y}=P(i.search),N=x!==""&&T!==""&&y!=="",I=u(l=>O(l)),e=u(l=>_(l)),n=u(l=>l.tenantState.fetchState),r=u(l=>l.tenantState.activeTenantFetchState.fetchState),o=m.getSignedInUser(),f=m.getActiveTenantForUser()?.tenantId,s=e?.externalConnections?.fetchState,b=e?.externalConnections?.saveConnectionState,S=e.externalConnections?.accounting[0]?.isValid;return a.useLayoutEffect(()=>{d(g.CONNECTION_AUTH)},[d]),a.useEffect(()=>{p.current||o==null||f==null||(p.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(d(g.TENANT_FETCHING),t(A(o.userId,f))))},[p,n,d]),a.useEffect(()=>{e.tenantId==null&&!c.current&&o!=null&&(c.current=!0,!(f==null||f!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(L(o.userId)))},[c,n,r]),a.useEffect(()=>{o==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||b!=="Error"||(d(g.CONNECTION_AUTH),t(E(o.userId,e.tenantId)))},[b]),a.useEffect(()=>{n!=="Completed"&&r!=="Completed"||o==null||e?.tenantId==null||(t(j(e.tenantId)),m.saveActiveTenantDomainForUser(e.tenantEmailDomain),U(o?.userId,o?.zeniSessionId,e.tenantId),k.updateAppLocaleID(z($(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||o==null||e==null||t(E(o.userId,e.tenantId)))},[n,r,s]),a.useEffect(()=>{I.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&m.saveSignedInUserTenants(I.tenantsCoreDetailsInOrder)},[I.tenantsCoreDetailsInOrder.length,n]),a.useEffect(()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||s!=="Completed"&&s!=="Error"||h()},[n,r,s]),e==null||n!=="Completed"&&r!=="Completed"||s!=="Completed"?null:N||S===!1?C.jsx(G,{children:C.jsx(q,{})}):C.jsx(w,{to:"/",replace:!0})}export{pe as default};
@@ -1 +0,0 @@
1
- import{j as i}from"./liveblocks-evjZPqs_.js";import{z as n}from"./index-DsVH62ZK.js";import{g as d}from"./QBOConnectionScreen-Cx74YOuE.js";import"./sentry-CCZGmBkl.js";import{g as p,N as s}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{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 i}from"./liveblocks-evjZPqs_.js";import{Z as f,y as l,m as c}from"./index-DsVH62ZK.js";import{D as p}from"./mui-PcDpEhsm.js";import"./sentry-CCZGmBkl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="9996a4f2-8bda-486e-9d31-afd7ccfdb1f8",e._sentryDebugIdIdentifier="sentry-dbid-9996a4f2-8bda-486e-9d31-afd7ccfdb1f8")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function m(e){const{isOpen:r,drawerLeftMargin:o,children:a,onClose:t}=e,n=f(),d=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),s=c();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${d})`}},slotProps:{backdrop:{style:{backgroundColor:s.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:a})}export{m as D};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-evjZPqs_.js";import{a as d}from"./sentry-CCZGmBkl.js";import{h as A,u as B,g as q,i as G,j as l,N as O,n as F,o as W,p as _}from"./core-DmAftQ4g.js";import{Oe as z,eW as K,NC as M,lv as R,K7 as I,Oj as V,N5 as Y,kv as $,K8 as S,NH as H,NI as J,N7 as L,N6 as Q}from"./zeni-epic-state-vtQ66nN6.js";import{aV as U,c as X,p as Z,q as tt}from"./index-DsVH62ZK.js";import"./mui-PcDpEhsm.js";import{d as k}from"./decodeURIComponentSafe-C70tsXnj.js";import{w as et}from"./withTransactionSidePanel-iGXE6khP.js";import{f as at,c as nt}from"./routePaths-Dq5U7lhs.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./useAskAiCfoHostNavButtonProps-uVGdd0zj.js";import"./TransactionDetailScreen-DUZV5JDK.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]="a036777d-bd32-4cdf-a93f-8baf12839a35",a._sentryDebugIdIdentifier="sentry-dbid-a036777d-bd32-4cdf-a93f-8baf12839a35")}catch{}})();const ot=F(function(a,t){const e=t.entity,o=V(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:Y(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:$(a)}},function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(L({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(Q("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??b();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}))}}}})(U),it=et(function({entityType:a,...t}){const e=A(),o=B(),c=q(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:v,entityNameEncoded:N}=G(),r=k(v??""),p=k(N??""),f=rt(r,p),j=[r,p].filter(n=>n!=null),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l(n=>z(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter")),w=l(n=>K(n).company?.companyInfo.firstMonthOfFY??1),u=l(n=>M(n.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&f===!0&&(T(!0),o(R(i)))},[m,f,i]);const E=l(n=>n.trendState.fetchState),P=u?.selectedPeriod?.timePeriod??g,x=function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y}(u?.selectedPeriod?.timePeriod,g);return d.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:w,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:x,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(O,{to:b(j.length)})}),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,b=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function vt({entityType:a}){return s.jsx(W,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{vt as EntityDetailRoutes,vt as default};
@@ -1 +0,0 @@
1
- import{a as r}from"./sentry-CCZGmBkl.js";import{u as f,h as l,g as m}from"./core-DmAftQ4g.js";import{hr as p,Md as g,Me as b}from"./zeni-epic-state-vtQ66nN6.js";import{u as _,L as h,z as y}from"./index-DsVH62ZK.js";import"./liveblocks-evjZPqs_.js";import"./recharts-CgEqsrFw.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="ecfed5e1-955d-492b-bd39-551dfbc5f527",e._sentryDebugIdIdentifier="sentry-dbid-ecfed5e1-955d-492b-bd39-551dfbc5f527")}catch{}})();function R(){const e=f(),n=l(),o=m(),{setLoading:i,clearAllLoading:u}=_(),s=r.useRef(!1);return r.useLayoutEffect(()=>{i(h.CONNECTION_AUTH)},[i]),r.useEffect(()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(p(t.tenant_id,t.connection_id,g("revenue"),b("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})},[]),null}export{R as default};
@@ -1,72 +0,0 @@
1
- import{j as t}from"./liveblocks-evjZPqs_.js";import{i as S,n as x,h as C,g as y,u as ee,t as te,j as E,N as ae,o as ne,p}from"./core-DmAftQ4g.js";import{M6 as k,M7 as v,M8 as F,B9 as B,AX as T,M9 as A,Ma as oe,Mb as ie,A$ as se,fx as $,B6 as le,B3 as re}from"./zeni-epic-state-vtQ66nN6.js";import{Z as g,o as r,j as de,c as j,i as G,k as ce,p as me,r as pe,q as H,W as ue,U as he,s as xe,v as ge,m as fe,w as be,B as we,x as Se,D as ye,S as ke,H as ve,y as je,A as $e}from"./index-DsVH62ZK.js";import{n as m}from"./mui-PcDpEhsm.js";import f from"./NotFoundScreen-AsC21qGx.js";import{a as I}from"./sentry-CCZGmBkl.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="cd6936ec-5fb6-48b9-bf57-8085de64907b",e._sentryDebugIdIdentifier="sentry-dbid-cd6936ec-5fb6-48b9-bf57-8085de64907b")}catch{}})();const Ie=m.div`
2
- display: flex;
3
- 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
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
- `,Ce=x(function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}},function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(T(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(B(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(F({data:l}))}}})(de);function M(){const e=g(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const Be=m.div`
11
- display: flex;
12
- height: 100vh;
13
- width: 100%;
14
- flex: 1 1 auto;
15
- flex-direction: column;
16
- align-items: center;
17
- background-color: ${e=>e.theme.colors.grey4};
18
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,Ae=x(function(e,a){const{isSubPage:n}=a;return{addressToEdit:A(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}},function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}})(ce);function De({isSubPage:e}){const a=C(),n=y(),o=g();return t.jsx(t.Fragment,{children:t.jsx(Be,{windowSize:o,children:t.jsx(Ae,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
20
- display: flex;
21
- height: 100%;
22
- width: 100%;
23
- flex: 1 1 auto;
24
- flex-direction: column;
25
- align-items: center;
26
- background-color: ${e=>e.theme.colors.grey4};
27
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ne=x(function(e){const a=k(e),n=v(e),o=A(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}},function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(T(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(F({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}})(pe);function Ee(){const e=C(),a=y(),n=g(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Le,{windowSize:n,children:t.jsx(Ne,{location:a,navigate:e,vendorId:o,billId:i})})})}const Me=m.div`
29
- display: flex;
30
- height: 100%;
31
- width: 100%;
32
- flex: 1 1 auto;
33
- flex-direction: column;
34
- align-items: center;
35
- background-color: ${e=>e.theme.colors.grey4};
36
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Fe=x(function(e){const a=k(e),n=v(e),o=A(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}},function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}})(xe);function Te(){const e=C(),a=y(),n=g(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Me,{windowSize:n,children:t.jsx(Fe,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},He=m(ke)`
38
- width: ${r.sp4};
39
- height: ${r.sp4};
40
- margin-bottom: ${r.sp3};
41
- margin-top: ${r.sp3};
42
- margin-left: ${r.sp8};
43
- cursor: pointer;
44
- position: absolute;
45
- color: ${e=>e.theme.colors.brandColorJade};
46
- `,Ve=m.div`
47
- display: flex;
48
- height: 100vh;
49
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
- width: 100vw;
51
- overflow-y: scroll;
52
- background-color: ${e=>e.theme.colors.grey4};
53
- `,We=m.div`
54
- display: flex;
55
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
- flex-direction: column;
57
- width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
- padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
61
- `,_e=m.div`
62
- display: flex;
63
- flex-direction: column;
64
- align-items: center;
65
- justify-content: center;
66
- padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
67
- height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
- overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
- width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
- background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
- margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,Ke=x(function(e,a){return{file:a.file,type:a.type}})(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),V=n.pathname.includes("address"),b=g(),W=ge(),D=fe(),w=be(),_=()=>{W.toggle()},K=E(u=>k(u)),U=E(u=>v(u)),{authParams:q,fetchState:c,billAttachment:X,billFetchState:P,companyName:J,currencySymbol:O,amount:Q}=K,{tenantId:z,userId:L,sessionId:N}=q,{fetchState:Z,internationalBankAccountCreateStatus:R}=U;return I.useEffect(()=>{$()},[]),I.useEffect(()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))},[w,c,i,o,d,a]),I.useEffect(()=>{w&&c==="Completed"&&($(L,N,z),l!=null&&a(re(l)))},[c,w,L,N,z,l,a]),c==="Error"?t.jsx(f,{}):Z==="Completed"||R.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:D.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${D.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",J,l??"",Ue(n.pathname),O,Q))(u)}),t.jsxs(Ve,{windowSize:b,children:[b!=="small"?t.jsx(He,{onClick:_}):null,t.jsx(_e,{windowSize:b,isAddressPage:V,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(Ke,{file:X,type:"bill"})}),t.jsx(We,{windowSize:b,children:e})]})]})}const Ue=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function qe(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(qe,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(M,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(M,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(De,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Te,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -1,12 +0,0 @@
1
- import{j as u}from"./liveblocks-evjZPqs_.js";import{a as g}from"./sentry-CCZGmBkl.js";import{u as j,g as O,h as _,t as w,j as l,N as T}from"./core-DmAftQ4g.js";import{z as r,m as P,O as V,d as A,c as N,e as W,F as R,D as X,g as Z}from"./index-DsVH62ZK.js";import{eW as $,LT as q,M1 as B,LU as G,fx as H,f_ as J,LZ as K,gm as Q,cX as Y,M2 as ee,M3 as te}from"./zeni-epic-state-vtQ66nN6.js";import{n as ne}from"./mui-PcDpEhsm.js";import{u as ae}from"./useDeviceId-DGJPBja9.js";import{f as se}from"./analyticsHelper-CQXeRvKo.js";import{t as ie}from"./getLocaleForTenant-C55KVru2.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="d0d5a8a8-03b3-4195-bae5-abe71323d401",t._sentryDebugIdIdentifier="sentry-dbid-d0d5a8a8-03b3-4195-bae5-abe71323d401")}catch{}})();const x=(t,s)=>t!=null&&t.length>0&&s==="magic_links";function xe(){const t=j(),s=O(),f=_(),[k]=w(),n=k.get("token"),p=k.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=ae(),{otpChallenge:d,twoFAPhoneNumber:D,magicLinkEmail:c,verifyDeviceFetchState:z,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=>$(e)),b=l(e=>q(e)),E=r.getSignedInUser(),v=P().mode;g.useEffect(()=>{a?.zeniSessionId==null&&n!=null&&x(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(B(n,i,m)))},[n,p,t,i,m,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(G(b.tenantsInOrder),a.zeniSessionId),H(a.userId,a.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),se(a,o,v,void 0,b.tenantsInOrder),Q().then(()=>{const e=Z();e!=null&&A(e)}),setTimeout(()=>{N.trackLogin(W.Event.loginSuccess,"email",Y(o.productSettings))},2e3))},[I,S,y,a,o,b,v,s.state,t]);const F=g.useCallback(()=>{f("/signin/auth")},[f]),M=g.useCallback(()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))},[i,d,t,c]),U=g.useCallback(e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))},[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(R,{phoneNumber:D,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:M,onVerifyOtp:U,onCancelVerifyDevice:F});if(I==="In-Progress"&&S==="Completed"&&a?.zeniSessionId!=null&&o!=null||E!=null){const e=s.state?.origin??"/";return u.jsx(T,{to:e,state:{...s.state,origin:""}})}if(!x(n,p)||m==null||h==="Error"){const e=s.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(T,{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(X,{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{xe as default};