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

A4A: Show a banner based on agency approval status #97708

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

travisw
Copy link
Contributor

@travisw travisw commented Dec 20, 2024

Related to https://github.com/Automattic/automattic-for-agencies-dev/issues/1608
PT: pfunGA-3ie-p2

Proposed Changes

  • We're introducing the ability flag new agencies for review. This change show a banner based on that agency approval status.

Note: There's an existing issue for a layout bug when these banners are displayed on mobile screen sizes.

Why are these changes being made?

  • To better inform users about their approval status.
  • As described in the backend PR, update the blog option for your agency and test the values pending, approved, and rejected.
  • Test the following pages to make sure the banner is shown properly (/overview; /marketplace/hosting/wpcom - including hosting, products, and checkout pages; /sites)

Pending

  • There should not be a close button shown
Screenshot 2024-12-20 at 1 48 49 PM

Rejected

  • There should not be a close button shown
  • The "contact us" link should open the contact form modal
Screenshot 2024-12-20 at 1 49 14 PM

Approved

  • You might need to hard code created_at field, as described in the backend PR if your agency is older than 1 week.
  • There should be a close button shown
  • After closing and refreshing the banner should not show again
  • On the backend hard code the created_at value to be older than 1 week. The banner should no longer be shown in this case
Screenshot 2024-12-20 at 1 48 02 PM

Note: You can clear the Calypso preference after closing the banner if need from the UI.

Screenshot 2024-12-20 at 1 43 35 PM

Testing Instructions

  • Also apply this backend PR (169166-ghe-Automattic/wpcom)

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@travisw travisw self-assigned this Dec 20, 2024
@matticbot
Copy link
Contributor

matticbot commented Dec 20, 2024

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • blaze-dashboard
  • command-palette-wp-admin
  • help-center
  • notifications
  • odyssey-stats
  • whats-new

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/a4a_show_banner_based_on_approval_status on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Dec 20, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~1880 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
a8c-for-agencies-marketplace      +1916 B  (+0.2%)     +767 B  (+0.3%)
a8c-for-agencies-client           +1812 B  (+0.1%)     +566 B  (+0.2%)
a8c-for-agencies-sites            +1793 B  (+0.1%)     +561 B  (+0.1%)
a8c-for-agencies-overview         +1793 B  (+0.2%)     +524 B  (+0.2%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@travisw travisw requested a review from a team December 20, 2024 23:29
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 20, 2024
Copy link
Contributor

@jkguidaven jkguidaven left a comment

Choose a reason for hiding this comment

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

Overall, it looks good. I have a few minor comments, but are non-blockers.

'We have not approved your application for the Automattic for Agencies program. Please {{a}}contact support{{/a}} to discuss this further if you think this was done in error.',
{
components: {
a: <a href="#contact-support" />,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the CONTACT_URL_HASH_FRAGMENT constant to replace '#contact-support'? This way, if we change the fragment, we only need to update one area.

Comment on lines +39 to +41
if ( ! agency?.approval_status ) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can exclude this condition, as the following line covers this already. What do you think?

	const bannerDetails = availableBannerDetails[ agency?.approval_status ];

	if ( ! bannerDetails ) {
		return null;
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants