Skip to content
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

On-/offboarding copy updates #39055

Merged
merged 20 commits into from Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
17f7f49
Change the modal's description test in the first step of the product …
mdperez86 Jun 30, 2023
e308870
Change the modal's description text in the first step of the product …
mdperez86 Jun 30, 2023
2ccc413
Change the modal's description text in the second step of the product…
mdperez86 Jun 30, 2023
ba2b287
Change the modal's title and description text in the third step of th…
mdperez86 Jun 30, 2023
8b2d984
Change the modal's description text in the four step of the product b…
mdperez86 Jun 30, 2023
1b5acc5
Enhance the Options menu of the product block editor
mdperez86 Jun 30, 2023
fb5f524
Add slide up animation and translucent background to the feedback bot…
mdperez86 Jun 30, 2023
cd034ea
Change de CES's modal heading text in the product block editor
mdperez86 Jun 30, 2023
714cf30
Change the notice message after the feedback is being sent from the C…
mdperez86 Jun 30, 2023
846a796
Enhance leave feedback modal checkbox labels
mdperez86 Jun 30, 2023
cde6ff0
Change leave feedback modal submit button text
mdperez86 Jun 30, 2023
1b51494
Show success notice after submit the leave feedback modal
mdperez86 Jun 30, 2023
1382826
Add changelog files
mdperez86 Jun 30, 2023
1efd8eb
Change the illustration in the first step of the feature tour
mdperez86 Jul 5, 2023
0df9826
Change the modal's title and description text in the first step of th…
mdperez86 Jul 5, 2023
18d08d2
Change the modal's title and description text in the first step of th…
mdperez86 Jul 5, 2023
2b7005c
Change the modal's title and description text in the third step of th…
mdperez86 Jul 5, 2023
01e0d5b
Fix unit tests
mdperez86 Jul 5, 2023
743725a
Change the customer effort score changelog description
mdperez86 Jul 10, 2023
dca1433
Change footer forward button to primary and backward button to tertia…
mdperez86 Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/js/customer-effort-score/changelog/enhancement-38960
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fixing the onsubmit_label prop from SHOW_CES_MODAL action incorreclty named as onSubmitLabel
2 changes: 1 addition & 1 deletion packages/js/customer-effort-score/src/store/reducer.js
Expand Up @@ -28,7 +28,7 @@ const reducer = ( state = DEFAULT_STATE, action ) => {
action: action.surveyProps.action,
showDescription: action.surveyProps.showDescription,
title: action.surveyProps.title,
onSubmitLabel: action.onSubmitLabel,
onSubmitLabel: action.onsubmit_label,
firstQuestion: action.surveyProps.firstQuestion,
secondQuestion: action.surveyProps.secondQuestion,
onSubmitNoticeProps: action.onSubmitNoticeProps || {},
Expand Down
4 changes: 4 additions & 0 deletions packages/js/product-editor/changelog/enhancement-38960
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

New product block editor modal text enhancements
Expand Up @@ -53,7 +53,7 @@ export function FeedbackBar( { product }: FeedbackBarProps ) {
action: PRODUCT_EDITOR_FEEDBACK_CES_ACTION,
showDescription: false,
title: __(
"How's your experience with the new product form?",
'What do you think of the new product form?',
'woocommerce'
),
firstQuestion: __(
Expand All @@ -65,7 +65,7 @@ export function FeedbackBar( { product }: FeedbackBarProps ) {
'woocommerce'
),
onsubmitLabel: __(
"Thanks for the feedback. We'll put it to good use!",
"Thanks for the feedback — we'll put it to good use!",
'woocommerce'
),
shouldShowComments: () => false,
Expand Down Expand Up @@ -174,7 +174,6 @@ export function FeedbackBar( { product }: FeedbackBarProps ) {
{},
{
type: 'snackbar',
icon: <span>🌟</span>,
}
);
};
Expand All @@ -201,38 +200,40 @@ export function FeedbackBar( { product }: FeedbackBarProps ) {
<>
{ shouldShowFeedbackBar && (
<div className="woocommerce-product-mvp-ces-footer">
<Pill>Beta</Pill>
<div className="woocommerce-product-mvp-ces-footer__message">
{ createInterpolateElement(
__(
'How is your experience with the new product form? <span><shareButton>Share feedback</shareButton> or <turnOffButton>turn it off</turnOffButton></span>',
'woocommerce'
),
{
span: (
<span className="woocommerce-product-mvp-ces-footer__message-buttons" />
),
shareButton: (
<Button
variant="link"
onClick={ onShareFeedbackClick }
/>
),
turnOffButton: (
<Button
onClick={ onTurnOffEditorClick }
variant="link"
/>
<div className="woocommerce-product-mvp-ces-footer__body">
<Pill>Beta</Pill>
<div className="woocommerce-product-mvp-ces-footer__message">
{ createInterpolateElement(
__(
'How is your experience with the new product form? <span><shareButton>Share feedback</shareButton> or <turnOffButton>turn it off</turnOffButton></span>',
'woocommerce'
),
}
) }
{
span: (
<span className="woocommerce-product-mvp-ces-footer__message-buttons" />
),
shareButton: (
<Button
variant="link"
onClick={ onShareFeedbackClick }
/>
),
turnOffButton: (
<Button
onClick={ onTurnOffEditorClick }
variant="link"
/>
),
}
) }
</div>
<Button
className="woocommerce-product-mvp-ces-footer__close-button"
icon={ closeSmall }
label={ __( 'Hide this message', 'woocommerce' ) }
onClick={ onHideFeedbackBarClick }
></Button>
</div>
<Button
className="woocommerce-product-mvp-ces-footer__close-button"
icon={ closeSmall }
label={ __( 'Hide this message', 'woocommerce' ) }
onClick={ onHideFeedbackBarClick }
></Button>
</div>
) }
</>
Expand Down
44 changes: 31 additions & 13 deletions packages/js/product-editor/src/components/feedback-bar/style.scss
@@ -1,20 +1,38 @@
$gutenberg-blue: var(--wp-admin-theme-color);

@keyframes slide-up {
0% {
bottom: -60px;
}
100% {
bottom: 0;
}
}

.woocommerce-product-mvp-ces-footer {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
// the left/right padding is set to this to match the padding of
// .block-editor-block-list__layout.is-root-container and
// .editor-styles-wrapper combined
padding: $gap calc(2 * $gap + $gap-small);
gap: $gap;
position: fixed;
animation: slide-up 0.5s forwards;
width: 100%;
border-top: 1px solid var(--gutenberg-gray-100, #f0f0f0);
background: rgba(255, 255, 255, 0.5);
backdrop-filter: blur(6px);

@include breakpoint(">782px") {
padding: $gap 0;
max-width: 650px;
margin: 0 auto;
&__body {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
// the left/right padding is set to this to match the padding of
// .block-editor-block-list__layout.is-root-container and
// .editor-styles-wrapper combined
padding: $gap calc(2 * $gap + $gap-small);
gap: $gap;

@include breakpoint(">782px") {
padding: $gap 0;
max-width: 650px;
margin: 0 auto;
}
}

.woocommerce-pill {
Expand Down
Expand Up @@ -16,6 +16,7 @@ import {
import { FeedbackModal } from '@woocommerce/customer-effort-score';
import { Text } from '@woocommerce/experimental';
import { __ } from '@wordpress/i18n';
import { useDispatch } from '@wordpress/data';

/**
* Provides a modal requesting customer feedback.
Expand Down Expand Up @@ -56,13 +57,13 @@ function ProductMVPFeedbackModal( {
},
{
key: 'difficult-to-use',
label: __( 'It is difficult to use', 'woocommerce' ),
label: __( "It's difficult to use", 'woocommerce' ),
checked: difficultToUse,
onChange: setDifficultToUse,
},
{
key: 'slow-buggy-or-broken',
label: __( 'It is slow, buggy, or broken', 'woocommerce' ),
label: __( "It's slow, buggy, or broken", 'woocommerce' ),
checked: slowBuggyOrBroken,
onChange: setSlowBuggyOrBroken,
},
Expand All @@ -79,8 +80,16 @@ function ProductMVPFeedbackModal( {
.filter( ( checkbox ) => checkbox.checked )
.map( ( checkbox ) => checkbox.key );

const { createSuccessNotice } = useDispatch( 'core/notices' );

const onSendFeedback = () => {
recordScoreCallback( checked, comments, email );
createSuccessNotice(
__(
"Thanks for the feedback — we'll put it to good use!",
'woocommerce'
)
);
};

const optionalElement = (
Expand All @@ -98,7 +107,7 @@ function ProductMVPFeedbackModal( {
onSubmit={ onSendFeedback }
onModalClose={ onCloseModal }
isSubmitButtonDisabled={ ! checked.length }
submitButtonLabel={ __( 'Send feedback', 'woocommerce' ) }
submitButtonLabel={ __( 'Send', 'woocommerce' ) }
cancelButtonLabel={ __( 'Skip', 'woocommerce' ) }
className="woocommerce-product-mvp-feedback-modal"
>
Expand Down
@@ -1,8 +1,9 @@
/**
* External dependencies
*/
import { render, screen, fireEvent } from '@testing-library/react';
import { render, screen, fireEvent, act } from '@testing-library/react';
import { createElement } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -11,7 +12,22 @@ import { ProductMVPFeedbackModal } from '../index';

const mockRecordScoreCallback = jest.fn();

jest.mock( '@wordpress/data', () => ( {
...jest.requireActual( '@wordpress/data' ),
useDispatch: jest.fn(),
} ) );

describe( 'ProductMVPFeedbackModal', () => {
const createSuccessNotice = jest.fn();

beforeEach( () => {
( useDispatch as jest.Mock ).mockReturnValue( { createSuccessNotice } );
} );

afterEach( () => {
jest.resetAllMocks();
} );

it( 'should close the ProductMVPFeedback modal when skip button pressed', async () => {
render(
<ProductMVPFeedbackModal
Expand All @@ -33,9 +49,7 @@ describe( 'ProductMVPFeedbackModal', () => {
// Wait for the modal to render.
await screen.findByRole( 'dialog' );
fireEvent.click( screen.getByRole( 'checkbox', { name: /other/i } ) );
fireEvent.click(
screen.getByRole( 'button', { name: /Send feedback/i } )
);
fireEvent.click( screen.getByRole( 'button', { name: /Send/i } ) );
} );
it( 'should call the function sent as recordScoreCallback with the checked options', async () => {
render(
Expand All @@ -45,7 +59,15 @@ describe( 'ProductMVPFeedbackModal', () => {
);
// Wait for the modal to render.
await screen.findByRole( 'dialog' );
fireEvent.click( screen.getByRole( 'checkbox', { name: /other/i } ) );
act( () => {
fireEvent.click(
screen.getByRole( 'checkbox', { name: /other/i } )
);
} );
act( () => {
fireEvent.click( screen.getByRole( 'button', { name: /Send/i } ) );
} );

expect( mockRecordScoreCallback ).toHaveBeenCalledWith(
[ 'other' ],
'',
Expand Down
Expand Up @@ -31,7 +31,7 @@ export const AboutTheEditorMenuItem = ( {
icon={ <Icon icon={ info } /> }
iconPosition="right"
>
{ __( 'About the editor…', 'woocommerce' ) }
{ __( 'About the form…', 'woocommerce' ) }
</MenuItem>
{ isGuideOpen && (
<BlockEditorGuide
Expand Down
Expand Up @@ -35,7 +35,7 @@ export const FeedbackMenuItem = ( { onClick }: { onClick: () => void } ) => {
action: 'new_product',
showDescription: false,
title: __(
"How's your experience with the new product form?",
'What do you think of the new product form?',
'woocommerce'
),
firstQuestion: __(
Expand All @@ -46,6 +46,10 @@ export const FeedbackMenuItem = ( { onClick }: { onClick: () => void } ) => {
"The product editing screen's functionality meets my needs",
'woocommerce'
),
onsubmitLabel: __(
"Thanks for the feedback — we'll put it to good use!",
'woocommerce'
),
getExtraFieldsToBeShown: (
values: {
email?: string;
Expand Down Expand Up @@ -161,7 +165,6 @@ export const FeedbackMenuItem = ( { onClick }: { onClick: () => void } ) => {
},
{
type: 'snackbar',
icon: <span>🌟</span>,
},
{
block_editor: isDescendantOf( 'product-block-editor' ),
Expand Down
@@ -1,6 +1,8 @@
/**
* External dependencies
*/
import { MenuGroup } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
__experimentalProductMVPFeedbackModalContainer as ProductMVPFeedbackModalContainer,
__experimentalWooProductMoreMenuItem as WooProductMoreMenuItem,
Expand Down Expand Up @@ -46,27 +48,31 @@ const MoreMenuFill = ( { onClose }: { onClose: () => void } ) => {

return (
<>
<FeedbackMenuItem
onClick={ () => {
recordClick( 'feedback' );
onClose();
} }
/>
<ClassicEditorMenuItem
productId={ id }
onClick={ () => {
recordClick( 'classic_editor' );
onClose();
} }
/>
<AboutTheEditorMenuItem
onClick={ () => {
recordClick( 'about' );
} }
onCloseGuide={ () => {
onClose();
} }
/>
<MenuGroup label={ __( 'New product form (Beta)', 'woocommerce' ) }>
<AboutTheEditorMenuItem
onClick={ () => {
recordClick( 'about' );
} }
onCloseGuide={ () => {
onClose();
} }
/>
<FeedbackMenuItem
onClick={ () => {
recordClick( 'feedback' );
onClose();
} }
/>
</MenuGroup>
<MenuGroup>
<ClassicEditorMenuItem
productId={ id }
onClick={ () => {
recordClick( 'classic_editor' );
onClose();
} }
/>
</MenuGroup>
</>
);
};
Expand Down