diff --git a/changelog.txt b/changelog.txt index 9bd78be14c7..b32a5fa4c08 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** WooPayments Changelog *** += 8.1.1 - 2024-08-23 = +* Fix - Fixed sandbox mode accounts being able to disable test mode for the payment gateway settings. + = 8.1.0 - 2024-08-21 = * Add - Add button rules to appearance * Add - Add heading rules to appearance diff --git a/client/components/account-status/account-tools/index.tsx b/client/components/account-status/account-tools/index.tsx index de772a63fb3..ad73a88fb08 100644 --- a/client/components/account-status/account-tools/index.tsx +++ b/client/components/account-status/account-tools/index.tsx @@ -12,7 +12,7 @@ import strings from './strings'; import './styles.scss'; import ResetAccountModal from 'wcpay/overview/modal/reset-account'; import { trackAccountReset } from 'wcpay/onboarding/tracking'; -import { isInDevMode } from 'wcpay/utils'; +import { isInTestModeOnboarding } from 'wcpay/utils'; interface Props { openModal: () => void; @@ -30,8 +30,8 @@ const handleReset = () => { export const AccountTools: React.FC< Props > = () => { const [ modalVisible, setModalVisible ] = useState( false ); - // Only render when in dev/sandbox mode. - if ( ! isInDevMode() ) { + // Only render when in test/sandbox mode onboarding. + if ( ! isInTestModeOnboarding() ) { return null; } diff --git a/client/components/account-status/account-tools/strings.tsx b/client/components/account-status/account-tools/strings.tsx index 920e5990f0e..f47e8416574 100644 --- a/client/components/account-status/account-tools/strings.tsx +++ b/client/components/account-status/account-tools/strings.tsx @@ -7,11 +7,11 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import { isInDevMode } from 'utils'; +import { isInTestModeOnboarding } from 'utils'; export default { title: __( 'Account Tools', 'woocommerce-payments' ), - description: isInDevMode() + description: isInTestModeOnboarding() ? __( 'Your account is in sandbox mode. If you are experiencing problems completing account setup, or wish to test with a different email/country associated with your account, you can reset your account and start from the beginning.', 'woocommerce-payments' diff --git a/client/components/account-status/account-tools/test/__snapshots__/index.test.tsx.snap b/client/components/account-status/account-tools/test/__snapshots__/index.test.tsx.snap index 7ba3c01abd5..a3217d4df35 100644 --- a/client/components/account-status/account-tools/test/__snapshots__/index.test.tsx.snap +++ b/client/components/account-status/account-tools/test/__snapshots__/index.test.tsx.snap @@ -2,7 +2,7 @@ exports[`AccountTools should NOT render in live mode 1`] = `
`; -exports[`AccountTools should render in sandbox mode 1`] = ` +exports[`AccountTools should render in test/sandbox mode onboarding 1`] = `
diff --git a/client/components/test-mode-notice/index.tsx b/client/components/test-mode-notice/index.tsx index 5e799158204..6f13da9def2 100644 --- a/client/components/test-mode-notice/index.tsx +++ b/client/components/test-mode-notice/index.tsx @@ -26,7 +26,7 @@ interface Props { currentPage: CurrentPage; actions?: React.ComponentProps< typeof BannerNotice >[ 'actions' ]; isDetailsView?: boolean; - isOnboardingTestMode?: boolean; + isTestModeOnboarding?: boolean; } const nounToUse = { @@ -50,11 +50,11 @@ const verbToUse = { const getNoticeContent = ( currentPage: CurrentPage, isDetailsView: boolean, - isOnboardingTestMode: boolean + isTestModeOnboarding: boolean ): JSX.Element => { switch ( currentPage ) { case 'overview': - return isOnboardingTestMode ? ( + return isTestModeOnboarding ? ( <> { interpolateComponents( { mixedString: sprintf( @@ -163,7 +163,7 @@ export const TestModeNotice: React.FC< Props > = ( { currentPage, actions, isDetailsView = false, - isOnboardingTestMode = false, + isTestModeOnboarding = false, } ) => { if ( ! isInTestMode() ) return null; @@ -176,7 +176,7 @@ export const TestModeNotice: React.FC< Props > = ( { { getNoticeContent( currentPage, isDetailsView, - isOnboardingTestMode + isTestModeOnboarding ) } ); diff --git a/client/connect-account-page/index.tsx b/client/connect-account-page/index.tsx index e4eb86aef2f..5f7a383d827 100644 --- a/client/connect-account-page/index.tsx +++ b/client/connect-account-page/index.tsx @@ -33,7 +33,7 @@ import InlineNotice from 'components/inline-notice'; import { WooPaymentMethodsLogos } from 'components/payment-method-logos'; import WooPaymentsLogo from 'assets/images/logo.svg?asset'; import { sanitizeHTML } from 'wcpay/utils/sanitize'; -import { isInDevMode } from 'wcpay/utils'; +import { isInTestModeOnboarding } from 'wcpay/utils'; import ResetAccountModal from 'wcpay/overview/modal/reset-account'; import { trackAccountReset } from 'wcpay/onboarding/tracking'; import SandboxModeSwitchToLiveNotice from 'wcpay/components/sandbox-mode-switch-to-live-notice'; @@ -96,8 +96,7 @@ const ConnectAccountPage: React.FC = () => { const { connectUrl, connect: { availableCountries, country }, - devMode, - onboardingTestMode, + testModeOnboarding, isJetpackConnected, isAccountConnected, isAccountValid, @@ -467,7 +466,7 @@ const ConnectAccountPage: React.FC = () => { ) } { // Show general sandbox notice when no account is connected but sandbox mode is active. - ! isAccountConnected && devMode ? ( + ! isAccountConnected && testModeOnboarding ? ( ) : ( // If we already have a sandbox account connected (but in an invalid state) and @@ -475,7 +474,7 @@ const ConnectAccountPage: React.FC = () => { // show the switch to live sandbox notice. isAccountConnected && ! isAccountValid && - onboardingTestMode && + testModeOnboarding && isJetpackConnected && ( { isAccountConnected && ( ! wcpaySettings.accountStatus .detailsSubmitted || - isInDevMode() ) && ( + isInTestModeOnboarding() ) && (