diff --git a/client/components/account-status/test/index.js b/client/components/account-status/test/index.js
index 6af6bf36515..687a6ca507e 100644
--- a/client/components/account-status/test/index.js
+++ b/client/components/account-status/test/index.js
@@ -13,6 +13,7 @@ import StatusChip from '../status-chip';
describe( 'AccountStatus', () => {
beforeEach( () => {
global.wcpaySettings = {
+ devMode: false,
zeroDecimalCurrencies: [],
connect: {
country: 'FR',
@@ -78,6 +79,48 @@ describe( 'AccountStatus', () => {
expect( accountStatus ).toMatchSnapshot();
} );
+ test( 'renders account tools', () => {
+ global.wcpaySettings.devMode = true;
+
+ const { container: accountStatus } = renderAccountStatus(
+ {
+ status: 'complete',
+ paymentsEnabled: 1,
+ deposits: {
+ status: 'enabled',
+ interval: 'weekly',
+ },
+ progressiveOnboarding: {
+ isEnabled: false,
+ isComplete: false,
+ },
+ },
+ [
+ {
+ payment_method: 'card',
+ fee: {
+ base: {
+ currency: 'EUR',
+ percentage_rate: 0.029,
+ fixed_rate: 0.3,
+ },
+ discount: [
+ {
+ end_time: null,
+ volume_allowance: null,
+ volume_currency: null,
+ current_volume: null,
+ percentage_rate: 0.029,
+ fixed_rate: 30,
+ },
+ ],
+ },
+ },
+ ]
+ );
+ expect( accountStatus ).toMatchSnapshot();
+ } );
+
function renderAccountStatus( accountStatus, accountFees ) {
return render(
= ( { updateAccountLink } ) => {
const accountLinkWithSource = addQueryArgs( updateAccountLink, {
- source: 'deposits-overview__deposit-failure-notice',
+ from: 'WCPAY_PAYOUTS',
+ source: 'wcpay-payout-failure-notice',
} );
return (
diff --git a/client/components/sandbox-mode-switch-to-live-notice/index.tsx b/client/components/sandbox-mode-switch-to-live-notice/index.tsx
new file mode 100644
index 00000000000..e9ce619d7b1
--- /dev/null
+++ b/client/components/sandbox-mode-switch-to-live-notice/index.tsx
@@ -0,0 +1,120 @@
+/**
+ * External dependencies
+ */
+import React, { useState } from 'react';
+import { Button } from '@wordpress/components';
+import { __, sprintf } from '@wordpress/i18n';
+import HelpOutlineIcon from 'gridicons/dist/help-outline';
+
+/**
+ * Internal dependencies
+ */
+import BannerNotice from '../banner-notice';
+import interpolateComponents from '@automattic/interpolate-components';
+import { Link } from '@woocommerce/components';
+import { recordEvent } from 'wcpay/tracks';
+import { ClickTooltip } from 'wcpay/components/tooltip';
+import ErrorBoundary from 'wcpay/components/error-boundary';
+import SetupLivePaymentsModal from './modal';
+
+interface Props {
+ from: string;
+ source: string;
+}
+
+const SandboxModeSwitchToLiveNotice: React.FC< Props > = ( {
+ from,
+ source,
+} ) => {
+ const [ livePaymentsModalVisible, setLivePaymentsModalVisible ] = useState(
+ false
+ );
+
+ const handleCtaClick = () => {
+ recordEvent( 'wcpay_setup_live_payments_modal_open', {
+ from,
+ source,
+ } );
+
+ setLivePaymentsModalVisible( true );
+ };
+
+ return (
+ <>
+
+ { interpolateComponents( {
+ mixedString: sprintf(
+ /* translators: %1$s: WooPayments */
+ __(
+ // eslint-disable-next-line max-len
+ '{{strong}}%1$s is in sandbox mode.{{/strong}} To accept real transactions, {{switchToLiveLink}}set up a live %1$s account.{{/switchToLiveLink}} {{learnMoreIcon/}}',
+ 'woocommerce-payments'
+ ),
+ 'WooPayments'
+ ),
+ components: {
+ strong: ,
+ learnMoreIcon: (
+ }
+ buttonLabel={ __(
+ 'Learn more about sandbox mode',
+ 'woocommerce-payments'
+ ) }
+ maxWidth={ '250px' }
+ content={
+ <>
+ { interpolateComponents( {
+ mixedString: sprintf(
+ /* translators: %1$s: WooPayments */
+ __(
+ // eslint-disable-next-line max-len
+ 'Sandbox mode gives you access to all %1$s features while checkout transactions are simulated. {{learnMoreLink}}Learn more{{/learnMoreLink}}',
+ 'woocommerce-payments'
+ ),
+ 'WooPayments'
+ ),
+ components: {
+ learnMoreLink: (
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
+
+ recordEvent(
+ 'wcpay_overview_sandbox_mode_learn_more_clicked'
+ )
+ }
+ />
+ ),
+ },
+ } ) }
+ >
+ }
+ />
+ ),
+ switchToLiveLink: (
+
+ ),
+ },
+ } ) }
+
+ { livePaymentsModalVisible && (
+
+ setLivePaymentsModalVisible( false ) }
+ />
+
+ ) }
+ >
+ );
+};
+
+export default SandboxModeSwitchToLiveNotice;
diff --git a/client/overview/modal/setup-live-payments/index.tsx b/client/components/sandbox-mode-switch-to-live-notice/modal/index.tsx
similarity index 72%
rename from client/overview/modal/setup-live-payments/index.tsx
rename to client/components/sandbox-mode-switch-to-live-notice/modal/index.tsx
index 889f9aa8cf2..21ee42d83b7 100644
--- a/client/overview/modal/setup-live-payments/index.tsx
+++ b/client/components/sandbox-mode-switch-to-live-notice/modal/index.tsx
@@ -13,16 +13,39 @@ import { Icon, currencyDollar } from '@wordpress/icons';
import BlockEmbedIcon from 'components/icons/block-embed';
import BlockPostAuthorIcon from 'components/icons/block-post-author';
import './style.scss';
+import { recordEvent } from 'wcpay/tracks';
interface Props {
+ from: string;
+ source: string;
onClose: () => void;
}
-const SetupLivePaymentsModal: React.FC< Props > = ( { onClose }: Props ) => {
+const SetupLivePaymentsModal: React.FC< Props > = ( {
+ from,
+ source,
+ onClose,
+}: Props ) => {
const handleSetup = () => {
+ recordEvent( 'wcpay_onboarding_flow_setup_live_payments', {
+ from,
+ source,
+ } );
+
window.location.href = addQueryArgs( wcpaySettings.connectUrl, {
- 'wcpay-disable-onboarding-test-mode': true,
+ 'wcpay-disable-onboarding-test-mode': 'true',
+ from,
+ source: 'wcpay-setup-live-payments', // Overwrite any existing source because we are starting over.
+ } );
+ };
+
+ const trackAndClose = () => {
+ recordEvent( 'wcpay_setup_live_payments_modal_exit', {
+ from,
+ source,
} );
+
+ onClose();
};
return (
@@ -33,7 +56,7 @@ const SetupLivePaymentsModal: React.FC< Props > = ( { onClose }: Props ) => {
) }
className="wcpay-setup-real-payments-modal"
isDismissible={ true }
- onRequestClose={ onClose }
+ onRequestClose={ trackAndClose }
>
{ __(
@@ -59,10 +82,10 @@ const SetupLivePaymentsModal: React.FC< Props > = ( { onClose }: Props ) => {
) }