Skip to content

Conversation

@stalniy
Copy link
Contributor

@stalniy stalniy commented Jan 5, 2026

Why

better testing

Summary by CodeRabbit

  • Refactor
    • Migrated configuration sourcing from direct imports to context-based service provider across multiple components for improved architecture.
    • Removed billing feature flag, simplifying wallet connectivity and payment flow logic throughout the application.

✏️ Tip: You can customize this high-level summary in your review settings.

@stalniy stalniy requested a review from a team as a code owner January 5, 2026 22:05
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

This PR refactors the deploy-web application to source public configuration from a ServicesProvider context (via useServices()) instead of directly importing browserEnvConfig. The migration spans 14 files across components, hooks, and configuration, removes the NEXT_PUBLIC_BILLING_ENABLED property, and eliminates billing-based visibility gating from several wallet and payment-related components.

Changes

Cohort / File(s) Summary
Configuration & Context Management
apps/deploy-web/src/config/browser-env.config.ts, apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx
Removed NEXT_PUBLIC_BILLING_ENABLED from browserEnvConfig export; updated FlagProvider to source feature flag control from publicConfig via useServices() instead of browserEnvConfig
UI Components - Public Config Migration
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar.tsx, apps/deploy-web/src/components/get-started/GetStartedStepper.tsx, apps/deploy-web/src/components/layout/CustomGoogleAnalytics.tsx, apps/deploy-web/src/components/layout/TrackingScripts.tsx, apps/deploy-web/src/components/remote-deploy/update/RemoteDeployUpdate.tsx, apps/deploy-web/src/components/shared/TrialDeploymentBadge.tsx
Replaced browserEnvConfig imports with useServices() calls; updated all environment flag/config property references to use publicConfig (e.g., NEXT_PUBLIC_MANAGED_WALLET_DENOM, NEXT_PUBLIC_BILLING_ENABLED, NEXT_PUBLIC_GA_ENABLED, NEXT_PUBLIC_GTM_ID, NEXT_PUBLIC_CI_CD_IMAGE_NAME, NEXT_PUBLIC_TRIAL_DEPLOYMENTS_DURATION_HOURS)
Wallet & Payment Components - Billing Gating Removal
apps/deploy-web/src/components/layout/WalletStatus.tsx, apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx
Removed browserEnvConfig import and withBilling-based conditional logic; wallet UI visibility (ManagedWalletPopup, ConnectManagedWalletButton) now depends solely on isManaged and isSignedInWithTrial without billing flag gating
Hooks - Public Config Integration
apps/deploy-web/src/hooks/useAutoTopUpLimits.tsx, apps/deploy-web/src/hooks/useManagedWalletDenom.ts
Replaced browserEnvConfig with publicConfig sourced from useServices(); updated wallet address and denom config property reads
Hooks - Billing Gating Removal
apps/deploy-web/src/hooks/useHasCreditCardBanner.ts, apps/deploy-web/src/hooks/useManagedWallet.ts
Removed browserEnvConfig import and billing feature flag checks; useManagedWalletQuery now unconditionally invoked with user.id; banner visibility simplified to only require isInitialized
Hooks - Feature Flag Runtime Evaluation
apps/deploy-web/src/hooks/useFlag.tsx
Updated useFlag hook signature to accept flag parameter; changed implementation to read NEXT_PUBLIC_UNLEASH_ENABLE_ALL from publicConfig via useServices() and conditionally delegate to dummy or original flag hook at runtime

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #1480: Modifies useFlag and feature-flag implementation alongside config sourcing changes, directly impacting flag-based feature control.
  • #2418: Refactors components to obtain dependencies from ServicesProvider via useServices, extending the same dependency-injection pattern.
  • #1975: Modifies useManagedWallet.ts in related ways, changing hook behavior and control flow.

Suggested reviewers

  • ygrishajev
  • baktun14

Poem

🐰 Hop along, dear config had to move,
From scattered env to services' groove,
No more direct imports in the way,
useServices brings context each day,
Billing gates removed, wallets run free,
A cleaner codebase, as it should be! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: injects browserEnvConfig from DI container' accurately describes the main change: migrating from direct imports of browserEnvConfig to dependency injection via a ServicesProvider context.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@stalniy stalniy force-pushed the refactor/browser-config branch from 7d5695f to 35b76e7 Compare January 5, 2026 22:06
@codecov
Copy link

codecov bot commented Jan 5, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
901 2 899 0
View the top 2 failed test(s) by shortest run time
UserProviders tracks user changes
Stack Traces | 0.024s run time
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)

Expected: {"bio": "Concido casus tot solum tabernus arca.", "email": "[email protected]", "emailVerified": true, "githubUsername": "Clementina_Ferry", "id": "8b654292-263b-4277-a6c6-2e3e1fe94ac8", "name": "Ms. Erica Bartell", "picture": "https://avatars.githubusercontent.com/u/73327865", "plan": {"code": "COMMUNITY", "monthlyPrice": 0, "name": "Community", "summary": "Get access to free features!", "yearlyPrice": 0}, "planCode": "COMMUNITY", "subscribedToNewsletter": false, "twitterUsername": "Rasheed.Stiedemann", "userId": "a820f359-0a5d-4ac2-9ea2-babbe5afc516", "username": "Emelie_Witting", "youtubeUsername": "Bernard_Heaney"}
Received: undefined

Number of calls: 1
    at Object.toHaveBeenCalledWith (.../user/UserProviders/UserProviders.spec.tsx:41:31)
UserProviders shows loader when user is loading
Stack Traces | 0.028s run time
TestingLibraryElementError: Unable to find an accessible element with the role "status"

There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library..../docs/dom-testing-library/api-queries#byrole

Ignored nodes: comments, script, style
<body>
  <div>
    content
  </div>
</body>
    at Object.getElementError (.../console/console/node_modules/@.../dom/dist/config.js:37:19)
    at .../console/console/node_modules/@.../dom/dist/query-helpers.js:76:38
    at .../console/console/node_modules/@.../dom/dist/query-helpers.js:52:17
    at .../console/console/node_modules/@.../dom/dist/query-helpers.js:95:19
    at Object.getByRole (.../user/UserProviders/UserProviders.spec.tsx:20:19)
    at processTicksAndRejections (node:internal/process/task_queues:103:5)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Fix all issues with AI Agents 🤖
In @apps/deploy-web/src/components/layout/WalletStatus.tsx:
- Line 84: WalletStatus.tsx renders ManagedWalletPopup and
ConnectManagedWalletButton based only on isManaged and !isSignedInWithTrial,
which is inconsistent with GetStartedStepper.tsx and UserProviders.tsx that gate
behavior on publicConfig.NEXT_PUBLIC_BILLING_ENABLED; either update
WalletStatus.tsx to include the billing flag in the render conditions (e.g.,
change both conditions to publicConfig.NEXT_PUBLIC_BILLING_ENABLED && isManaged
and publicConfig.NEXT_PUBLIC_BILLING_ENABLED && !isSignedInWithTrial for
ManagedWalletPopup and ConnectManagedWalletButton respectively) or add a clear
code comment above these renders documenting the intentional decision to ignore
the billing flag so behavior is explicit and consistent with
GetStartedStepper.tsx and UserProviders.tsx.

In @apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx:
- Around line 85-93: CustodialWalletPopup.tsx is inconsistent with
GetStartedStepper.tsx: restore the same NEXT_PUBLIC_BILLING_ENABLED gating
around the ConnectManagedWalletButton so behavior matches; specifically, when
rendering the else branch that currently returns <ConnectManagedWalletButton />,
wrap that rendering in the same environment flag check used in
GetStartedStepper.tsx (e.g., process.env.NEXT_PUBLIC_BILLING_ENABLED === 'true')
so ConnectManagedWalletButton is only shown when billing is enabled, keeping the
existing trial/user sign-in branch unchanged.
🧹 Nitpick comments (1)
apps/deploy-web/src/components/layout/TrackingScripts.tsx (1)

55-55: Consider adding publicConfig to the dependency array.

The useEffect on line 11 references publicConfig values but only includes isProduction in its dependency array. If publicConfig can change during runtime, this could lead to stale closures.

However, if publicConfig from the DI container is a stable reference that never changes (which is typical for DI patterns), the current implementation is correct.

🔎 Proposed fix if publicConfig can change
-  }, [isProduction]);
+  }, [isProduction, publicConfig]);

Or if only specific config values matter:

-  }, [isProduction]);
+  }, [isProduction, publicConfig.NEXT_PUBLIC_TRACKING_ENABLED, publicConfig.NEXT_PUBLIC_GROWTH_CHANNEL_TRACKING_ENABLED, publicConfig.NEXT_PUBLIC_GTM_ID]);
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74f586b and 35b76e7.

📒 Files selected for processing (15)
  • apps/deploy-web/src/components/deployments/DeploymentDetailTopBar.tsx
  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
  • apps/deploy-web/src/components/layout/CustomGoogleAnalytics.tsx
  • apps/deploy-web/src/components/layout/TrackingScripts.tsx
  • apps/deploy-web/src/components/layout/WalletStatus.tsx
  • apps/deploy-web/src/components/remote-deploy/update/RemoteDeployUpdate.tsx
  • apps/deploy-web/src/components/shared/TrialDeploymentBadge.tsx
  • apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx
  • apps/deploy-web/src/config/browser-env.config.ts
  • apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx
  • apps/deploy-web/src/hooks/useAutoTopUpLimits.tsx
  • apps/deploy-web/src/hooks/useFlag.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/hooks/useManagedWallet.ts
  • apps/deploy-web/src/hooks/useManagedWalletDenom.ts
💤 Files with no reviewable changes (1)
  • apps/deploy-web/src/config/browser-env.config.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/hooks/useAutoTopUpLimits.tsx
  • apps/deploy-web/src/components/remote-deploy/update/RemoteDeployUpdate.tsx
  • apps/deploy-web/src/components/layout/WalletStatus.tsx
  • apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx
  • apps/deploy-web/src/components/layout/TrackingScripts.tsx
  • apps/deploy-web/src/hooks/useManagedWallet.ts
  • apps/deploy-web/src/components/shared/TrialDeploymentBadge.tsx
  • apps/deploy-web/src/hooks/useFlag.tsx
  • apps/deploy-web/src/components/layout/CustomGoogleAnalytics.tsx
  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
  • apps/deploy-web/src/hooks/useManagedWalletDenom.ts
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx
  • apps/deploy-web/src/components/deployments/DeploymentDetailTopBar.tsx
🧠 Learnings (3)
📚 Learning: 2025-10-15T16:39:55.348Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 2039
File: apps/deploy-web/tests/ui/change-wallets.spec.ts:4-10
Timestamp: 2025-10-15T16:39:55.348Z
Learning: In the Akash Console E2E tests using the context-with-extension fixture, the first wallet is automatically created during fixture setup via `importWalletToLeap` in `apps/deploy-web/tests/ui/fixture/wallet-setup.ts`, so tests that call `frontPage.createWallet()` are creating a second wallet to test wallet switching functionality.

Applied to files:

  • apps/deploy-web/src/hooks/useManagedWallet.ts
📚 Learning: 2025-07-28T10:40:13.595Z
Learnt from: stalniy
Repo: akash-network/console PR: 1480
File: apps/deploy-web/src/hooks/useFlag.tsx:0-0
Timestamp: 2025-07-28T10:40:13.595Z
Learning: In the Akash Network Console project, backend-specific feature flags are intentional and acceptable. The frontend FeatureFlag union type should only include flags that are actually used by the frontend, not all flags defined in the backend. Backend can have internal feature flags for backend-only functionality without requiring frontend synchronization.

Applied to files:

  • apps/deploy-web/src/hooks/useFlag.tsx
  • apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx
📚 Learning: 2025-11-12T16:36:02.543Z
Learnt from: baktun14
Repo: akash-network/console PR: 2203
File: apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx:161-168
Timestamp: 2025-11-12T16:36:02.543Z
Learning: In apps/deploy-web/src/components/onboarding/steps/PaymentMethodContainer/PaymentMethodContainer.tsx, the organization field captured during payment method setup is internal metadata. Errors from stripe.updateCustomerOrganization should be logged to Sentry but not surfaced to users, and the flow should continue even if the organization update fails, as it's non-critical and not something users can fix.

Applied to files:

  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
🧬 Code graph analysis (12)
apps/deploy-web/src/hooks/useAutoTopUpLimits.tsx (3)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/queries/useExactFeeAllowanceQuery.ts (1)
  • useExactFeeAllowanceQuery (6-13)
apps/deploy-web/src/queries/useExactDeploymentGrantsQuery.ts (1)
  • useExactDeploymentGrantsQuery (6-16)
apps/deploy-web/src/components/remote-deploy/update/RemoteDeployUpdate.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/components/layout/WalletStatus.tsx (2)
apps/deploy-web/src/components/wallet/ManagedWalletPopup.tsx (1)
  • ManagedWalletPopup (19-90)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
  • ConnectManagedWalletButton (26-41)
apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx (2)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-96)
apps/deploy-web/src/components/wallet/ConnectManagedWalletButton.tsx (1)
  • ConnectManagedWalletButton (26-41)
apps/deploy-web/src/components/layout/TrackingScripts.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/hooks/useManagedWallet.ts (1)
apps/deploy-web/src/queries/useManagedWalletQuery.ts (1)
  • useManagedWalletQuery (7-20)
apps/deploy-web/src/components/shared/TrialDeploymentBadge.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/hooks/useFlag.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/components/layout/CustomGoogleAnalytics.tsx (2)
apps/deploy-web/src/services/analytics/analytics.service.ts (1)
  • GoogleAnalytics (142-142)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/hooks/useManagedWalletDenom.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
apps/deploy-web/src/components/deployments/DeploymentDetailTopBar.tsx (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
  • useServices (33-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
🔇 Additional comments (14)
apps/deploy-web/src/context/FlagProvider/FlagProvider.tsx (2)

8-8: LGTM! Clean DI integration.

The import of useServices correctly supports the refactoring to inject publicConfig from the DI container instead of directly importing browserEnvConfig.


19-21: Successful DI migration for feature flag configuration.

The refactoring correctly replaces direct browserEnvConfig import with context-based publicConfig from useServices(). This improves testability by allowing the configuration to be mocked through ServicesProvider, aligning with the PR's stated objective.

apps/deploy-web/src/components/deployments/DeploymentDetailTopBar.tsx (1)

50-50: LGTM! Clean refactor to DI-based configuration.

The migration from browserEnvConfig to publicConfig via useServices() is consistent with the PR objective. The managed wallet denomination is now sourced from the DI container, improving testability without changing behavior.

Also applies to: 234-234

apps/deploy-web/src/components/layout/CustomGoogleAnalytics.tsx (1)

5-5: LGTM! Configuration now sourced from DI container.

The Google Analytics flag is now accessed through the publicConfig from useServices(), maintaining the same conditional rendering logic while improving testability.

Also applies to: 8-8, 17-17

apps/deploy-web/src/components/shared/TrialDeploymentBadge.tsx (1)

7-7: LGTM! Trial duration configuration migrated to DI.

The trial duration fallback now reads from publicConfig via useServices(), consistent with the broader refactoring. The logic remains unchanged.

Also applies to: 27-28

apps/deploy-web/src/hooks/useManagedWalletDenom.ts (1)

1-1: LGTM! Hook now uses context-based configuration.

The managed wallet denomination is now sourced from publicConfig via useServices(). The conditional logic remains unchanged, and the hook maintains proper type safety.

Also applies to: 6-6, 10-10

apps/deploy-web/src/hooks/useManagedWallet.ts (1)

17-17: The billing feature flag gating has been removed from the managed wallet query.

The invocation at line 17 is now unconditional, depending only on user?.id existence. The useManagedWalletQuery implementation properly handles the null case via its enabled: !!userId flag. The NEXT_PUBLIC_BILLING_ENABLED flag still exists in the codebase but is now only used in UserProviders.tsx and GetStartedStepper.tsx for conditional UI rendering—it has been intentionally removed from the managed wallet hook.

apps/deploy-web/src/components/remote-deploy/update/RemoteDeployUpdate.tsx (1)

11-11: LGTM! Clean refactoring to use DI container.

The migration from browserEnvConfig to publicConfig via useServices() is consistent and straightforward, improving testability as stated in the PR objectives.

Also applies to: 30-30, 64-64

apps/deploy-web/src/hooks/useAutoTopUpLimits.tsx (1)

6-6: LGTM! Consistent migration to DI container.

The wallet address configuration is now properly sourced from publicConfig, maintaining all existing behavior while improving testability.

Also applies to: 12-12, 14-17

apps/deploy-web/src/hooks/useHasCreditCardBanner.ts (2)

14-17: Inconsistent AI summary.

The AI summary states "removed requirements for hasManagedWallet, isWalletLoading, and isSignedInWithTrial," but the code on line 15 still checks all these conditions. The actual change appears to be the removal of the NEXT_PUBLIC_BILLING_ENABLED flag check only.


14-17: LGTM! Billing flag removal simplifies banner logic.

The removal of the billing flag check from shouldShowBanner is consistent with the PR's objective to remove NEXT_PUBLIC_BILLING_ENABLED. The banner visibility now depends solely on initialization state, wallet status, and trial sign-in state.

apps/deploy-web/src/components/layout/TrackingScripts.tsx (1)

4-4: LGTM! Comprehensive migration to DI container.

All tracking configuration (GTM ID, feature flags, environment) is now properly sourced from publicConfig via the useServices() hook, maintaining consistent behavior while improving testability.

Also applies to: 8-13, 25-25, 32-32

apps/deploy-web/src/hooks/useFlag.tsx (1)

8-12: LGTM! Clean refactor to use DI container.

The refactor successfully moves from static import to runtime configuration via useServices(). The wrapper function pattern ensures a consistent API by always accepting a flag parameter and delegating to the selected hook implementation based on publicConfig.NEXT_PUBLIC_UNLEASH_ENABLE_ALL.

Note that this hook now requires React component context (since useServices() uses useContext), but this is appropriate for a React hook.

apps/deploy-web/src/components/get-started/GetStartedStepper.tsx (1)

16-16: LGTM! Consistent migration to DI-based configuration.

The refactor successfully replaces direct browserEnvConfig usage with publicConfig from the DI container via useServices(). The logic remains unchanged—only the configuration source has been updated, which aligns with the PR's objective of enabling better testing through dependency injection.

All three usages of publicConfig.NEXT_PUBLIC_BILLING_ENABLED (lines 80, 84, 147) correctly gate billing-related UI elements.

Also applies to: 32-32, 80-80, 84-84, 147-147

<div>
{!isManaged && <CustodialWalletPopup walletBalance={walletBalance} />}
{withBilling && isManaged && <ManagedWalletPopup walletBalance={walletBalance} />}
{isManaged && <ManagedWalletPopup walletBalance={walletBalance} />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for NEXT_PUBLIC_BILLING_ENABLED usage to understand the pattern
rg -n "NEXT_PUBLIC_BILLING_ENABLED" --type=ts --type=tsx -C2

Repository: akash-network/console

Length of output: 92


🏁 Script executed:

#!/bin/bash
# Examine WalletStatus.tsx around lines 84 and 93
wc -l apps/deploy-web/src/components/layout/WalletStatus.tsx

Repository: akash-network/console

Length of output: 123


🏁 Script executed:

#!/bin/bash
# Look for billing-related conditions and imports in WalletStatus.tsx
rg -n "withBilling|NEXT_PUBLIC_BILLING|isManaged|isSignedInWithTrial" apps/deploy-web/src/components/layout/WalletStatus.tsx -C1

Repository: akash-network/console

Length of output: 1523


🏁 Script executed:

#!/bin/bash
# Check GetStartedStepper.tsx for billing flag usage
rg -n "NEXT_PUBLIC_BILLING_ENABLED" apps/deploy-web/src/components/GetStartedStepper.tsx -C2

Repository: akash-network/console

Length of output: 157


🏁 Script executed:

#!/bin/bash
# Search for NEXT_PUBLIC_BILLING_ENABLED with correct file type syntax
rg -n "NEXT_PUBLIC_BILLING_ENABLED" --type ts -C2

Repository: akash-network/console

Length of output: 3626


🏁 Script executed:

#!/bin/bash
# Find GetStartedStepper file
fd "GetStartedStepper" --type f

Repository: akash-network/console

Length of output: 200


🏁 Script executed:

#!/bin/bash
# Read full WalletStatus.tsx to understand context
cat -n apps/deploy-web/src/components/layout/WalletStatus.tsx

Repository: akash-network/console

Length of output: 5341


🏁 Script executed:

#!/bin/bash
# Search for billing-related patterns more broadly
rg -n "withBilling|billing" apps/deploy-web/src/components/layout/WalletStatus.tsx --type ts -i

Repository: akash-network/console

Length of output: 47


Billing flag check inconsistency requires clarification.

Line 84 renders ManagedWalletPopup and line 93 renders ConnectManagedWalletButton based solely on isManaged and !isSignedInWithTrial without checking publicConfig.NEXT_PUBLIC_BILLING_ENABLED.

However, GetStartedStepper.tsx (line 147) conditionally renders the same ConnectManagedWalletButton component with the billing flag: publicConfig.NEXT_PUBLIC_BILLING_ENABLED && !isSignedInWithTrial. Additionally, UserProviders.tsx (line 15) gates the entire user provider setup on NEXT_PUBLIC_BILLING_ENABLED.

Confirm whether this inconsistency is intentional. If the billing feature can be disabled via configuration, both components should respect the same flag, or the design decision to always show these components in WalletStatus.tsx should be documented.

🤖 Prompt for AI Agents
In @apps/deploy-web/src/components/layout/WalletStatus.tsx around line 84,
WalletStatus.tsx renders ManagedWalletPopup and ConnectManagedWalletButton based
only on isManaged and !isSignedInWithTrial, which is inconsistent with
GetStartedStepper.tsx and UserProviders.tsx that gate behavior on
publicConfig.NEXT_PUBLIC_BILLING_ENABLED; either update WalletStatus.tsx to
include the billing flag in the render conditions (e.g., change both conditions
to publicConfig.NEXT_PUBLIC_BILLING_ENABLED && isManaged and
publicConfig.NEXT_PUBLIC_BILLING_ENABLED && !isSignedInWithTrial for
ManagedWalletPopup and ConnectManagedWalletButton respectively) or add a clear
code comment above these renders documenting the intentional decision to ignore
the billing flag so behavior is explicit and consistent with
GetStartedStepper.tsx and UserProviders.tsx.

Comment on lines +85 to 93
<Separator className="my-4" />

{isSignedInWithTrial && !user ? (
<Link className={cn(buttonVariants({ variant: "outline" }), "w-full space-x-2")} href={UrlService.newLogin()}>
Sign in for USD Payments
</Link>
) : (
<ConnectManagedWalletButton className="w-full" />
)}
</>
{isSignedInWithTrial && !user ? (
<Link className={cn(buttonVariants({ variant: "outline" }), "w-full space-x-2")} href={UrlService.newLogin()}>
Sign in for USD Payments
</Link>
) : (
<ConnectManagedWalletButton className="w-full" />
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for other usages of NEXT_PUBLIC_BILLING_ENABLED or withBilling
rg -n "NEXT_PUBLIC_BILLING_ENABLED|withBilling" --type ts --type tsx -C 2

Repository: akash-network/console

Length of output: 92


🏁 Script executed:

#!/bin/bash
# Examine the CustodialWalletPopup.tsx file to understand context
find . -name "CustodialWalletPopup.tsx" -type f

Repository: akash-network/console

Length of output: 129


🏁 Script executed:

#!/bin/bash
# Look at the file content around lines 85-93 and surrounding context
find . -name "CustodialWalletPopup.tsx" -type f -exec head -150 {} \; -exec echo "---END OF FILE---" \;

Repository: akash-network/console

Length of output: 3882


🏁 Script executed:

#!/bin/bash
# Search for billing flag usages without the problematic tsx type argument
rg -n "NEXT_PUBLIC_BILLING_ENABLED|withBilling" -C 2

Repository: akash-network/console

Length of output: 3626


🏁 Script executed:

#!/bin/bash
# Also check for any references to this component or similar patterns
rg -n "isSignedInWithTrial" --type ts -C 2 | head -50

Repository: akash-network/console

Length of output: 4544


Review the inconsistency: CustodialWalletPopup no longer gates ConnectManagedWalletButton on NEXT_PUBLIC_BILLING_ENABLED, but GetStartedStepper.tsx still does.

The conditional logic in CustodialWalletPopup.tsx (lines 85-93) correctly handles wallet states: trial users without accounts see "Sign in for USD Payments", and all others see ConnectManagedWalletButton. However, NEXT_PUBLIC_BILLING_ENABLED is still actively used in the codebase (UserProviders.tsx, GetStartedStepper.tsx) and has not been globally removed. GetStartedStepper.tsx line 147 still gates the same ConnectManagedWalletButton component on this flag, creating inconsistent behavior across the application. Either this component needs to restore the flag check to align with other usages, or the flag usage should be systematically removed across all affected components.

🤖 Prompt for AI Agents
In @apps/deploy-web/src/components/wallet/CustodialWalletPopup.tsx around lines
85-93, CustodialWalletPopup.tsx is inconsistent with GetStartedStepper.tsx:
restore the same NEXT_PUBLIC_BILLING_ENABLED gating around the
ConnectManagedWalletButton so behavior matches; specifically, when rendering the
else branch that currently returns <ConnectManagedWalletButton />, wrap that
rendering in the same environment flag check used in GetStartedStepper.tsx
(e.g., process.env.NEXT_PUBLIC_BILLING_ENABLED === 'true') so
ConnectManagedWalletButton is only shown when billing is enabled, keeping the
existing trial/user sign-in branch unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants