-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dismissable Notice to message the rename of Deposits to Payout #9680
Merged
shendy-a8c
merged 13 commits into
feature/deposits-payouts-rename
from
add/9673-payouts-rename-notice
Nov 10, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
edf839c
Draft payouts rename notice, with placeholder text and image.
7ad20ac
added changelog
cd85572
Merge branch 'feature/deposits-payouts-rename' into add/9673-payouts-…
c2868a3
fixed missing arrow when popup positioned to the right
f8f32c3
Merge branch 'add/9673-payouts-rename-notice' of https://github.com/A…
76e9556
Avoid flickering effect when Payouts is loading but notice is dismissed.
391b931
Added basic rendering tests.
c79624c
Merge branch 'feature/deposits-payouts-rename' into add/9673-payouts-…
shendy-a8c 278f60d
Remove unused imports.
shendy-a8c 45b4c4e
Show payout rename spotlight notice on Payments overview page and dep…
shendy-a8c ba2ffea
Copy change.
shendy-a8c 420321a
Update unit test for Payments Overview page to check the payout renam…
shendy-a8c d09cff8
Update client/deposits/rename-notice/index.tsx
shendy-a8c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,5 @@ | ||
Significance: patch | ||
Type: add | ||
Comment: Added notice to indicate the rename of Deposits to Payouts. User facing changelog will be added as part of feature branch | ||
|
||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,88 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import React, { useState, useEffect } from 'react'; | ||
import { TourKit } from '@woocommerce/components'; | ||
import { useDispatch } from '@wordpress/data'; | ||
import { createInterpolateElement } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
export const PayoutsRenameNotice = () => { | ||
const isPayoutsRenameNoticeDismissed = | ||
wcpaySettings.isPayoutsRenameNoticeDismissed; | ||
const { updateOptions } = useDispatch( 'wc/admin/options' ); | ||
const [ showTour, setShowTour ] = useState( false ); | ||
|
||
const onClose = () => { | ||
updateOptions( { | ||
wcpay_payouts_rename_notice_dismissed: true, | ||
} ); | ||
setShowTour( false ); | ||
wcpaySettings.isPayoutsRenameNoticeDismissed = true; | ||
}; | ||
|
||
useEffect( () => { | ||
if ( ! isPayoutsRenameNoticeDismissed ) { | ||
setShowTour( true ); | ||
} | ||
}, [ isPayoutsRenameNoticeDismissed ] ); | ||
|
||
if ( ! showTour ) return null; | ||
|
||
return ( | ||
<TourKit | ||
config={ { | ||
placement: 'bottom', | ||
options: { | ||
effects: { | ||
overlay: false, | ||
autoScroll: { | ||
behavior: 'smooth', | ||
}, | ||
}, | ||
classNames: | ||
'wc-admin-payments-overview-payouts-rename-tour', | ||
}, | ||
steps: [ | ||
{ | ||
referenceElements: { | ||
desktop: | ||
'#toplevel_page_wc-admin-path--payments-overview ul.wp-submenu li a[href*="payouts"]', | ||
}, | ||
meta: { | ||
name: 'deposits-now-payouts', | ||
heading: __( | ||
'Deposits are now known as Payouts!', | ||
'woocommerce-payments' | ||
), | ||
descriptions: { | ||
desktop: createInterpolateElement( | ||
__( | ||
"Same reliable system for quick access to your earnings — now with a clearer name. To enhance your experience, 'Deposits' will now be called 'Payouts'. <link>Learn More.</link>", | ||
'woocommerce-payments' | ||
), | ||
{ | ||
link: ( | ||
// eslint-disable-next-line jsx-a11y/anchor-has-content | ||
<a | ||
href="https://woocommerce.com/document/woopayments/payouts/deposits-and-payouts/" | ||
target="_blank" | ||
rel="noreferrer" | ||
/> | ||
), | ||
} | ||
), | ||
}, | ||
}, | ||
}, | ||
], | ||
closeHandler: onClose, | ||
} } | ||
></TourKit> | ||
); | ||
}; |
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,77 @@ | ||
.wc-admin-payments-overview-payouts-rename-tour { | ||
color: #1e1e1e; | ||
|
||
.woocommerce-tour-kit-step { | ||
border-radius: 8px; | ||
border: 1px solid #dcdcdc; | ||
|
||
/* Shadow / Popover */ | ||
box-shadow: 0 2px 6px 0 rgba( 0, 0, 0, 0.05 ); | ||
width: 257px; | ||
padding-bottom: 0; | ||
} | ||
|
||
.components-card__footer { | ||
display: none; | ||
} | ||
|
||
.tour-kit-frame__container { | ||
box-shadow: none; | ||
background: none; | ||
} | ||
|
||
.components-elevation { | ||
display: none; | ||
} | ||
|
||
.woocommerce-tour-kit-step__body { | ||
background-image: url( './header-image.svg' ); | ||
background-repeat: no-repeat; | ||
background-position-x: center; | ||
background-position-y: 5px; | ||
padding-bottom: 24px; | ||
} | ||
.woocommerce-tour-kit-step-navigation { | ||
display: none; | ||
} | ||
h2 { | ||
padding-top: 100px; | ||
font-size: 14px; | ||
line-height: 24px; | ||
} | ||
p.woocommerce-tour-kit-step__description { | ||
font-size: 13px; | ||
line-height: 18px; | ||
margin-top: 8px; | ||
} | ||
.tour-kit-frame__arrow::before { | ||
box-shadow: none !important; | ||
} | ||
|
||
.tour-kit-frame__container[data-popper-placement^='bottom'] { | ||
& > .tour-kit-frame__arrow { | ||
background: #fff; | ||
&::before { | ||
border-top: 1px solid var( --gutenberg-gray-300, #ddd ); | ||
border-left: 1px solid var( --gutenberg-gray-300, #ddd ); | ||
} | ||
} | ||
} | ||
|
||
.tour-kit-frame__container[data-popper-placement^='right'] { | ||
& > .tour-kit-frame__arrow { | ||
background: #fff; | ||
&::before { | ||
border-bottom: 1px solid var( --gutenberg-gray-300, #ddd ); | ||
border-left: 1px solid var( --gutenberg-gray-300, #ddd ); | ||
} | ||
} | ||
} | ||
|
||
a { | ||
display: block; | ||
text-decoration: none; | ||
margin-top: 12px; | ||
padding-block: 11px; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
client/deposits/rename-notice/test/__snapshots__/index.tsx.snap
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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PayoutsRenameNotice should render notice if isPayoutsRenameNoticeDismissed is false 1`] = ` | ||
<div> | ||
<div> | ||
Tour Component | ||
</div> | ||
</div> | ||
`; |
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,49 @@ | ||
/** @format */ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { PayoutsRenameNotice } from '..'; | ||
|
||
jest.mock( '@wordpress/api-fetch', () => jest.fn() ); | ||
|
||
jest.mock( '@wordpress/data', () => ( { | ||
useDispatch: jest.fn().mockReturnValue( { updateOptions: jest.fn() } ), | ||
} ) ); | ||
|
||
jest.mock( '@woocommerce/components', () => ( { | ||
TourKit: () => <div>Tour Component</div>, | ||
} ) ); | ||
|
||
declare const global: { | ||
wcpaySettings: { | ||
isPayoutsRenameNoticeDismissed: boolean; | ||
}; | ||
}; | ||
|
||
describe( 'PayoutsRenameNotice', () => { | ||
afterEach( () => { | ||
jest.clearAllMocks(); | ||
} ); | ||
|
||
test( 'should render null if isPayoutsRenameNoticeDismissed is true', () => { | ||
global.wcpaySettings = { | ||
isPayoutsRenameNoticeDismissed: true, | ||
}; | ||
const { container } = render( <PayoutsRenameNotice /> ); | ||
expect( container.firstChild ).toBeNull(); | ||
} ); | ||
|
||
test( 'should render notice if isPayoutsRenameNoticeDismissed is false', () => { | ||
global.wcpaySettings = { | ||
isPayoutsRenameNoticeDismissed: false, | ||
}; | ||
const { container } = render( <PayoutsRenameNotice /> ); | ||
expect( container ).toMatchSnapshot(); | ||
} ); | ||
} ); |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this does not have any effect because the value of
isPayoutsRenameNoticeDismissed
never changes.What do you think @Jinksi ?