-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Oleksandr Aratovskyi <[email protected]>
- Loading branch information
1 parent
9a3237e
commit f62ff7e
Showing
19 changed files
with
589 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Add Account Management tools with reset account functionality for partially onboarded accounts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.account-fees { | ||
padding-top: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React, { useState } from 'react'; | ||
import { Button, CardDivider } from '@wordpress/components'; | ||
import { addQueryArgs } from '@wordpress/url'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import strings from './strings'; | ||
import { isInDevMode } from 'utils'; | ||
import './styles.scss'; | ||
import ResetAccountModal from 'wcpay/overview/modal/reset-account'; | ||
import { trackAccountReset } from 'wcpay/onboarding/tracking'; | ||
|
||
interface Props { | ||
accountLink: string; | ||
openModal: () => void; | ||
} | ||
|
||
const handleReset = () => { | ||
trackAccountReset(); | ||
|
||
window.location.href = addQueryArgs( wcpaySettings.connectUrl, { | ||
'wcpay-reset-account': true, | ||
} ); | ||
}; | ||
|
||
export const AccountTools: React.FC< Props > = ( props: Props ) => { | ||
const accountLink = props.accountLink; | ||
const [ modalVisible, setModalVisible ] = useState( false ); | ||
|
||
if ( isInDevMode() ) return null; | ||
|
||
return ( | ||
<> | ||
<div className="account-tools"> | ||
<CardDivider /> | ||
<h4>{ strings.title }</h4> | ||
<p>{ strings.description }</p> | ||
{ /* Use wrapping div to keep buttons grouped together. */ } | ||
<div className="account-tools__actions"> | ||
<Button | ||
variant={ 'secondary' } | ||
href={ accountLink } | ||
target={ '_blank' } | ||
> | ||
{ strings.finish } | ||
</Button> | ||
<Button | ||
variant={ 'tertiary' } | ||
onClick={ () => setModalVisible( true ) } | ||
> | ||
{ strings.reset } | ||
</Button> | ||
</div> | ||
</div> | ||
|
||
<ResetAccountModal | ||
isVisible={ modalVisible } | ||
onDismiss={ () => setModalVisible( false ) } | ||
onSubmit={ handleReset } | ||
/> | ||
</> | ||
); | ||
}; |
15 changes: 15 additions & 0 deletions
15
client/components/account-status/account-tools/strings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable max-len */ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export default { | ||
title: __( 'Account Tools', 'woocommerce-payments' ), | ||
description: __( | ||
'Payments and deposits are disabled until account setup is completed. If you are experiencing problems completing account setup, or need to change the email/country associated with your account, you can reset your account and start from the beginning.', | ||
'woocommerce-payments' | ||
), | ||
finish: __( 'Finish setup', 'woocommerce-payments' ), | ||
reset: __( 'Reset account', 'woocommerce-payments' ), | ||
}; |
11 changes: 11 additions & 0 deletions
11
client/components/account-status/account-tools/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.account-tools { | ||
padding-top: $gap; | ||
|
||
&__actions { | ||
display: grid; | ||
grid-auto-flow: column; | ||
grid-auto-columns: max-content; | ||
column-gap: $gap-small; | ||
margin-top: $gap-small; | ||
} | ||
} |
Oops, something went wrong.