diff --git a/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx b/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx index cdcfc5213..6869b56be 100644 --- a/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx +++ b/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx @@ -866,8 +866,8 @@ describe('GROUP 2: Payment Form States', () => { }) test('Provider maintenance shows maintenance banner', async () => { - const maintenanceConfig = require('@/config/underMaintenance.config').default - maintenanceConfig.disabledPaymentProviders = ['MANTECA'] + const underMaintenanceConfig = require('@/config/underMaintenance.config').default + underMaintenanceConfig.disabledPaymentProviders = ['MANTECA'] setupMantecaPayment() @@ -878,7 +878,7 @@ describe('GROUP 2: Payment Form States', () => { }) // Clean up - maintenanceConfig.disabledPaymentProviders = [] + underMaintenanceConfig.disabledPaymentProviders = [] }) }) diff --git a/src/app/(mobile-ui)/qr-pay/page.tsx b/src/app/(mobile-ui)/qr-pay/page.tsx index c2012710f..df67237ad 100644 --- a/src/app/(mobile-ui)/qr-pay/page.tsx +++ b/src/app/(mobile-ui)/qr-pay/page.tsx @@ -61,7 +61,7 @@ import { PointsAction } from '@/services/services.types' import { usePointsConfetti } from '@/hooks/usePointsConfetti' import { usePointsCalculation } from '@/hooks/usePointsCalculation' import { useModalsContext } from '@/context/ModalsContext' -import maintenanceConfig from '@/config/underMaintenance.config' +import underMaintenanceConfig from '@/config/underMaintenance.config' import PointsCard from '@/components/Common/PointsCard' import { TRANSACTIONS } from '@/constants/query.consts' import { useLimitsValidation } from '@/features/limits/hooks/useLimitsValidation' @@ -141,7 +141,7 @@ export default function QRPayPage() { // Check if this payment provider is under maintenance const isProviderDisabled = useMemo(() => { - return paymentProcessor ? maintenanceConfig.disabledPaymentProviders.includes(paymentProcessor) : false + return paymentProcessor ? underMaintenanceConfig.disabledPaymentProviders.includes(paymentProcessor) : false }, [paymentProcessor]) // MIGRATION-REVIEW: QR-pay KYC gate, formerly useQrKycGate + useKycStatus. diff --git a/src/components/AddMoney/components/MantecaAddMoney.tsx b/src/components/AddMoney/components/MantecaAddMoney.tsx index a43a54724..1aa6f7fec 100644 --- a/src/components/AddMoney/components/MantecaAddMoney.tsx +++ b/src/components/AddMoney/components/MantecaAddMoney.tsx @@ -26,7 +26,7 @@ import { useLimitsValidation } from '@/features/limits/hooks/useLimitsValidation import posthog from 'posthog-js' import { ANALYTICS_EVENTS } from '@/constants/analytics.consts' import InfoCard from '@/components/Global/InfoCard' -import underMaintenanceConfig, { PIX_BRAZIL_ONRAMP_MAINTENANCE } from '@/config/underMaintenance.config' +import underMaintenanceConfig, { PIX_ONRAMP_MAINTENANCE_COPY } from '@/config/underMaintenance.config' // Step type for URL state type MantecaStep = 'inputAmount' | 'depositDetails' @@ -72,9 +72,10 @@ const MantecaAddMoney: FC = () => { return countryData.find((country) => country.type === 'country' && country.path === selectedCountryPath) }, [selectedCountryPath]) const onBack = useSafeBack(addMoneyCountryUrl(selectedCountryPath)) - // BRL-via-PIX onramp warn-only maintenance flag (see underMaintenance.config.ts). + // BRL-via-PIX onramp warn-only maintenance banner (see underMaintenance.config.ts). // Brazil-scoped so the Argentina/ARS Manteca onramp is unaffected. - const showPixMaintenance = selectedCountry?.id === 'BR' && underMaintenanceConfig.pixBrazilOnrampMaintenance + const showPixMaintenanceBanner = + selectedCountry?.id === 'BR' && underMaintenanceConfig.enablePixOnrampMaintenanceWarning // The pool→full upgrade gate asks "did the user clear ID verification?", // not "do they have an enabled rail elsewhere?" — read the identity // signal directly (Sumsub-cleared the human) instead of the old @@ -286,12 +287,12 @@ const MantecaAddMoney: FC = () => { limitsCurrency={limitsValidation.currency} onBack={onBack} maintenanceBanner={ - showPixMaintenance ? ( + showPixMaintenanceBanner ? ( ) : undefined } diff --git a/src/components/AddWithdraw/AddWithdrawCountriesList.tsx b/src/components/AddWithdraw/AddWithdrawCountriesList.tsx index 6698a3044..c857950c8 100644 --- a/src/components/AddWithdraw/AddWithdrawCountriesList.tsx +++ b/src/components/AddWithdraw/AddWithdrawCountriesList.tsx @@ -35,7 +35,7 @@ import { getRegionIntent } from '@/utils/regions.utils' import { useTosGuard } from '@/hooks/useTosGuard' import { BridgeTosStep } from '@/components/Kyc/BridgeTosStep' import { useModalsContext } from '@/context/ModalsContext' -import underMaintenanceConfig, { PIX_BRAZIL_ONRAMP_MAINTENANCE } from '@/config/underMaintenance.config' +import underMaintenanceConfig, { PIX_ONRAMP_MAINTENANCE_COPY } from '@/config/underMaintenance.config' interface AddWithdrawCountriesListProps { flow: 'add' | 'withdraw' @@ -429,11 +429,12 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
{paymentMethods.map((method, index) => { // BRL-via-PIX onramp is warn-only under maintenance: tag the Pix option but - // keep it clickable (do not set isDisabled). - const isPixOnrampUnderMaintenance = + // keep it clickable (do not set isDisabled). The `pix-add` method is itself + // Brazil-only (consts filter it to countryCode === 'BR'). + const showPixMaintenanceTag = flow === 'add' && method.id === 'pix-add' && - underMaintenanceConfig.pixBrazilOnrampMaintenance + underMaintenanceConfig.enablePixOnrampMaintenanceWarning return ( { rightContent={ method.isSoon ? ( - ) : isPixOnrampUnderMaintenance ? ( + ) : showPixMaintenanceTag ? ( ) : null diff --git a/src/components/AddWithdraw/__tests__/AddWithdrawCountriesList.test.tsx b/src/components/AddWithdraw/__tests__/AddWithdrawCountriesList.test.tsx index e6329cfab..7fbf92b8e 100644 --- a/src/components/AddWithdraw/__tests__/AddWithdrawCountriesList.test.tsx +++ b/src/components/AddWithdraw/__tests__/AddWithdrawCountriesList.test.tsx @@ -239,21 +239,26 @@ describe('AddWithdrawCountriesList — bank gate', () => { /** * BRL-via-PIX onramp is unstable, so the Pix option is flagged "under maintenance" - * (config: pixBrazilOnrampMaintenance) — warn-only: it stays visible and clickable. + * (config: enablePixOnrampMaintenanceWarning) — warn-only: it stays visible and clickable. */ describe('AddWithdrawCountriesList — PIX onramp maintenance tag', () => { + // snapshot/restore the shipped flag so each test can flip it without leaking state — + // and without coupling the restore to whatever the committed default happens to be + let originalPixMaintenance: boolean + beforeEach(() => { mockPush.mockClear() // a ready gate so a click can navigate — proving the option is not blocked setCapabilities('ready', [{ status: 'enabled', channel: 'bank', country: 'US' }]) + originalPixMaintenance = underMaintenanceConfig.enablePixOnrampMaintenanceWarning }) afterEach(() => { - underMaintenanceConfig.pixBrazilOnrampMaintenance = true + underMaintenanceConfig.enablePixOnrampMaintenanceWarning = originalPixMaintenance }) it('tags the Pix option "Maintenance" but keeps it clickable (warn-only)', () => { - underMaintenanceConfig.pixBrazilOnrampMaintenance = true + underMaintenanceConfig.enablePixOnrampMaintenanceWarning = true render() @@ -266,7 +271,7 @@ describe('AddWithdrawCountriesList — PIX onramp maintenance tag', () => { }) it('shows no maintenance tag when the flag is off, and never tags non-Pix methods', () => { - underMaintenanceConfig.pixBrazilOnrampMaintenance = false + underMaintenanceConfig.enablePixOnrampMaintenanceWarning = false render() diff --git a/src/components/Global/Banner/index.tsx b/src/components/Global/Banner/index.tsx index fbddaecc8..c987d97aa 100644 --- a/src/components/Global/Banner/index.tsx +++ b/src/components/Global/Banner/index.tsx @@ -4,7 +4,7 @@ import { useEffect } from 'react' import { usePathname } from 'next/navigation' import { MaintenanceBanner } from './MaintenanceBanner' import { MarqueeWrapper } from '../MarqueeWrapper' -import maintenanceConfig from '@/config/underMaintenance.config' +import underMaintenanceConfig from '@/config/underMaintenance.config' import { HandThumbsUp } from '@/assets' import Image from 'next/image' import { useModalsContext } from '@/context/ModalsContext' @@ -16,7 +16,7 @@ export function Banner() { if (!pathname) return null // check if maintenance banner OR full maintenance is enabled - show on all pages - if (maintenanceConfig.enableMaintenanceBanner || maintenanceConfig.enableFullMaintenance) { + if (underMaintenanceConfig.enableMaintenanceBanner || underMaintenanceConfig.enableFullMaintenance) { return } diff --git a/src/config/underMaintenance.config.ts b/src/config/underMaintenance.config.ts index abbf63fb8..373e91157 100644 --- a/src/config/underMaintenance.config.ts +++ b/src/config/underMaintenance.config.ts @@ -3,6 +3,12 @@ * * to enable maintenance mode, simply toggle one or both of these keys: * + * naming convention — read the verb, not just the value: + * - enable: true = turn that maintenance behavior ON (block / redirect / warn) + * - disable: true = turn that product feature OFF + * `enableX: true` makes X happen; `disableY: true` makes Y stop. New flags MUST follow + * one of these two shapes so the polarity is always obvious from the name. + * * 1. enableFullMaintenance: redirects ALL pages to /maintenance page * - landing page (/) and support page (/support) remain accessible * - maintenance banner shows on all pages (including landing and support) @@ -34,11 +40,11 @@ * - card pioneer modal, carousel cta, and perk rewards hidden from home * - set to false to enable the feature * - * 7. pixBrazilOnrampMaintenance: warn-only flag for the BRL-via-PIX onramp (Manteca Brazil deposit) + * 7. enablePixOnrampMaintenanceWarning: warn-only flag for the PIX onramp (Manteca Brazil deposit) * - shows a "Maintenance" tag on the Pix option in /add-money/brazil * - shows a warning banner inside the deposit flow (/add-money/brazil/manteca) * - does NOT block deposits — the option stays usable (warn-only) - * - set to false when PIX deposits are stable again + * - set to true when PIX deposits degrade again * * note: if either mode is enabled, the maintenance banner will show everywhere * @@ -55,7 +61,7 @@ interface MaintenanceConfig { disableXchainWithdraw: boolean disableXchainSend: boolean disableCardPioneers: boolean - pixBrazilOnrampMaintenance: boolean + enablePixOnrampMaintenanceWarning: boolean } const underMaintenanceConfig: MaintenanceConfig = { @@ -65,16 +71,16 @@ const underMaintenanceConfig: MaintenanceConfig = { disableXchainWithdraw: true, // set to true to disable cross-chain withdrawals (only allows USDC on Arbitrum) disableXchainSend: true, // set to true to disable cross-chain sends (claim, request payments - only allows USDC on Arbitrum) disableCardPioneers: true, // set to false to enable the Card Pioneers waitlist feature - pixBrazilOnrampMaintenance: true, // set to false when BRL-via-PIX deposits are stable again + enablePixOnrampMaintenanceWarning: false, // set to true when PIX (Manteca Brazil) deposits degrade again } // shared user-facing copy for cross-chain disabled paths — keep wording aligned with TokenSelector banner export const CROSS_CHAIN_DISABLED_MESSAGE = 'Cross-chain claims are temporarily unavailable. Try claiming to an external wallet on the same chain as the link, or try again later.' -// shared user-facing copy for the BRL-via-PIX onramp maintenance warning — keep the list tag and +// shared user-facing copy for the PIX onramp maintenance warning — keep the list tag and // the in-flow banner aligned -export const PIX_BRAZIL_ONRAMP_MAINTENANCE = { +export const PIX_ONRAMP_MAINTENANCE_COPY = { badge: 'Maintenance', title: 'PIX deposits are under maintenance', description: diff --git a/src/proxy.ts b/src/proxy.ts index 34b2cf5be..3c2e7eac4 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -3,7 +3,7 @@ // https://nextjs.org/docs/messages/middleware-to-proxy import type { NextRequest } from 'next/server' import { NextResponse } from 'next/server' -import maintenanceConfig from '@/config/underMaintenance.config' +import underMaintenanceConfig from '@/config/underMaintenance.config' export function proxy(request: NextRequest) { const { pathname } = request.nextUrl @@ -15,7 +15,7 @@ export function proxy(request: NextRequest) { // } // check if full maintenance mode is enabled - if (maintenanceConfig.enableFullMaintenance) { + if (underMaintenanceConfig.enableFullMaintenance) { const allowedPaths = ['/', '/maintenance', '/apple-app-site-association', '/support'] if ( !allowedPaths.includes(pathname) &&