Skip to content

Conversation

@louwie17
Copy link
Contributor

@louwie17 louwie17 commented Nov 23, 2022

All Submissions:

Changes proposed in this Pull Request:

Hook in the CES modal to the share feedback button in the new product MVP
Closes #35300 .

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Load this branch, build it, and make sure you have the new-product-management-experience feature flag enabled (you can do so using the latest version of the Beta tester within the mono repo).
  2. Make sure you have tracks enabled and also outputted in the console: localStorage.setItem( 'debug', 'wc-admin:*' );
  3. Go to Products > Add New (MVP)
  4. In the top right click the 3 dots and click the Share feedback button
  5. This should show the CES modal asking How's your experience with the product editor?
  6. Answer it with your console open, this should trigger a ces_feedback track with the new_product action.
  7. Now check if the CES footer still works by making sure the woocommerce_ces_product_mvp_ces_action option is removed
  8. Save a product which should show the CES footer bar and click the Share feedback this should still correctly show the CES modal.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@louwie17 louwie17 requested a review from a team November 23, 2022 13:48
@github-actions
Copy link
Contributor

github-actions bot commented Nov 23, 2022

Test Results Summary

Commit SHA: fac751e

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 54s
E2E Tests186006019214m 46s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@louwie17 louwie17 force-pushed the add/35129_product_mvp_ces branch 2 times, most recently from be6f3fc to 3952fbc Compare November 24, 2022 08:49
@louwie17 louwie17 force-pushed the add/35300_ces_feedback_product_mvp branch from 9e77e69 to 348e00c Compare November 24, 2022 09:08
@louwie17 louwie17 self-assigned this Nov 29, 2022
@joelclimbsthings joelclimbsthings requested review from joelclimbsthings and removed request for a team November 30, 2022 01:57
( getOption( ADMIN_INSTALL_TIMESTAMP_OPTION_NAME ) as number ) || 0;

const resolving =
adminInstallTimestamp === null ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is adminInstallTimestamp ever null? Just curious since you're casting it as a number TS style just above.

Copy link
Contributor

@joelclimbsthings joelclimbsthings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @louwie17 ! Love centralizing some of this logic in the data store. Could we also implement that approach in the completed-header component?

I left a few minor comments, and a couple regarding needing to update some of the CES data to support the additional question changes merged earlier after a rebase.


const resolving =
adminInstallTimestamp === null ||
isResolving( 'getOption', [ ADMIN_INSTALL_TIMESTAMP_OPTION_NAME ] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to think hasFinishedResolution is more reliable than isResolving here, since isResolving will briefly be false initially, but perhaps it's working well enough in this context?


return (
<CustomerFeedbackModal
label={ visibleCESModalData.label }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you rebase on trunk this will need to be updated to include title instead of label, as well as firstQuestion and secondQuestion.


const recordScore = ( score: number, comments: string ) => {
recordEvent( 'ces_feedback', {
action: visibleCESModalData.action,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also need to be updated to include the score for both questions, and score_combined.

),
visibleCESModalData.onSubmitNoticeProps || {}
);
hideCesModal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicky, but it feels like the hideCesModal() call shouldn't reside in the recordScore() function since it's not part of recording the score. Could throw it into an arrow function under the recordScoreCallback prop below.

cesModalData: undefined,
};
case TYPES.SHOW_CES_MODAL:
const cesModalData = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as well as the other data store calls will need to be updated as outlined in other comments.

* @param {Object} props object for optional props
* @param {Object} onSubmitNoticeProps object for on submit notice props.
*/
export function showCesModal(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is accepting a number of arguments, some of which could be undefined, perhaps we should have this accept an object with optional properties instead?

export function showCesModal( {
	action,
	label,
	onsubmitLabel = undefined,
	props = {},
	onSubmitNoticeProps = {}
} ) {
	return {

Base automatically changed from add/35129_product_mvp_ces to trunk December 2, 2022 09:35
@louwie17 louwie17 force-pushed the add/35300_ces_feedback_product_mvp branch from ccfe5fd to e44dc68 Compare December 2, 2022 10:32
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Dec 2, 2022
@louwie17
Copy link
Contributor Author

louwie17 commented Dec 2, 2022

Thanks for the review @joelclimbsthings, I believe I have addressed all your suggestions.

Could we also implement that approach in the completed-header component?

Yeah we certainly could, but I think it be a bit out of scope for this PR, I could certainly create a separate PR though once this is merged.

Copy link
Contributor

@joelclimbsthings joelclimbsthings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @louwie17 , it's working well! :shipit:

@louwie17 louwie17 merged commit e7dd1a0 into trunk Dec 2, 2022
@louwie17 louwie17 deleted the add/35300_ces_feedback_product_mvp branch December 2, 2022 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CES: Add the feedback button to the navbar only on product MVP

4 participants