site-kit-wp: Update the ReportError component to show the get help link

Feature Description

We need to add the “Get Help” link to the ReportError component to let users to get to the appropriate documentation page for the given error.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The ReportError component should be updated to display the “Get Help” link as shown on the Figma mock next to the retry button, if the retry button is displayed at all. image
    • Clicking on the Get Help link should redirect the user to the appropriate page on the documentation site.
    • The UI of the ReportError component should not change, this is out of scope for this ticket, the only thing that is required is to add the “get help” link with a small extra text Retry didn't work? in a similar way that it is done on the Figma mock.
    • If the “Retry” button does not apply to the ReportError, only the “Get help” link should be displayed instead (still with the same regular link appearance, but without the “Retry didn’t work?” prefix).

Implementation Brief

In assets/js/components/notifications/CTA.js:

  • Add an optional prop children.
  • Render the children property at the end of the .googlesitekit-cta div.

In assets/js/components/ReportError.js:

  • Update the CTA element rendering to use the children approach to render the retry button appended with Retry didn’t work? text and Get help link. If there is no retryable errors, then just display the Get help link in children.
    • Remove ctaType and ctaLabel props from the CTA component
    • Move the onClick property from the CTA component to the retry button defined in children.
    • Fix the styles of the button and text alignment (only) to match the Figma design.
  • To get an URL for the “get help” link, pass the first item of the retryableErrors array to getErrorTroubleshootingLinkURL() selector of CORE_SITE store.

Test Coverage

  • In assets/js/components/ReportError.test.js, add a test case that verifies the get help link is available in the document.
  • In assets/js/components/ReportError.stories.js, verify the existing stories that render the Retry button has the get help link.

QA Brief

  • Check the ReportError stories to see the newly added Get Help links.
    • Check Variants with both Retryable and Not-retryable errors.
  • To test it on a real site:
    • Add the following PHP snippet on a mu-plugin or function.php.
    • Visit the Dashboard to see the Errors.
    • There should be get help link.
add_filter(
	'rest_pre_dispatch',
	function( $res, $_s, $req ) {
		if ( $req->get_route() == '/google-site-kit/v1/modules/analytics/data/report' ) {
			return new WP_Error( 'rest_bad_request', 'Intentionally broken for testing.', array( 'status' => 400 ) );
		}
		return $res;
	},
	10,
	3
);

Changelog entry

  • Add “get help” links to error messages.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@mohitwp I have updated the QA Brief. Cheers cc @wpdarren

the stories in Storybook do not look like the FIgma design mocks. I’m looking at the ReportError components.

@wpdarren check AC it says that UI changes are out of scope for this ticket. Just new link should be added.

… but struggling to test based on the QAB.

Also, rather than relying on Storybook to QA this, do we have instructions where we can trigger these report errors, maybe some code or a browser extension that we can use to make them error? I’d like to be able to test this on a site.

Thoughts?

@kuasha420 could you please provide a more detailed QAB and maybe a snippet that can be added to the functions.php file to break some report requests?

@eugene-manuilov Looks good, could you add something though to clarify that the UI from Figma should not really be implemented though? It’s only about adding the extra link in a similar way that it is done there, but in our current error UI.