Skip to content

Improve Onboarding#2042

Merged
Crabcyborg merged 28 commits into
masterfrom
improve-onboarding
Oct 22, 2024
Merged

Improve Onboarding#2042
Crabcyborg merged 28 commits into
masterfrom
improve-onboarding

Conversation

@shervElmi
Copy link
Copy Markdown
Contributor

@shervElmi shervElmi commented Oct 11, 2024

PR Description

This PR enhances and updates the existing Formidable Forms Onboarding Wizard for improved functionality and user experience.

QA URL

https://qa.formidableforms.com/sherv/wp-admin/admin.php?page=formidable-onboarding-wizard

Demo Video

https://share.cleanshot.com/2L0v82hf

Onboarding.Wizard.mp4

To easily load the onboarding wizard after having already activated Formidable before is to load /wp-admin/admin.php?page=formidable-onboarding-wizard directly

@shervElmi shervElmi self-assigned this Oct 14, 2024
@shervElmi shervElmi requested a review from Crabcyborg October 17, 2024 15:58
@shervElmi shervElmi marked this pull request as ready for review October 17, 2024 15:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 17, 2024

Walkthrough

The pull request introduces significant modifications to the onboarding process, primarily focusing on the transition from a welcome step to a consent tracking step. This includes changes to the FrmOnboardingWizardController class, which now initializes the onboarding wizard with a new step and updated AJAX handling. New files for the consent tracking and unsuccessful steps have been added, while several existing files related to previous steps have been removed. Additionally, CSS and JavaScript updates enhance the visual and functional aspects of the onboarding wizard.

Changes

File Path Change Summary
classes/controllers/FrmOnboardingWizardController.php Updated INITIAL_STEP, renamed ajax_setup_email_step to ajax_consent_tracking, modified step parts, and removed email settings parameters.
classes/helpers/FrmOnboardingWizardHelper.php Changed default argument values in print_footer method.
classes/views/onboarding-wizard/footer.php Added CSS class to back button and conditional check for icon in primary button.
classes/views/onboarding-wizard/index.php Changed data-current-step attribute and added rootline list.
classes/views/onboarding-wizard/steps/consent-tracking-step.php New file created for consent tracking step with structured interface.
classes/views/onboarding-wizard/steps/default-email-address-step.php File deleted.
classes/views/onboarding-wizard/steps/install-addons-step.php Updated icon to image and clarified CTA for Pro version.
classes/views/onboarding-wizard/steps/install-formidable-pro-step.php File deleted.
classes/views/onboarding-wizard/steps/license-management-step.php File deleted.
classes/views/onboarding-wizard/steps/success-step.php Replaced icon with SVG logo and updated success text.
classes/views/onboarding-wizard/steps/unsuccessful-step.php New file created for unsuccessful step of onboarding wizard.
classes/views/onboarding-wizard/steps/welcome-step.php File deleted.
css/admin/onboarding-wizard.css CSS modifications for visual structure, including new classes.
css/frm_admin.css Extensive CSS updates for styles and responsive design.
js/onboarding-wizard.js Restructured class and enhanced event handling with new utility functions.
js/src/onboarding-wizard/dataUtils/setupUsageData.js Expanded conditions for appending completed steps and removed email step data logic.
js/src/onboarding-wizard/elements/elements.js Removed multiple elements related to onboarding wizard.
js/src/onboarding-wizard/events/backButtonListener.js Simplified onBackButtonClick function signature.
js/src/onboarding-wizard/events/checkProInstallationButtonListener.js File deleted.
js/src/onboarding-wizard/events/consentTrackingButtonListener.js New file for managing events related to consent tracking button.
js/src/onboarding-wizard/events/index.js Updated to replace several event listeners with the new consent tracking event.
js/src/onboarding-wizard/events/saveLicenseButtonListener.js File deleted.
js/src/onboarding-wizard/events/setupEmailStepButtonListener.js File deleted.
js/src/onboarding-wizard/events/skipProInstallationButtonListener.js File deleted.
js/src/onboarding-wizard/events/skipStepButtonListener.js Simplified onSkipStepButtonClick function signature.
js/src/onboarding-wizard/index.js Removed comment line; functionality unchanged.
js/src/onboarding-wizard/shared/constants.js Removed several constants and updated STEPS object.
js/src/onboarding-wizard/shared/pageState.js Removed emailStepData property from exported object.
js/src/onboarding-wizard/ui/index.js Modified export statements to focus on rootline functionalities.
js/src/onboarding-wizard/ui/rootline.js New function updateRootline introduced.
js/src/onboarding-wizard/ui/setupInitialView.js Removed functions related to progress indicators and email form handling.
js/src/onboarding-wizard/ui/showError.js File deleted.
js/src/onboarding-wizard/utils/navigateToStep.js Modified to call updateRootline after updating URL query parameter.
classes/models/FrmInstallPlugin.php Restructured ajax_install_plugin method to check if plugin is already installed before activation. Added is_plugin_installed method.
js/src/onboarding-wizard/events/installAddonsButtonListener.js Updated installAddon function to include isInstalled parameter for better installation logic.

Possibly related PRs

Suggested reviewers

  • Crabcyborg

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 15

🧹 Outside diff range and nitpick comments (16)
js/src/onboarding-wizard/events/consentTrackingButtonListener.js (1)

17-22: LGTM: Well-structured event handling setup.

The addConsentTrackingButtonEvents function is clear and concise. It uses centralized element retrieval and prevents default button behavior, which are good practices.

Consider adding a check for the existence of consentTrackingButton before attaching the event listener to improve robustness:

 function addConsentTrackingButtonEvents() {
 	const { consentTrackingButton } = getElements();
 
+	if (consentTrackingButton) {
 		// Attach click event listener
 		onClickPreventDefault( consentTrackingButton, onConsentTrackingButtonClick );
+	}
 }
js/src/onboarding-wizard/events/index.js (1)

Line range hint 1-46: Overall approval with recommendations for testing.

The changes in this file represent a significant refactoring of the onboarding process, aligning with the PR objectives to improve the onboarding experience. The removal of several event listeners and the addition of consent tracking suggest a more streamlined and privacy-focused approach.

However, given the scope of these changes:

  1. Ensure comprehensive end-to-end testing of the new onboarding flow.
  2. Verify that all necessary steps are still included and functional in the wizard.
  3. Consider updating documentation to reflect these changes in the onboarding process.
  4. If not already done, consider adding unit tests for the new addConsentTrackingButtonEvents function.
classes/views/onboarding-wizard/index.php (1)

14-24: LGTM: Well-structured onboarding rootline added

The new rootline provides a clear visual representation of the onboarding steps. The structure is consistent, and the use of data attributes facilitates easy JavaScript interaction.

Consider adding aria-label attributes to the list items to improve accessibility. For example:

- <li class="frm-rootline-item" data-step="consent-tracking">
+ <li class="frm-rootline-item" data-step="consent-tracking" aria-label="Consent tracking step">
js/src/onboarding-wizard/ui/rootline.js (1)

14-22: Consider enhancing the function documentation.

The JSDoc comments provide a good overview of the function's purpose and parameter. However, it might be beneficial to add more details about the return value.

Consider updating the @return tag as follows:

- * @return {void}
+ * @return {void} This function doesn't return a value, it updates the DOM directly.
classes/views/onboarding-wizard/steps/success-step.php (2)

20-20: Approved: Improved congratulatory message with a minor suggestion.

The updated message is more concise and directly acknowledges the completion of the onboarding process, which is great. It's properly escaped and ready for localization.

Consider adding a brief call-to-action or next step in the message. For example:

- <?php esc_html_e( 'Congratulations on completing the onboarding process! We hope you enjoy using Formidable Forms.', 'formidable' ); ?>
+ <?php esc_html_e( 'Congratulations on completing the onboarding process! We hope you enjoy using Formidable Forms. Ready to create your first form?', 'formidable' ); ?>

This addition could provide a smoother transition to the "Create a Form" button below.


Line range hint 1-39: Overall: Positive improvements to the onboarding success step.

The changes in this file enhance the visual appeal and user experience of the onboarding success step. The updated logo, congratulatory message, and button text align well with the PR objectives of improving the onboarding process. The modifications maintain good coding practices, including proper escaping and localization support.

To further improve the onboarding experience, consider the following suggestions:

  1. Add analytics tracking to measure the effectiveness of the onboarding process.
  2. Implement A/B testing for different variations of the success message to optimize user engagement.
  3. Consider adding a brief survey or feedback mechanism at this step to gather user input on the onboarding process.
classes/views/onboarding-wizard/steps/unsuccessful-step.php (2)

12-22: LGTM: Well-structured HTML with proper escaping.

The HTML structure is well-formed, uses appropriate classes for styling, and provides clear information about the error. The use of escaping functions (esc_attr, esc_url, esc_html) is good for security.

Consider adding a more specific class to the main section element for easier targeting in CSS:

- <section id="frm-onboarding-unsuccessful-step" class="frm-onboarding-step frm-card-box frmcenter frm_hidden" data-step-name="<?php echo esc_attr( $step ); ?>">
+ <section id="frm-onboarding-unsuccessful-step" class="frm-onboarding-step frm-onboarding-unsuccessful-step frm-card-box frmcenter frm_hidden" data-step-name="<?php echo esc_attr( $step ); ?>">

24-37: LGTM: Good use of helper function for footer generation.

The use of FrmOnboardingWizardHelper::print_footer promotes code reusability. The options passed to the function are well-structured and provide clear information about the buttons. The use of admin_url() for generating URLs is good practice.

Consider extracting the array of options into a separate variable for better readability:

+ $footer_options = array(
+     'footer-class'               => 'frm-justify-center frm-mt-2xl',
+     'display-back-button'        => false,
+     'primary-button-text'        => __( 'Go to Dashboard', 'formidable' ),
+     'primary-button-href'        => admin_url( 'admin.php?page=' . FrmDashboardController::PAGE_SLUG ),
+     'primary-button-role'        => false,
+     'secondary-button-text'      => __( 'Install Manually', 'formidable' ),
+     'secondary-button-href'      => admin_url( 'plugin-install.php' ),
+     'secondary-button-role'      => false,
+     'secondary-button-skip-step' => false,
+ );
- FrmOnboardingWizardHelper::print_footer(
-     array(
-         'footer-class'               => 'frm-justify-center frm-mt-2xl',
-         'display-back-button'        => false,
-         'primary-button-text'        => __( 'Go to Dashboard', 'formidable' ),
-         'primary-button-href'        => admin_url( 'admin.php?page=' . FrmDashboardController::PAGE_SLUG ),
-         'primary-button-role'        => false,
-         'secondary-button-text'      => __( 'Install Manually', 'formidable' ),
-         'secondary-button-href'      => admin_url( 'plugin-install.php' ),
-         'secondary-button-role'      => false,
-         'secondary-button-skip-step' => false,
-     )
- );
+ FrmOnboardingWizardHelper::print_footer( $footer_options );
js/src/onboarding-wizard/dataUtils/setupUsageData.js (1)

36-43: Improved logic for handling completed steps. Consider further optimization.

The changes improve the function's logic by:

  1. Including both successful and unsuccessful steps.
  2. Preventing duplicate entries in processedSteps.

These modifications enhance the robustness of the onboarding process tracking.

Consider simplifying the logic further:

 if ( STEPS.SUCCESS === nextStepName || STEPS.UNSUCCESSFUL === nextStepName ) {
     const { processedSteps } = getState();

-    if ( processedSteps.length > 1 ) {
-        if ( ! processedSteps.includes( nextStepName ) ) {
-            processedSteps.push( nextStepName );
-        }
+    if ( processedSteps.length > 0 && !processedSteps.includes( nextStepName ) ) {
+        processedSteps.push( nextStepName );

         formData = new FormData();
         formData.append( 'processed_steps', processedSteps.join( ',' ) );
         formData.append( 'completed_steps', true );
     }
 }

This change reduces nesting and combines the conditions, making the code more readable and efficient.

js/src/onboarding-wizard/utils/navigateToStep.js (2)

43-49: LGTM: Refactoring and rootline update

The changes improve the code structure by extracting onboardingWizardPage from getElements(). The addition of updateRootline(stepName) enhances the UI feedback during navigation.

Consider adding a comment explaining the purpose of updateRootline for better code documentation.

 setQueryParam( 'step', stepName, updateMethod );

+	// Update the rootline UI to reflect the current step
 updateRootline( stepName );

77-77: LGTM: Added usage data tracking

The addition of setupUsageData(processedStep, nextStepName) enhances the onboarding process by tracking user progress. This is in line with the PR objectives.

Consider adding error handling for the setupUsageData call to ensure robustness:

-	setupUsageData( processedStep, nextStepName );
+	try {
+		setupUsageData( processedStep, nextStepName );
+	} catch (error) {
+		console.error('Failed to setup usage data:', error);
+		// Optionally, you can add analytics or error reporting here
+	}
css/admin/onboarding-wizard.css (3)

53-64: LGTM: Improved dropdown styling with a minor suggestion

The new styles for .frm-dropdown-menu and related elements improve the dropdown's appearance and behavior. The removal of default positioning and transform, along with the full-width setting, should enhance usability.

Consider adding a transition property to the .frmsvg rotation for a smoother animation:

.dropdown .frm-dropdown-toggle .frmsvg {
  transition: transform 0.3s ease;
}

This will create a smoother rotation effect when the dropdown is toggled.


69-80: LGTM: Consistent tooltip styling with a suggestion

The updates to the tooltip styles ensure consistency with the "Install Formidable Add-ons" step, as mentioned in the comment. This improves the overall visual coherence of the onboarding wizard.

Consider using a CSS variable for the new tooltip color (#545f6e) to maintain consistency and ease future updates:

:root {
  --tooltip-bg-color: #545f6e;
}

.tooltip-inner {
  background-color: var(--tooltip-bg-color);
}

.bs-tooltip-top .arrow::before {
  border-top-color: var(--tooltip-bg-color);
}

.bs-tooltip-bottom .arrow::before {
  border-bottom-color: var(--tooltip-bg-color);
}

This approach would make it easier to update the tooltip color across all instances if needed in the future.


82-132: LGTM: Well-implemented step indicator with a suggestion for accessibility

The new styles for .frm-rootline and related elements create a visually appealing and functional step indicator for the onboarding process. The use of flexbox for layout and pseudo-elements for the connecting line is a good approach. The different states (completed, current) are styled appropriately, and the consistent use of CSS variables for colors and spacing is commendable.

To improve accessibility, consider adding aria-current="step" to the current step item in the HTML and then styling it in CSS. This will help screen readers identify the current step. Add the following CSS:

.frm-rootline-item[aria-current="step"] {
  background-color: #fff;
  border-color: var(--primary-500);
}

This approach provides both visual and programmatic indication of the current step, enhancing the user experience for all users, including those using assistive technologies.

classes/views/onboarding-wizard/steps/install-addons-step.php (2)

14-14: LGTM! Consider adding width and height attributes.

The replacement of the icon with the Formidable logo improves the visual representation of the onboarding step. The use of esc_url() and esc_attr() functions ensures proper escaping.

Consider adding width and height attributes to the <img> tag to improve Cumulative Layout Shift (CLS) performance:

-		<img class="frm-onboarding-logo" src="<?php echo esc_url( FrmAppHelper::plugin_url() ); ?>/images/logo.svg" alt="<?php esc_attr_e( 'Formidable Onboarding Wizard Logo', 'formidable' ); ?>" />
+		<img class="frm-onboarding-logo" src="<?php echo esc_url( FrmAppHelper::plugin_url() ); ?>/images/logo.svg" alt="<?php esc_attr_e( 'Formidable Onboarding Wizard Logo', 'formidable' ); ?>" width="200" height="40" />

Replace 200 and 40 with the actual dimensions of your logo.


75-85: LGTM! Consider adding aria-label to the icon.

The addition of the footer section for Pro users is a good improvement, providing clear guidance on how to connect their account. The code is well-structured and properly escaped.

Consider adding an aria-label to the icon for better accessibility:

-						<?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowup8_icon' ); ?>
+						<?php FrmAppHelper::icon_by_class( 'frmfont frm_arrowup8_icon', array( 'aria-label' => __( 'External link', 'formidable' ) ) ); ?>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2689641 and 0fb2f1a.

⛔ Files ignored due to path filters (3)
  • images/icons.svg is excluded by !**/*.svg, !**/*.svg
  • images/logo.svg is excluded by !**/*.svg, !**/*.svg
  • images/onboarding-wizard/onboarding-bg.svg is excluded by !**/*.svg, !**/*.svg
📒 Files selected for processing (34)
  • classes/controllers/FrmHooksController.php (1 hunks)
  • classes/controllers/FrmOnboardingWizardController.php (3 hunks)
  • classes/helpers/FrmOnboardingWizardHelper.php (3 hunks)
  • classes/views/onboarding-wizard/footer.php (1 hunks)
  • classes/views/onboarding-wizard/index.php (1 hunks)
  • classes/views/onboarding-wizard/steps/consent-tracking-step.php (1 hunks)
  • classes/views/onboarding-wizard/steps/default-email-address-step.php (0 hunks)
  • classes/views/onboarding-wizard/steps/install-addons-step.php (4 hunks)
  • classes/views/onboarding-wizard/steps/install-formidable-pro-step.php (0 hunks)
  • classes/views/onboarding-wizard/steps/license-management-step.php (0 hunks)
  • classes/views/onboarding-wizard/steps/success-step.php (2 hunks)
  • classes/views/onboarding-wizard/steps/unsuccessful-step.php (1 hunks)
  • classes/views/onboarding-wizard/steps/welcome-step.php (0 hunks)
  • css/admin/onboarding-wizard.css (3 hunks)
  • css/frm_admin.css (12 hunks)
  • js/onboarding-wizard.js (1 hunks)
  • js/src/onboarding-wizard/dataUtils/setupUsageData.js (1 hunks)
  • js/src/onboarding-wizard/elements/elements.js (1 hunks)
  • js/src/onboarding-wizard/events/backButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/events/checkProInstallationButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/events/consentTrackingButtonListener.js (1 hunks)
  • js/src/onboarding-wizard/events/index.js (2 hunks)
  • js/src/onboarding-wizard/events/saveLicenseButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/events/setupEmailStepButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/events/skipProInstallationButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/events/skipStepButtonListener.js (0 hunks)
  • js/src/onboarding-wizard/index.js (0 hunks)
  • js/src/onboarding-wizard/shared/constants.js (1 hunks)
  • js/src/onboarding-wizard/shared/pageState.js (0 hunks)
  • js/src/onboarding-wizard/ui/index.js (1 hunks)
  • js/src/onboarding-wizard/ui/rootline.js (1 hunks)
  • js/src/onboarding-wizard/ui/setupInitialView.js (4 hunks)
  • js/src/onboarding-wizard/ui/showError.js (0 hunks)
  • js/src/onboarding-wizard/utils/navigateToStep.js (3 hunks)
💤 Files with no reviewable changes (13)
  • classes/views/onboarding-wizard/steps/default-email-address-step.php
  • classes/views/onboarding-wizard/steps/install-formidable-pro-step.php
  • classes/views/onboarding-wizard/steps/license-management-step.php
  • classes/views/onboarding-wizard/steps/welcome-step.php
  • js/src/onboarding-wizard/events/backButtonListener.js
  • js/src/onboarding-wizard/events/checkProInstallationButtonListener.js
  • js/src/onboarding-wizard/events/saveLicenseButtonListener.js
  • js/src/onboarding-wizard/events/setupEmailStepButtonListener.js
  • js/src/onboarding-wizard/events/skipProInstallationButtonListener.js
  • js/src/onboarding-wizard/events/skipStepButtonListener.js
  • js/src/onboarding-wizard/index.js
  • js/src/onboarding-wizard/shared/pageState.js
  • js/src/onboarding-wizard/ui/showError.js
🧰 Additional context used
🪛 Biome
js/onboarding-wizard.js

[error] 2-2: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

🔇 Additional comments (53)
js/src/onboarding-wizard/ui/index.js (1)

1-2: Verify the impact of export changes on the onboarding process

The changes in this file align with the PR objective of improving the onboarding process. The removal of the showError export and the addition of the rootline export suggest a shift in focus from error handling to guiding users through the onboarding steps.

However, we should ensure that the removal of the showError export doesn't negatively impact error handling in other parts of the application that might have been using it.

Let's verify that the showError functionality is not needed elsewhere in the codebase:

If these searches return results, we may need to update those files to handle errors differently or import error handling from a new location.

js/src/onboarding-wizard/shared/constants.js (2)

8-9: Approve changes to STEPS object and verify new UNSUCCESSFUL step implementation.

The changes to the STEPS object, including the addition of the UNSUCCESSFUL step, appear to improve the onboarding process by accounting for both successful and unsuccessful scenarios. This aligns well with the PR objective of enhancing the onboarding experience.

To ensure proper implementation of the new UNSUCCESSFUL step, please run the following script:

#!/bin/bash
# Description: Verify the implementation of the new UNSUCCESSFUL step

# Test 1: Search for usage of the new UNSUCCESSFUL step
echo "Searching for UNSUCCESSFUL step usage:"
rg --type js 'STEPS\.UNSUCCESSFUL'

# Test 2: Search for any error handling or unsuccessful scenario logic
echo "Searching for error handling related to unsuccessful onboarding:"
rg --type js -i 'onboarding.*(?:error|fail|unsuccessful)'

Ensure that the UNSUCCESSFUL step is properly handled in the onboarding flow, including appropriate error messages or recovery options for users.


1-1: Verify the impact of removed constants on the codebase.

The constants proIsIncluded and WELCOME_STEP_ID have been removed. While this aligns with improving the onboarding process, we should ensure that these removals don't cause issues elsewhere in the codebase.

Run the following script to check for any remaining usage of the removed constants:

If any matches are found, please update those occurrences to align with the new onboarding flow.

✅ Verification successful

Removed constants proIsIncluded and WELCOME_STEP_ID are no longer used in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of removed constants in the codebase

# Test 1: Search for proIsIncluded usage
echo "Searching for proIsIncluded usage:"
rg --type js 'proIsIncluded'

# Test 2: Search for WELCOME_STEP_ID usage
echo "Searching for WELCOME_STEP_ID usage:"
rg --type js 'WELCOME_STEP_ID'

Length of output: 27953

js/src/onboarding-wizard/events/consentTrackingButtonListener.js (2)

1-10: LGTM: Imports are well-organized and appropriate.

The imports are clearly separated into external and internal dependencies, which is a good practice. The imported functions seem relevant to the file's purpose.


35-35: LGTM: Clear and appropriate default export.

The default export of addConsentTrackingButtonEvents is appropriate for this module, as it's the main function that sets up the event handling.

classes/views/onboarding-wizard/footer.php (4)

14-14: Improved back button styling

The addition of the frm_large class to the back button is a good improvement. This change likely makes the button more prominent and easier to interact with, enhancing the overall user experience of the onboarding wizard.


24-26: Enhanced security for primary button text

Good job on using esc_html() to output the primary button text. This change improves security by preventing potential XSS attacks, ensuring that any HTML in the button text is properly escaped before being rendered.


27-30: New icon option for primary button

The addition of an optional icon to the primary button is a nice touch that can enhance visual cues for users. The implementation looks good, using a conditional block and the FrmAppHelper::icon_by_class() method for consistency.

A few points to consider:

  1. The icon uses several CSS classes for styling, including rotation and positioning.
  2. The aria-hidden attribute is correctly set for accessibility.

To ensure the icon displays correctly and enhances the user experience as intended, please verify the visual appearance of the button with the icon enabled. Consider checking the alignment and spacing between the text and the icon across different screen sizes.


14-30: Overall improvements to the Onboarding Wizard footer

The changes made to the Onboarding Wizard footer align well with the PR objectives of improving the onboarding process. Here's a summary of the improvements:

  1. Enhanced back button styling for better visibility.
  2. Improved security for the primary button text rendering.
  3. Added flexibility with an optional icon for the primary button.

These changes contribute to a better user experience and maintain good coding practices. The modifications are consistent with the goal of enhancing the Formidable Forms plugin's onboarding process.

Great job on these improvements! They should positively impact the user's onboarding experience.

js/src/onboarding-wizard/events/index.js (2)

26-26: Approve changes, but verify impact on onboarding flow.

The addition of addConsentTrackingButtonEvents() aligns with modern data protection practices and the PR's goal to improve the onboarding process. However, the removal of several other event listeners (setup email, license management, pro installation) represents a significant change in the onboarding flow.

Please confirm that the removal of these event listeners doesn't negatively impact the user experience. Let's verify the changes in the onboarding steps:

#!/bin/bash
# Description: Verify changes in onboarding steps and related components

# Test 1: Check for references to removed steps in other files
echo "Checking for references to removed steps:"
rg -i "setup.*email|license.*management|pro.*installation" --type js

# Test 2: Verify the implementation of consent tracking
echo "Checking consent tracking implementation:"
rg -i "consent.*tracking" --type js

# Test 3: Look for any TODO comments related to these changes
echo "Checking for related TODO comments:"
rg -i "TODO.*onboarding" --type js

12-12: LGTM! Verify the new consent tracking file.

The addition of the addConsentTrackingButtonEvents import aligns with the PR objective to improve the onboarding process. The import follows the existing pattern for button event listeners.

Let's verify the existence and content of the new file:

✅ Verification successful

LGTM! The consent tracking functionality has been successfully added and verified.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and content of the consentTrackingButtonListener file

# Test 1: Check if the file exists
fd consentTrackingButtonListener.js

# Test 2: If the file exists, display its content
fd consentTrackingButtonListener.js -x cat

Length of output: 29173


Script:

#!/bin/bash
# Description: Verify the existence and content of consentTrackingButtonListener.js

# Test 1: Check if the specific file exists
fd 'consentTrackingButtonListener.js'

# Test 2: If the file exists, display its content
fd 'consentTrackingButtonListener.js' -x cat

Length of output: 1075

classes/views/onboarding-wizard/index.php (3)

12-12: LGTM: Updated initial step in onboarding process

The change from "welcome" to "consent-tracking" as the initial step aligns with the new onboarding structure and appears to be an intentional improvement to the process.


33-33: LGTM: Improved clarity in exit link text

The change from "Go to dashboard" to "Exit Onboarding" provides a clearer description of the link's action. This improvement enhances user understanding and aligns well with the overall focus on refining the onboarding process.


Line range hint 1-42: Overall: Improved onboarding wizard structure and clarity

The changes to this file effectively enhance the onboarding process by:

  1. Updating the initial step to focus on consent tracking.
  2. Adding a clear visual rootline of the onboarding steps.
  3. Improving the clarity of the exit link.

These modifications align well with the PR objectives of improving the onboarding experience. The code is well-structured and consistent. Consider the minor suggestion for improving accessibility in the rootline items.

js/src/onboarding-wizard/ui/rootline.js (2)

1-12: LGTM: Imports and constant definition are appropriate.

The imports and constant definition are well-structured and relevant to the file's purpose. The use of both external and internal dependencies is clear and the constant COMPLETED_STEP_CLASS is defined with an intuitive name.


23-34: Clarify the handling of the 'unsuccessful' step.

The current implementation sets the currentStep to STEPS.SUCCESS when it's STEPS.UNSUCCESSFUL. This seems counterintuitive and might lead to confusion. Could you please explain the reasoning behind this decision?

If this is intentional, consider adding a comment explaining why an unsuccessful step is treated as a success step in this context.

classes/views/onboarding-wizard/steps/success-step.php (2)

14-14: LGTM: Logo update enhances visual appeal and maintains accessibility.

The replacement of the circular icon with an SVG logo is a positive change. SVG format ensures scalability across different screen sizes and resolutions. The alt text is properly set, maintaining accessibility, and the URL is correctly escaped for security.


29-29: Approved: Button text updates with a note on escaping.

The button text changes are appropriate and align well with their respective actions. The change from esc_html__ to __ is generally acceptable in this context, as button text is typically not directly output and thus doesn't require HTML escaping.

However, let's verify how these button texts are used to ensure the removal of escaping doesn't introduce any security issues:

If the results show that the texts are passed directly to HTML output without escaping, consider reverting to esc_html__ for added security.

Also applies to: 32-32

✅ Verification successful

Verified: Button text updates maintain proper escaping.

The __( 'Go to Dashboard', 'formidable' ) function in success-step.php is appropriately handled by FrmOnboardingWizardHelper::print_footer, which applies esc_html__. This ensures that button texts remain securely escaped.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how the button texts are used in the codebase

# Search for uses of FrmOnboardingWizardHelper::print_footer
rg --type php -A 10 "FrmOnboardingWizardHelper::print_footer" | grep -E "primary-button-text|secondary-button-text"

Length of output: 1038


Script:

#!/bin/bash
# Description: Inspect how FrmOnboardingWizardHelper::print_footer handles and outputs button texts to ensure proper escaping

# Search for the definition of the print_footer method
ast-grep --lang php --pattern $'class FrmOnboardingWizardHelper {
  $$$
  function print_footer($_$) {
    $$$
  }
  $$$
}' 

# Additionally, check how the button texts are used within the print_footer method
rg --type php "function print_footer" -A 20 classes/helpers/FrmOnboardingWizardHelper.php | grep -E "echo|print|esc_html"

Length of output: 453

classes/views/onboarding-wizard/steps/unsuccessful-step.php (2)

1-10: LGTM: Proper file header and security check.

The file header provides clear information about the purpose of the file, and the security check prevents direct access to the file, which is a good security practice.


1-39: LGTM: Well-structured and complete implementation of the unsuccessful step.

The file is well-organized and contains all necessary elements for displaying the unsuccessful step in the onboarding process. It follows a logical flow: security check, HTML structure, content, and footer. This implementation aligns well with the PR objectives of improving the onboarding process.

js/src/onboarding-wizard/dataUtils/setupUsageData.js (2)

Line range hint 1-62: Overall improvements to onboarding process tracking

The changes in this file enhance the onboarding process by:

  1. Improving the handling of both successful and unsuccessful completions.
  2. Streamlining data processing by removing email-related functionality.

These modifications align with the PR objective of improving the onboarding experience. However, please ensure that:

  1. The removal of email-related functionality is intentional and doesn't negatively impact user communication or data collection for other parts of the system.
  2. The changes align with any analytics or reporting systems that may have depended on the previous data structure.

Consider documenting these changes in the project's technical documentation to ensure that other team members are aware of the new onboarding data structure and processing logic.

To verify the alignment with project objectives, please run the following script:

This script will help ensure that the changes are consistent with the project's goals and that no unintended side effects are introduced.


Line range hint 1-35: Verify the impact of processDataForStep changes on setupUsageData

While there are no direct changes to setupUsageData, the modifications in processDataForStep affect its behavior. Ensure that:

  1. The function correctly handles both successful and unsuccessful onboarding completions.
  2. The removal of email-related data processing doesn't negatively impact any dependent systems or analytics.

To verify these changes, run the following script:

This script will help ensure that the changes are consistent across the onboarding process and that no email-related functionality was unintentionally left behind.

✅ Verification successful

Verification Complete: setupUsageData Functionality is Correct

The shell script results confirm that:

  • No email-related code exists in the onboarding process.
  • The setupUsageData function properly handles both SUCCESS and UNSUCCESSFUL onboarding steps.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any references to email processing in the onboarding process

# Test 1: Search for email-related functions or variables in the onboarding files
echo "Searching for email-related code in onboarding files:"
rg --type js -i '(email|mail)' js/src/onboarding-wizard

# Test 2: Check for any remaining usage of email data in the setupUsageData function
echo "Checking for email data usage in setupUsageData:"
ast-grep --lang javascript --pattern $'function setupUsageData($_) {
  $$$
  email
  $$$
}'

# Test 3: Verify that both SUCCESS and UNSUCCESSFUL steps are handled
echo "Verifying handling of SUCCESS and UNSUCCESSFUL steps:"
ast-grep --lang javascript --pattern $'if ( STEPS.SUCCESS === $_ || STEPS.UNSUCCESSFUL === $_ ) {
  $$$
}'

Length of output: 1740

js/src/onboarding-wizard/utils/navigateToStep.js (1)

13-13: LGTM: New import for updateRootline

The addition of the updateRootline import is consistent with the changes made in the navigateToStep function. This named import follows good module-based JavaScript practices.

css/admin/onboarding-wizard.css (5)

18-18: LGTM: Good use of CSS variable for background color

Using a CSS variable for the background color is a good practice. It enhances maintainability and consistency across the stylesheet.


29-29: LGTM: Consistent use of CSS variable for padding

The use of a CSS variable for padding is consistent with the earlier changes and follows best practices for maintainable CSS.


37-37: Verify the reduced top margin

The top margin for #frm-onboarding-return-dashboard has been reduced from var(--gap-xl) to var(--gap-lg). Please confirm that this change is intentional and doesn't negatively impact the layout or spacing in the onboarding wizard.


48-51: LGTM: Consistent logo sizing

The addition of specific dimensions for .frm-onboarding-logo ensures consistent logo presentation throughout the onboarding wizard. This is a good practice for maintaining visual coherence.


152-152: LGTM: Proper file ending

Adding an empty line at the end of the file follows best practices and can prevent issues with certain tools and version control systems.

classes/views/onboarding-wizard/steps/install-addons-step.php (2)

Line range hint 46-55: LGTM! Class order change noted.

The modification in the class order for the banner title span is acceptable. The content remains properly escaped and internationalized.


Line range hint 1-98: Overall, good improvements to the onboarding wizard.

The changes in this file enhance the user interface and provide clearer guidance for both new and Pro users of Formidable Forms. The addition of the Formidable logo and the new footer section for Pro users are particularly noteworthy improvements. The code generally follows good practices for escaping and internationalization.

A few minor suggestions have been made to further improve accessibility and security:

  1. Adding width and height attributes to the logo image.
  2. Adding an aria-label to the external link icon.
  3. Using esc_html__() instead of __() for the button text.

These small changes will help to create a more robust and accessible onboarding experience.

classes/helpers/FrmOnboardingWizardHelper.php (3)

Line range hint 1-138: Summary of changes to FrmOnboardingWizardHelper

The changes made to this file are focused on improving the onboarding wizard's functionality and appearance, which aligns with the PR objectives. Key modifications include:

  1. Changing the default behavior for displaying the back button.
  2. Adding a new argument for primary button icon support (currently unused).
  3. Updating CSS classes for both primary and secondary buttons.

While these changes seem to enhance the onboarding process, it's crucial to thoroughly test the wizard to ensure these modifications don't introduce any unintended side effects or break existing functionality. Pay special attention to the navigation flow and button styling across different steps of the wizard.


110-110: Verify new button classes 'frm-sharp frm_large'

The classes 'frm-sharp frm_large' have been added to both primary and secondary buttons. While this likely improves consistency in button styling across the onboarding wizard, it's important to ensure these classes exist in your CSS and provide the intended styling.

To verify the existence and usage of these classes, you can run the following script:

#!/bin/bash
# Search for 'frm-sharp' and 'frm_large' in CSS files
echo "Searching for 'frm-sharp' in CSS files:"
rg --type css "frm-sharp"
echo "\nSearching for 'frm_large' in CSS files:"
rg --type css "frm_large"

This will help confirm that these classes are defined and used as intended in your stylesheets.

Also applies to: 125-125


90-90: Verify the impact of changing 'display-back-button' default to false

The default value for 'display-back-button' has been changed from true to false. This might affect the navigation flow in the onboarding wizard. Please ensure this change is intentional and doesn't break existing functionality or user experience.

To verify the impact, you can run the following script:

This will help identify any potential issues with existing calls to print_footer that might be affected by this change.

classes/controllers/FrmHooksController.php (1)

221-221: LGTM! Verify related changes in FrmOnboardingWizardController.

The change from frm_onboarding_setup_email_step to frm_onboarding_consent_tracking aligns with the PR objectives to improve the onboarding process. This modification suggests a shift towards user privacy and GDPR compliance, which is a positive improvement.

Please ensure that the corresponding ajax_consent_tracking method has been implemented in the FrmOnboardingWizardController class. You can verify this with the following script:

✅ Verification successful

Verified: The ajax_consent_tracking method is implemented in FrmOnboardingWizardController, ensuring the change is properly integrated.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the implementation of ajax_consent_tracking method

# Search for the ajax_consent_tracking method in FrmOnboardingWizardController
rg --type php "function ajax_consent_tracking" -g "*FrmOnboardingWizardController*"

Length of output: 189

js/src/onboarding-wizard/elements/elements.js (5)

9-9: Import statement added correctly

The import of PREFIX from '../shared' ensures that the prefix is consistently used throughout the file.


16-18: Element selectors are appropriately defined

The elements steps, skipStepButtons, and backButtons are correctly selected using querySelectorAll with the appropriate class selectors.


20-21: New buttons are correctly initialized

The consentTrackingButton and installAddonsButton elements are properly retrieved using their respective IDs with the PREFIX.


23-23: Hidden license key input is correctly referenced

The hiddenLicenseKeyInput is correctly selected using its ID 'frm-license-key', which appears to be a legacy or globally recognized identifier.


15-15: Verify the usage of 'rootline'

The element rootline is being selected with document.getElementById( ${PREFIX}-rootline ). The term 'rootline' is uncommon; please confirm that this is the intended ID and not a typo.

To check where and how 'rootline' is used in the codebase, you can run:

✅ Verification successful

Verification of 'rootline' Usage Confirmed

The usage of rootline has been confirmed to be intentional and correctly implemented. No typos or inconsistencies were found regarding the selection and usage of the rootline element.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for all occurrences of 'rootline' to verify its usage.

# Test: Recursively search for 'rootline' in JavaScript files.
rg 'rootline' --type js --type jsx -A 2 -B 2

Length of output: 72


Script:

#!/bin/bash
# Description: Search for all occurrences of 'rootline' to verify its usage.

# Test: Recursively search for 'rootline' in JavaScript and JSX files.
rg 'rootline' --type javascript --type javascriptreact -A 2 -B 2

Length of output: 99


Script:

#!/bin/bash
# Description: Search for all occurrences of 'rootline' to verify its usage.

# Test: Recursively search for 'rootline' in .js and .jsx files using glob patterns.
rg 'rootline' --glob "*.js" --glob "*.jsx" -A 2 -B 2

Length of output: 29112

js/src/onboarding-wizard/ui/setupInitialView.js (3)

10-10: LGTM!

Importing STEPS from '../shared' is essential for step navigation throughout the onboarding process.


58-58: LGTM!

Defaulting to STEPS.INITIAL when no step query parameter is present ensures the onboarding starts correctly.


79-81: LGTM!

Fading in the container enhances the user experience by providing a smooth visual transition.

classes/views/onboarding-wizard/steps/consent-tracking-step.php (1)

56-56: Verify escaping of translated strings in tooltips

In lines 56, 76, and 107, the __() function is used to retrieve translated strings passed to FrmAppHelper::tooltip_icon(). Please ensure that tooltip_icon() properly escapes the content when outputting to prevent potential security issues. If it doesn't handle escaping, consider using esc_html__() to escape the strings before passing them to the function.

Also applies to: 76-76, 107-107

classes/controllers/FrmOnboardingWizardController.php (4)

82-82: Update INITIAL_STEP constant to 'consent-tracking'

The INITIAL_STEP constant has been correctly updated to 'consent-tracking', aligning with the new initial step in the onboarding process.


282-285: Add new steps to the $step_parts array

The addition of 'consent-tracking' and 'unsuccessful' steps to the $step_parts array ensures that these steps are included in the onboarding wizard sequence.


396-396: Include INITIAL_STEP in JavaScript variables

Adding 'INITIAL_STEP' to the JavaScript variables allows the frontend script to access the initial step value, ensuring consistency between PHP and JavaScript.


305-306: Confirm the use of 'rest_sanitize_boolean'

The update_setting method is updating the 'tracking' setting with true, using 'rest_sanitize_boolean' for sanitization. Ensure that 'rest_sanitize_boolean' is the appropriate callback for sanitizing this setting in your context.

Run the following script to check if 'rest_sanitize_boolean' is a valid callable function:

css/frm_admin.css (6)

1905-1907: Gap property defined correctly for .frm-gap-2xs.

The .frm-gap-2xs class appropriately sets the gap to var(--gap-2xs), which enhances layout spacing.


1974-1976: Transformation applied correctly in .frm-rotate-90.

The .frm-rotate-90 class correctly uses transform: rotate(90deg); to rotate elements by 90 degrees.


1978-1980: Cursor style set appropriately in .frm-cursor-pointer.

The cursor: pointer; property is correctly applied, indicating clickable elements.


2469-2474: .frm-card-box styles are implemented correctly.

The class defines a card component with appropriate max-width, background, border-radius, padding, and border, enhancing the UI consistency.


7785-7788: SVG icon dimensions set correctly in .frmsvg.frm_svg9.

The class appropriately sets the width and height to 9px, ensuring consistent icon sizing.


9486-9496: Styles for .frm-cta-footer are correctly defined.

The .frm-cta.frm-cta-border .frm-cta-footer class has proper styling for background, padding, borders, border-radius, and margins, which should render the footer as intended.

Comment thread js/src/onboarding-wizard/events/consentTrackingButtonListener.js
Comment thread js/src/onboarding-wizard/ui/rootline.js
Comment thread js/src/onboarding-wizard/ui/rootline.js
Comment thread classes/views/onboarding-wizard/steps/install-addons-step.php
Comment thread classes/helpers/FrmOnboardingWizardHelper.php
Comment thread css/frm_admin.css
Comment thread css/frm_admin.css
Comment thread css/frm_admin.css
Comment thread css/frm_admin.css
Comment thread css/frm_admin.css Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0fb2f1a and 80f621f.

📒 Files selected for processing (1)
  • css/frm_admin.css (12 hunks)
🧰 Additional context used
🔇 Additional comments (7)
css/frm_admin.css (7)

1615-1618: LGTM: Color utility classes added.

These new utility classes for text colors are a good addition. They provide flexibility for styling text in different shades of grey.


1694-1696: LGTM: New margin utility class added.

The addition of this margin utility class enhances the flexibility of the styling system.


1698-1700: LGTM: Additional margin utility class added.

This new margin utility class further expands the options for fine-tuning layouts.


1766-1769: LGTM: New padding utility class added.

The addition of this padding utility class provides more options for controlling element spacing.


7785-7789: LGTM: New SVG size class added.

This new class for 9x9 SVG icons adds to the existing set of icon size options, maintaining consistency in the styling system.


Line range hint 1-9789: Overall assessment: Good additions with minor suggestions for improvement.

The changes in this file primarily involve the addition of new utility classes for margins, padding, text colors, and SVG sizes. These additions enhance the flexibility and maintainability of the styling system.

Two instances of !important usage were flagged for reconsideration to improve long-term maintainability.

Consider implementing the suggested changes to avoid potential specificity issues in the future.


1319-1322: 🛠️ Refactor suggestion

Consider removing !important from border-radius declaration.

The use of !important here may make it difficult to override this style if needed in the future. Consider if this level of specificity is necessary, or if the same effect can be achieved through more specific selectors.

 .frm-button-primary.frm-sharp,
 .frm-button-secondary.frm-sharp {
-	border-radius: 12px !important;
+	border-radius: 12px;
 }

Likely invalid or redundant comment.

Comment thread css/frm_admin.css
Comment thread js/src/onboarding-wizard/ui/rootline.js Outdated
Comment thread classes/views/onboarding-wizard/footer.php Outdated
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

I haven't looked much into the actual changes to onboarding yet, but the code looks good.

I left some pretty minor comments.

I'll test this out soon. Thanks Sherv!

Comment thread classes/controllers/FrmOnboardingWizardController.php
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (21)
css/frm_admin.css (20)

Line range hint 9-24: Consider grouping related variables together.

The CSS variables are well-defined, but they could be organized better. Consider grouping related variables (e.g., all color variables, all size variables) for improved readability and maintenance.


Line range hint 95-130: Consider using more specific selectors for better performance.

Some selectors like .frm_wrap p are quite broad and might affect more elements than intended. Consider using more specific selectors to avoid unintended style applications and potential performance issues.


Line range hint 188-230: Consider using flexbox or grid for improved layout control.

For some layout components, like .frm_form_settings, consider using modern CSS layout techniques such as flexbox or grid. This can simplify the CSS and provide more flexible layouts.


Line range hint 282-350: Consider refactoring repeated styles.

There are some repeated styles for different button types. Consider creating a base button class and then extending it for different variations to reduce code duplication.


Line range hint 402-450: Consider using CSS grid for improved layout control.

For complex layouts like .frm_grid_container, consider using CSS grid instead of floats. This can simplify the CSS and provide more flexible layouts.


Line range hint 502-550: Consider using CSS custom properties for transitions.

For transitions, consider using CSS custom properties to define the duration and timing function. This would allow for easier global changes to animation styles.


Line range hint 602-650: Consider using more semantic class names.

Some class names like .frm_no_margin are not very semantic. Consider using more descriptive names that indicate the purpose rather than the style.


Line range hint 702-750: Consider using CSS grid for form builder layout.

For the form builder layout, consider using CSS grid instead of absolute positioning. This can provide a more flexible and maintainable layout system.


Line range hint 802-850: Consider using CSS custom properties for z-index values.

To manage z-index more effectively, consider using CSS custom properties to define a z-index scale. This can help prevent z-index conflicts and make it easier to maintain proper layering.


Line range hint 902-950: Consider using CSS grid for card layouts.

For card layouts, consider using CSS grid instead of flexbox. This can provide more control over both row and column layouts.


Line range hint 1002-1050: Consider using CSS custom properties for box shadows.

To maintain consistency in box shadows, consider using CSS custom properties to define a set of standard shadow styles.


Line range hint 1102-1150: Consider using CSS grid for form layout.

For form layouts, especially multi-column forms, consider using CSS grid. This can provide more flexible and responsive layouts.


Line range hint 1202-1250: Consider using CSS custom properties for transition durations.

To maintain consistency in animations, consider using CSS custom properties to define standard transition durations.


Line range hint 1302-1350: Consider using CSS grid for complex layouts.

For complex layouts like .frm_grid_container, consider using CSS grid instead of floats or flexbox. This can provide more control over both rows and columns.


Line range hint 1402-1450: Consider using CSS custom properties for color variations.

To maintain consistency in color variations (like hover states), consider using CSS custom properties and HSL color values. This can make it easier to create and maintain a consistent color scheme.


Line range hint 1502-1550: Consider using CSS grid for form field layouts.

For form field layouts, especially multi-column layouts, consider using CSS grid. This can provide more flexible and responsive layouts.


Line range hint 1602-1650: Consider using CSS custom properties for font sizes.

To maintain consistency in typography, consider using CSS custom properties to define a typographic scale.


Line range hint 1702-1750: Consider using CSS grid for complex table layouts.

For complex table layouts, especially responsive tables, consider using CSS grid. This can provide more flexible and responsive layouts.


Line range hint 1802-1850: Consider using CSS custom properties for spacing values.

To maintain consistency in layout spacing, consider using CSS custom properties to define a spacing scale.


Line range hint 1902-1950: Consider using CSS grid for form field option layouts.

For form field option layouts, especially multi-column layouts, consider using CSS grid. This can provide more flexible and responsive layouts.

classes/controllers/FrmOnboardingWizardController.php (1)

Line range hint 444-444: Update the @deprecated annotation with the correct version

The docblock for is_onboarding_wizard_displayed() has an incomplete @deprecated x.x annotation. Please provide the appropriate version number when the method was deprecated.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 80f621f and 0b301cb.

📒 Files selected for processing (4)
  • classes/controllers/FrmOnboardingWizardController.php (3 hunks)
  • classes/views/onboarding-wizard/footer.php (1 hunks)
  • css/frm_admin.css (12 hunks)
  • js/src/onboarding-wizard/ui/rootline.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • classes/views/onboarding-wizard/footer.php
  • js/src/onboarding-wizard/ui/rootline.js
🧰 Additional context used
🔇 Additional comments (25)
css/frm_admin.css (22)

Line range hint 1-7: CSS variables are well-implemented for consistent theming.

The use of CSS variables (custom properties) for colors, sizes, and spacing is a good practice. It allows for easy theme customization and maintains consistency throughout the stylesheet.


Line range hint 26-46: Font loading and styling is well-implemented.

The use of @font-face for loading the Inter font and the fallback font stack is good. The -webkit-font-smoothing property for Safari is a nice touch for improved text rendering.


Line range hint 48-93: Good use of utility classes for spacing and typography.

The utility classes for margins, paddings, and typography are well-defined and follow a consistent naming convention. This promotes reusability and helps maintain a consistent design system.


Line range hint 132-186: Responsive design is well-implemented.

The use of media queries for responsive design is good. The file adjusts layouts and sizes for different screen widths, ensuring a good user experience across devices.


Line range hint 232-280: Good use of CSS for form styling.

The form input styling is consistent and well-implemented. The use of :focus states improves usability.


Line range hint 352-400: Good use of SVG icons and styling.

The implementation of SVG icons and their styling is well done. The use of currentColor for icon colors allows for easy theming.


Line range hint 452-500: Good implementation of modal styles.

The modal styles are well-implemented, with good use of z-index for proper layering.


Line range hint 552-600: Good use of print styles.

The print styles are well-implemented, hiding unnecessary elements and adjusting layouts for better print output.


Line range hint 652-700: Good implementation of RTL styles.

The RTL (Right-to-Left) styles are well-implemented, ensuring proper layout for RTL languages.


Line range hint 752-800: Good use of CSS for accessibility.

The focus styles and color contrasts seem to be well-implemented, which is good for accessibility.


Line range hint 852-900: Good implementation of tooltip styles.

The tooltip styles are well-implemented, with good positioning and appearance.


Line range hint 952-1000: Good use of CSS for form validation styles.

The form validation styles are well-implemented, providing clear visual feedback for users.


Line range hint 1052-1100: Good implementation of responsive table styles.

The responsive table styles are well-implemented, ensuring good display on smaller screens.


Line range hint 1152-1200: Good use of CSS for accessibility in form elements.

The focus and hover states for form elements are well-implemented, which is good for accessibility.


Line range hint 1252-1300: Good implementation of modal overlay styles.

The modal overlay styles are well-implemented, providing a good user experience for modal dialogs.


Line range hint 1352-1400: Good use of CSS for form builder UI elements.

The styles for form builder UI elements are well-implemented, providing a good user experience for form creation.


Line range hint 1452-1500: Good implementation of responsive design for admin pages.

The responsive design for admin pages is well-implemented, ensuring a good user experience across different device sizes.


Line range hint 1552-1600: Good use of CSS for accessibility in interactive elements.

The focus and hover states for interactive elements are well-implemented, which is good for accessibility.


Line range hint 1652-1700: Good implementation of styles for form preview.

The styles for form preview are well-implemented, providing a good representation of the final form appearance.


Line range hint 1752-1800: Good use of CSS for accessibility in form elements.

The focus and hover states for form elements are well-implemented, which is good for accessibility.


Line range hint 1852-1900: Good implementation of styles for form builder UI.

The styles for the form builder UI are well-implemented, providing a good user experience for form creation.


Line range hint 1952-2000: Good use of CSS for accessibility in interactive elements.

The focus and hover states for interactive elements are well-implemented, which is good for accessibility.

classes/controllers/FrmOnboardingWizardController.php (3)

82-82: INITIAL_STEP updated to 'consent-tracking'

The INITIAL_STEP constant has been set to 'consent-tracking', aligning with the updated starting point of the onboarding process.


282-285: Added 'unsuccessful' step to the onboarding flow

Including 'unsuccessful' in the $step_parts array ensures that the wizard can handle scenarios where onboarding is not successful.


428-428: Added 'INITIAL_STEP' to JavaScript variables

Including INITIAL_STEP in the JavaScript variables ensures that the client-side code correctly initializes with the updated onboarding step.

Comment thread classes/controllers/FrmOnboardingWizardController.php
Comment thread classes/controllers/FrmOnboardingWizardController.php
@Crabcyborg Crabcyborg added this to the 6.16 milestone Oct 18, 2024
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

I think this looks good.

I also requested Laura's review so this can get some extra testing.

I'll merge it once she approves.

Thanks Sherv!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0b301cb and 4a956d3.

📒 Files selected for processing (1)
  • classes/controllers/FrmOnboardingWizardController.php (3 hunks)
🧰 Additional context used
🔇 Additional comments (6)
classes/controllers/FrmOnboardingWizardController.php (6)

Line range hint 1-701: Overall assessment of changes to FrmOnboardingWizardController

The changes to this file significantly alter the onboarding process for Formidable Forms, shifting the focus to consent tracking as the initial step and integrating ActiveCampaign subscription. Key points:

  1. The initial step has been changed to 'consent-tracking'.
  2. The onboarding steps structure has been updated accordingly.
  3. AJAX handling for consent tracking has been implemented.
  4. A new method for ActiveCampaign subscription has been added, though it needs some improvements.
  5. JavaScript variables have been simplified.
  6. An outdated method has been properly deprecated.

These changes should improve the user onboarding experience and align the process with current consent and tracking practices. However, ensure that all suggested verifications are performed to maintain code consistency and functionality across the codebase.


282-285: Updated onboarding steps structure

The $step_parts array has been revised to include the new consent-tracking step and an unsuccessful step. This change aligns with the updated INITIAL_STEP constant.

Verify the existence of the new step files with the following script:

#!/bin/bash
# Check if the new step files exist
for step in "consent-tracking-step.php" "unsuccessful-step.php"; do
  if [ -f "classes/views/onboarding-wizard/steps/$step" ]; then
    echo "$step exists"
  else
    echo "$step does not exist"
  fi
done

298-314: Updated consent tracking AJAX handler

The method has been renamed and simplified to focus on consent tracking. The addition of ActiveCampaign subscription aligns with the new consent-based approach.

To ensure the ActiveCampaign subscription is working correctly, you may want to add logging or testing. Here's a script to check for any existing logs or tests:

#!/bin/bash
# Search for ActiveCampaign related logs or tests
rg -i "activecampaign" --type php

429-431: Simplified JavaScript variables

The proIsIncluded variable has been removed from the get_js_variables method. This simplification is good, assuming the variable is no longer needed in the frontend.

To ensure this removal doesn't affect any frontend functionality, run the following script to check for any remaining references to proIsIncluded:

#!/bin/bash
# Search for any remaining references to 'proIsIncluded' in JS files
rg -i "proIsIncluded" --type js

Line range hint 695-701: Deprecated is_onboarding_wizard_displayed method

The is_onboarding_wizard_displayed method has been correctly deprecated. This change helps maintain code cleanliness by marking outdated functionality.

To ensure there are no remaining calls to this deprecated method, run the following script:

✅ Verification successful

Deprecated is_onboarding_wizard_displayed method verified

The deprecation of the is_onboarding_wizard_displayed method has been correctly implemented, and there are no remaining calls to this method in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining calls to 'is_onboarding_wizard_displayed'
rg -i "is_onboarding_wizard_displayed" --type php

Length of output: 162


82-82: Initial step changed to consent tracking

The INITIAL_STEP constant has been updated from 'welcome' to 'consent-tracking'. This change shifts the focus of the onboarding process to start with consent tracking, which may impact the user's first interaction with the wizard.

To ensure this change is consistently applied throughout the codebase, run the following script:

Comment thread classes/controllers/FrmOnboardingWizardController.php
@lauramekaj1
Copy link
Copy Markdown
Contributor

@shervElmi I tested through this and the only thing I noticed after upgrading it to PRO was this:

  1. After enabling the add-ons through the onboarding wizard and then disabling them from the add-ons page, I go through the onboarding wizard again but am unable to re-enable the add-ons. https://www.loom.com/share/9d90b1b087084d1185550c396c9c7230?sid=fb664201-f325-46e8-94a5-c50bc3398ad0

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4a956d3 and cc58bd2.

📒 Files selected for processing (1)
  • css/frm_admin.css (12 hunks)
🧰 Additional context used
🔇 Additional comments (11)
css/frm_admin.css (11)

1319-1322: Previous comment still applies regarding the use of !important.

As previously noted, the use of !important in CSS declarations can make the stylesheet harder to maintain and override. Please consider refactoring to avoid using !important, possibly by increasing selector specificity.


1419-1422: Previous comment still applies regarding the use of !important.

The !important rule is still present in these declarations, which can lead to specificity issues. Consider restructuring the CSS to eliminate the need for !important.


1694-1696: Previous comment still applies regarding the use of !important.

Using !important can cause maintenance challenges. It's recommended to use CSS specificity or adjust the CSS cascade to achieve the desired styles without !important.


1698-1700: Previous comment still applies regarding the use of !important.

Avoid overusing !important in CSS declarations to prevent specificity conflicts and improve maintainability.


1766-1769: Previous comment still applies regarding the use of !important.

Reconsider the use of !important in padding declarations. It can override the natural cascade and make the CSS harder to maintain.


1615-1617: Utility class .frm-text-grey-500 is defined correctly.

The class is consistently named and follows established conventions.


1863-1865: Definition of .frm-inline-flex is correct.

The class applies display: inline-flex; appropriately and is consistent with coding standards.


1905-1907: Utility class .frm-gap-2xs is defined appropriately.

The class correctly sets the gap property and adheres to naming conventions.


1974-1976: Definition of .frm-rotate-90 is acceptable.

The class properly applies a 90-degree rotation using transform: rotate(90deg);.


1978-1980: Utility class .frm-cursor-pointer is defined correctly.

The class sets cursor: pointer;, enhancing usability when applied to interactive elements.


9453-9455: Definition of .frm-cta-green.frm-cta-border .frm-cta-footer is acceptable.

The border color is correctly set, enhancing the visual consistency of the component.

Comment thread css/frm_admin.css
Comment thread css/frm_admin.css
Comment thread css/frm_admin.css
@shervElmi
Copy link
Copy Markdown
Contributor Author

Hi @lauramekaj1,

Thanks for the feedback, I addressed that issue. Could you confirm my solution?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (5)
classes/controllers/FrmOnboardingWizardController.php (3)

298-314: Update method docblock and consider error handling.

The changes to this method align well with the new consent-tracking step. However, there are two areas for improvement:

  1. The method's docblock still refers to the old "Never miss an important update" step and should be updated.
  2. Consider adding error handling for the ActiveCampaign subscription process.

Update the docblock to reflect the new purpose:

 /**
- * Handle AJAX request to setup the "Never miss an important update" step.
+ * Handle AJAX request for the consent tracking step and ActiveCampaign subscription.
  *
  * @since 6.9
  *
  * @return void
  */

Consider adding error handling for the ActiveCampaign subscription:

 self::subscribe_to_active_campaign();
+
+// Check if subscription was successful
+if ( ! did_action( 'frm_active_campaign_subscribed' ) ) {
+    wp_send_json_error( array( 'message' => 'Failed to subscribe to ActiveCampaign' ) );
+}

 // Send response.
 wp_send_json_success();

317-346: Improve ActiveCampaign subscription method

The new subscribe_to_active_campaign method has been added to handle user subscriptions. However, there are a few areas for improvement:

  1. The @since tag is incomplete. Please update it with the correct version number.
  2. Add error handling for the wp_remote_post request to ensure reliability.
  3. Consider using a configuration constant for the subscription URL to easily switch between sandbox and production environments.

Here's a suggested improvement for the method:

 /**
  * When the user consents to receiving news of updates, subscribe their email to ActiveCampaign.
  *
- * @since x.x
+ * @since 6.9
  *
  * @return void
  */
 private static function subscribe_to_active_campaign() {
     $user = wp_get_current_user();
     if ( empty( $user->user_email ) ) {
         return;
     }

-    wp_remote_post(
+    $response = wp_remote_post(
         'https://sandbox.formidableforms.com/api/wp-admin/admin-ajax.php?action=frm_forms_preview&form=subscribe-onboarding',
         array(
             'body' => http_build_query(
                 array(
                     'form_key'      => 'subscribe-onboarding',
                     'frm_action'    => 'create',
                     'form_id'       => 5,
                     'item_key'      => '',
                     'item_meta[0]'  => '',
                     'item_meta[15]' => $user->user_email,
                     'item_meta[17]' => 'Source - FF Lite Plugin Onboarding',
                 )
             ),
         )
     );
+    if ( is_wp_error( $response ) ) {
+        error_log( 'ActiveCampaign subscription failed: ' . $response->get_error_message() );
+    } elseif ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
+        error_log( 'ActiveCampaign subscription failed with status code: ' . wp_remote_retrieve_response_code( $response ) );
+    }
 }

Consider defining a constant for the subscription URL:

const ACTIVE_CAMPAIGN_SUBSCRIPTION_URL = 'https://sandbox.formidableforms.com/api/wp-admin/admin-ajax.php?action=frm_forms_preview&form=subscribe-onboarding';

Then use this constant in the subscribe_to_active_campaign method. This will make it easier to switch between sandbox and production environments.


Line range hint 1-731: Overall improvements to the Onboarding Wizard

The changes made to the FrmOnboardingWizardController class significantly enhance the onboarding process for Formidable Forms. Key improvements include:

  1. Introduction of a consent tracking step, improving user privacy management.
  2. Integration with ActiveCampaign for user subscriptions.
  3. More comprehensive and flexible add-on management, including handling of Pro-specific add-ons and integration with third-party plugins like Gravity Forms.
  4. Deprecation of outdated methods, suggesting ongoing refactoring efforts.

These changes should result in a more streamlined, user-friendly, and feature-rich onboarding experience. However, thorough testing is recommended to ensure all new features and integrations work as expected across different scenarios (e.g., with/without Pro, with/without specific plugins).

Consider implementing a comprehensive test suite for the onboarding process to ensure reliability across various user scenarios and plugin configurations. This could include unit tests for individual methods and integration tests for the entire onboarding flow.

classes/models/FrmInstallPlugin.php (2)

88-120: Ensure proper error handling during plugin installation

The installation process lacks handling for scenarios where the plugin download URL might not be available or the plugin package could be corrupted. Consider adding checks to handle these exceptions gracefully.


156-167: Update the docblock with the correct version

In the docblock for is_plugin_installed(), the @since tag has a placeholder x.x. This should be updated to reflect the actual version number in which this method is introduced.

Apply this diff to update the docblock:

- * @since x.x
+ * @since 6.9
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between cc58bd2 and 119f3f0.

📒 Files selected for processing (5)
  • classes/controllers/FrmOnboardingWizardController.php (6 hunks)
  • classes/helpers/FrmOnboardingWizardHelper.php (4 hunks)
  • classes/models/FrmInstallPlugin.php (2 hunks)
  • js/onboarding-wizard.js (1 hunks)
  • js/src/onboarding-wizard/events/installAddonsButtonListener.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/helpers/FrmOnboardingWizardHelper.php
🧰 Additional context used
🪛 Biome
js/onboarding-wizard.js

[error] 2-2: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

🔇 Additional comments (9)
classes/controllers/FrmOnboardingWizardController.php (6)

Line range hint 726-731: LGTM. Update references to deprecated method.

The deprecation of the is_onboarding_wizard_displayed method is approved. This change likely reflects updates in how the onboarding wizard's state is managed.

Please ensure that any code still referencing this deprecated method is updated. Run the following script to check for any remaining references:

#!/bin/bash
# Search for any remaining references to the deprecated method
rg "is_onboarding_wizard_displayed" --type php

If any references are found, they should be updated to use the new method for determining the onboarding wizard's display status.


671-684: LGTM. Verify Gravity Forms integration.

The addition of the Gravity Forms Migrator add-on is a valuable feature for users transitioning from Gravity Forms. This change enhances the onboarding process by offering relevant migration tools.

To ensure the Gravity Forms Migrator add-on is correctly integrated, please run the following tests:

  1. Test with Gravity Forms installed and active.
  2. Test without Gravity Forms installed.

You can use the following script to check the Gravity Forms status and the availability of the migrator add-on:

#!/bin/bash
# Check if Gravity Forms is installed and active
if wp plugin is-active gravityforms; then
    echo "Gravity Forms is active"
    # Check if Gravity Forms Migrator is available in the add-ons list
    if grep -q "Gravity Forms Migrator" classes/views/onboarding-wizard/steps/install-addons-step.php; then
        echo "Gravity Forms Migrator is available in the add-ons list"
    else
        echo "Gravity Forms Migrator is not available in the add-ons list"
    fi
else
    echo "Gravity Forms is not active"
    # Check that Gravity Forms Migrator is not in the add-ons list
    if ! grep -q "Gravity Forms Migrator" classes/views/onboarding-wizard/steps/install-addons-step.php; then
        echo "Gravity Forms Migrator is correctly not available in the add-ons list"
    else
        echo "Error: Gravity Forms Migrator is in the add-ons list when Gravity Forms is not active"
    fi
fi

This script will help verify that the Gravity Forms Migrator add-on is correctly included or excluded based on the presence of Gravity Forms.


82-82: LGTM. Verify related changes for the new initial step.

The change from 'welcome' to 'consent-tracking' as the INITIAL_STEP is approved. This shift in the onboarding process could improve user privacy and preference management.

Please ensure that the 'consent-tracking' step is properly implemented and that all references to the initial step have been updated accordingly. Run the following script to check for any remaining references to the old 'welcome' step:

#!/bin/bash
# Search for any remaining references to the 'welcome' step
rg "'welcome'" --type php
rg '"welcome"' --type php
rg "INITIAL_STEP" --type php

282-285: LGTM. Verify implementation of new steps.

The updates to the $step_parts array align with the new initial step and introduce an 'unsuccessful' step. This change improves the onboarding flow and error handling.

Please ensure that the new 'consent-tracking' and 'unsuccessful' steps are properly implemented. Run the following script to check for the existence and content of these new step files:

✅ Verification successful

Verified the implementation of the new 'consent-tracking' and 'unsuccessful' steps.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for the existence and content of new step files
echo "Checking consent-tracking-step.php:"
cat classes/views/onboarding-wizard/steps/consent-tracking-step.php
echo "\nChecking unsuccessful-step.php:"
cat classes/views/onboarding-wizard/steps/unsuccessful-step.php

Length of output: 7283


Line range hint 567-670: LGTM. Comprehensive update to add-on management.

The extensive changes to the set_available_addons method significantly improve the flexibility and comprehensiveness of add-on management during the onboarding process. The new logic handles various scenarios, including Pro installation status and the presence of specific plugins like SMTP and Gravity Forms.

To ensure the new add-on management logic works as expected, please run the following tests:

  1. Test with Pro installed and not installed.
  2. Test with and without the SMTP plugin.
  3. Test with and without Gravity Forms installed.

You can use the following script to check the current plugin status:

This script will help verify that the set_available_addons method correctly identifies the installed plugins and sets up the available add-ons accordingly.


429-431: LGTM. Verify related frontend changes.

The removal of 'proIsIncluded' from the JS variables is approved. This change likely reflects updates in how the onboarding process handles pro features.

Please ensure that any frontend JavaScript code that previously relied on the 'proIsIncluded' variable has been updated accordingly. Run the following script to check for any remaining references to 'proIsIncluded' in JavaScript files:

✅ Verification successful

Apologies for the error in the previous script. Please run the following corrected script to search for any remaining references to 'proIsIncluded' in JS files:


LGTM. Change verified successfully.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to 'proIsIncluded' in JS files
rg "proIsIncluded" --type js

Length of output: 254


Script:

#!/bin/bash
# Search for any remaining references to 'proIsIncluded' in JS files
rg "proIsIncluded" --type js

Length of output: 28

js/src/onboarding-wizard/events/installAddonsButtonListener.js (1)

64-67: Docstring updated correctly for new parameters.

The updated documentation accurately reflects the addition of the isInstalled parameter, improving code clarity and maintainability.

classes/models/FrmInstallPlugin.php (1)

105-107: Confirm the download URL is secure and allowed

The check using FrmAddonsController::url_is_allowed( $api->versions['trunk'] ) is crucial for security. Ensure that this method thoroughly validates the URL to prevent any unauthorized downloads.

js/onboarding-wizard.js (1)

2-2: Previously identified issues are still present

The issues flagged in earlier reviews, such as the redundant 'use strict' directive and assignments within expressions, remain in the code. Please address these to enhance code quality.

🧰 Tools
🪛 Biome

[error] 2-2: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 2-2: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Comment thread js/src/onboarding-wizard/events/installAddonsButtonListener.js
Comment thread classes/models/FrmInstallPlugin.php
Comment thread classes/models/FrmInstallPlugin.php
Comment thread classes/models/FrmInstallPlugin.php
@lauramekaj1
Copy link
Copy Markdown
Contributor

Hi @lauramekaj1,

Thanks for the feedback, I addressed that issue. Could you confirm my solution?

Hi @shervElmi, I checked and seems that it's fixed now. Thank you!

@Crabcyborg
Copy link
Copy Markdown
Contributor

Thanks Laura!

🚀

@Crabcyborg Crabcyborg merged commit 49871a1 into master Oct 22, 2024
@Crabcyborg Crabcyborg deleted the improve-onboarding branch October 22, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants