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

feat(ras): allow skipping prerequisites; avoid dead end in onboarding #3738

Merged
merged 6 commits into from
Feb 12, 2025

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Feb 10, 2025

All Submissions:

Changes proposed in this Pull Request:

Allows certain prerequisites in the Audience Management onboarding flow to be skipped if not strictly required. Skipping prerequisites will allow you to enable Audience Management features, and skipped prerequisites can always be completed at a later time.

Also avoids a dead end state in the UI by decoupling the newspack_reader_activation_enabled option from the check of whether the default campaign was configured or skipped.

How to test the changes in this Pull Request:

  1. Start with a fresh site running this PR build and fix(ras): rename Reader Activation to Audience Management throughout admin newspack-popups#1393, and complete all initial site setup.
  2. After site setup, visit Audience > Setup and install any missing required plugins.
  3. Confirm that among the incomplete prerequisites, the "Legal Pages", "reCAPTCHA", and "Audience Management Campaign" prerequisites all have a "Skip" button like this:
Screenshot 2025-02-10 at 11 24 00 AM
  1. Skip the prerequisites that have a "Skip" button, and complete the prerequisites that don't. Confirm that you're prompted with an extra confirmation dialog when skipping, and that skipped prerequisites show a "skipped" state after skipping:
Screenshot 2025-02-10 at 11 56 15 AM Screenshot 2025-02-10 at 12 13 55 PM
  1. After skipping or completing all prerequisites, confirm that the UI shows the "enabled" state (a message at top saying "Audience Management is enabled", plus extra settings related to Newsletters and ESP syncing below the onboarding checklist). Also confirm that Audience Management features are enabled on the front-end.
  2. Confirm that after this, you can still complete skipped prerequisites, including the default Campaigns and that completing them clears the "skipped" status and shows a "Ready" green status instead.

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 successfully ran tests with your changes locally?

@dkoo dkoo requested a review from a team as a code owner February 10, 2025 20:39
@dkoo dkoo self-assigned this Feb 10, 2025
@dkoo dkoo added [Status] Needs Review The issue or pull request needs to be reviewed Information Architecture labels Feb 10, 2025
@dkoo
Copy link
Contributor Author

dkoo commented Feb 10, 2025

@thomasguillot this could use a design review as well, in case you have any feedback on the "skip"-related UX.

@dkoo dkoo requested a review from a team February 10, 2025 20:40
Base automatically changed from fix/ras-to-audience-management to epic/ia February 10, 2025 20:53
@thomasguillot
Copy link
Contributor

The checkbox doesn't need to be yellow. I think it's fine to just keep the "radio" button empty. For the confirmation dialogue. Could we get a proper Modal instead?

Modal:

  • Title: Skip this step
  • Content: Are you sure you want to skip this step? You can always come back later.
  • Buttons: Cancel | Skip

Copy link
Contributor

@thomasguillot thomasguillot left a comment

Choose a reason for hiding this comment

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

@dkoo
Copy link
Contributor Author

dkoo commented Feb 11, 2025

Thanks for the feedback, @thomasguillot! I'll amend the PR with those changes before putting this up for code review again.

@dkoo dkoo removed the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 11, 2025
@dkoo dkoo marked this pull request as draft February 11, 2025 17:12
@dkoo
Copy link
Contributor Author

dkoo commented Feb 11, 2025

@thomasguillot 17a8223 changes the confirmation modal to a true Modal component instead of the browser modal:

Screenshot 2025-02-11 at 1 01 20 PM

It also simplifies the same functionality in the campaign setup view to use the same function and component as the other prerequisites.

For future reference, this is implemented on the higher order WithWizard component, so any component wrapped by this HOC can show a similar confirmation modal with the confirmAction method passed down via props.

confirmAction(
	__( 'Modal title', 'newspack-plugin' ),
	__( 'Modal message.', 'newspack-plugin' ),
	() => {
		// Some function to run when the user confirms
	}
);

@dkoo dkoo marked this pull request as ready for review February 11, 2025 20:29
@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 11, 2025
@dkoo dkoo requested a review from thomasguillot February 11, 2025 20:33
@thomasguillot
Copy link
Contributor

Screenshot 2025-02-11 at 1 01 20 PM

I don't really like how it looks

Can we:

  • Remove the title (*)
  • Remove the close button (*)
  • Move the Primary button after the Secondary button
  • Change the Primary button label to "Skip" (*)

(*) Only for this case so we can keep the higher order WithWizard component

@dkoo
Copy link
Contributor Author

dkoo commented Feb 12, 2025

@thomasguillot how does this look? 3dbec2d

Screenshot 2025-02-11 at 5 12 04 PM

The HOC's confirmAction method now takes a single param which is an options object to allow for overwriting defaults.

/**
 * Build a confirmation modal with the given title & message.
 * Execute {callback} if confirmed.
 *
 * @property {Object}   options             Options for the confirmation modal.
 * @property {string}   options.title       The title for the modal component.
 * @property {string}   options.message     The message for the modal component body.
 * @property {string}   options.confirmText The text for the confirmation button.
 * @property {string}   options.cancelText  The text for the cancel button.
 * @property {Function} options.callback    A function to call if the user confirms the action.
 */
confirmAction = ( options ) => {
	const modalOptions = {
		title: null,
		message: __( 'Are you sure?', 'newpack-plugin' ),
		confirmText: __( 'OK', 'newspack-plugin' ),
		cancelText: __( 'Cancel', 'newspack-plugin' ),
		callback: null,
		...options,
	}
	this.setState( { confirmation: modalOptions } );
}

@thomasguillot
Copy link
Contributor

@dkoo I prefer it. Thank you very much! ❤️

@thomasguillot
Copy link
Contributor

✅ Design

@thomasguillot thomasguillot requested review from thomasguillot and removed request for thomasguillot February 12, 2025 07:37
Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

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

Works as described!

Non-blocking comment, since it has already gone through design. When legal pages are skipped and I open it to edit I get the card content attached to the notice:

image

I think we could either remove the border or add some spacing.

@github-actions github-actions bot added the [Status] Approved The pull request has been reviewed and is ready to merge label Feb 12, 2025
@github-actions github-actions bot removed the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 12, 2025
@thomasguillot
Copy link
Contributor

Non-blocking comment, since it has already gone through design. When legal pages are skipped and I open it to edit I get the card content attached to the notice:

Oh I didn't see this! Yes, the border needs to be removed

@dkoo
Copy link
Contributor Author

dkoo commented Feb 12, 2025

Whoops, good catch! 06ba10b should fix this:

Screenshot 2025-02-12 at 9 35 14 AM

@dkoo dkoo merged commit f89890c into epic/ia Feb 12, 2025
8 checks passed
@dkoo dkoo deleted the fix/ras-setup-avoid-dead-end branch February 12, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Information Architecture [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants