Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance/plugin header section redesign #2461

Merged
merged 12 commits into from
Dec 10, 2024

Conversation

osmansufy
Copy link
Contributor

@osmansufy osmansufy commented Dec 2, 2024

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

- **update:** Updated Dokan admin header to display current pro plan and version with upgrading option.

Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.

Before Changes

Describe the issue before changes with screenshots(s).

After Changes

Describe the issue after changes with screenshot(s).

Feature Video (optional)

Link of detailed video if this PR is for a feature.

PR Self Review Checklist:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced styling for the admin header, improving layout and responsiveness.
    • Introduced a new SVG icon for the Dokan Pro Award.
    • Added conditional display for Lite and Pro version tags, including an upgrade button.
  • Bug Fixes

    • Restructured HTML layout for better organization of logo and version information.
  • Documentation

    • Added comments for clarity in the HTML structure.

@osmansufy osmansufy self-assigned this Dec 2, 2024
Copy link
Contributor

coderabbitai bot commented Dec 2, 2024

Walkthrough

The changes in this pull request primarily focus on enhancing the styling and structure of the admin header in the Dokan plugin. Modifications include adjustments to the CSS for the .dokan-admin-header, the introduction of new HTML elements and classes in admin-header.php, and the addition of a new SVG icon for the Dokan Pro Award. These updates improve the layout, responsiveness, and visual presentation of the admin interface.

Changes

File Change Summary
assets/src/less/admin.less Adjusted styles for .dokan-admin-header, added new classes, modified padding, margin, and introduced responsive styles.
templates/admin-header.php Restructured HTML layout, added conditional rendering for Lite/Pro versions, and organized logo and version display.
templates/svg-icons/pro-award.php Introduced a new SVG icon for the Dokan Pro Award with customizable dimensions.

Assessment against linked issues

Objective Addressed Explanation
Update Plugin Header to show Lite version and upgrade button (#[3974])
Enhance user understanding and experience through header redesign (#[3974])
Conditional rendering for Pro version and upgrade button (#[3974])

Possibly related PRs

  • Enhance : Admin Notice Show gloablly & extand API #2446: This PR enhances admin notices, which is related to the changes in admin.less that improve the styling of the admin header, including how notices may be displayed.
  • Add notice for version compatibility. #2450: This PR adds a notice for version compatibility, which aligns with the changes in the admin header that may also involve displaying important notices to users.
  • Fix commission upgrader #2463: This PR addresses the commission upgrader functionality, which may involve UI elements that are styled in admin.less, particularly if commission-related notices are displayed in the admin area.

Suggested labels

Upcoming Release

Suggested reviewers

  • shohag121
  • mrabbani

🐇 In the admin's cozy nook,
A header's charm with every look.
With styles anew and icons bright,
The Pro Award shines with delight!
A hop, a skip, the changes flow,
In Dokan's realm, our features grow! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5aac1c3 and dcccb9e.

📒 Files selected for processing (2)
  • assets/src/less/admin.less (6 hunks)
  • templates/admin-header.php (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • templates/admin-header.php
  • assets/src/less/admin.less

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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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
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: 4

🧹 Outside diff range and nitpick comments (2)
templates/admin-header.php (1)

45-56: Escape output for safety

While the href attribute is correctly escaped using esc_url, it's good practice to also escape the Upgrade text inside the anchor tag, even if it's plain text, to prevent any potential issues.

Apply this minor suggestion:

<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
-    Upgrade
+    <?php echo esc_html( 'Upgrade' ); ?>
    <?php
    dokan_get_template_part(
        'svg-icons/pro-award', null,
        [
            'width' => 20,
            'height' => 20,
        ]
    );
    ?>
</a>
assets/src/less/admin.less (1)

7-10: Consistent use of units in CSS properties

In the declaration box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.06);, the first value 0px can be simplified to 0 since zero values do not require units.

Apply this minor improvement:

-box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.06);
+box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f6b2f86 and 84ab3ba.

📒 Files selected for processing (3)
  • assets/src/less/admin.less (6 hunks)
  • templates/admin-header.php (2 hunks)
  • templates/svg-icons/pro-award.php (1 hunks)
🔇 Additional comments (1)
assets/src/less/admin.less (1)

271-293: Check for mobile responsiveness

The responsive styles added within the media query ensure the admin header adapts to smaller screens. Please verify that these changes render correctly on various mobile devices and screen sizes.

Please test the responsive layout on devices with widths up to 782px to ensure the header elements display as intended.

<div class="dokan-admin-logo-wrap">
<!-- Logo Section -->
<div class="dokan-admin-header-logo">
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Typo in constant name 'DOKAN_PLUGIN_ASSEST'

It appears that the constant DOKAN_PLUGIN_ASSEST may be misspelled. It should likely be DOKAN_PLUGIN_ASSETS to correctly reference the assets directory.

Please apply the following fix:

-<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
+<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSETS . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSETS . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>


<?php
// Show Pro version if installed
if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential method call on null object

In the condition if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ), there is a possibility that dokan_pro() may return null if the Pro plugin is not installed. This could lead to a fatal error when attempting to access the license property.

Consider updating the condition to ensure that dokan_pro() returns a valid object before accessing its properties:

-if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
+if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {

Comment on lines +8 to +9
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Initialize $args to prevent undefined variable notice

To prevent a potential undefined variable notice when $args is not provided, it's recommended to initialize $args before using it.

Apply this fix:

<?php
+$args = isset( $args ) ? $args : [];
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
?>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
<?php
$args = isset( $args ) ? $args : [];
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
?>

Comment on lines 11 to 13
<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure proper escaping of attributes

When outputting variables within HTML attributes, it's important to escape them to prevent security vulnerabilities. In the <svg> tag, the $width and $height attributes should be escaped.

Apply this fix:

-<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<svg width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>
<svg width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>

Copy link
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

🧹 Outside diff range and nitpick comments (1)
templates/admin-header.php (1)

27-37: Consider extracting SVG icons to separate files

The SVG icons are embedded directly in the HTML, which makes the template harder to maintain. Consider extracting them to separate files and including them using dokan_get_template_part().

Also applies to: 45-55

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 84ab3ba and cb84768.

📒 Files selected for processing (2)
  • templates/admin-header.php (2 hunks)
  • templates/svg-icons/pro-award.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/svg-icons/pro-award.php
🔇 Additional comments (3)
templates/admin-header.php (3)

7-7: Typo in constant name 'DOKAN_PLUGIN_ASSEST'

The constant name contains a typo: 'ASSEST' should be 'ASSETS'.


Line range hint 1-167: Overall structure looks good!

The template is well-structured with:

  • Proper HTML organization
  • Consistent class naming
  • Good use of escaping functions
  • Clear separation of concerns

22-22: 🛠️ Refactor suggestion

Improve null check in conditional statement

The current condition could be more defensive. While dokan()->is_pro_exists() is checked, accessing dokan_pro()->license could throw an error if dokan_pro() returns null.

Apply this fix:

-if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {
+if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license && dokan_pro()->license->is_valid() ) {

Likely invalid or redundant comment.

Comment on lines +43 to +46
$upgrade_url = 'https://dokan.co/wordpress/pricing/';
?>
<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve external link handling

The upgrade URL should be:

  1. Configurable rather than hardcoded
  2. Include proper security attributes for external links

Apply these changes:

-$upgrade_url = 'https://dokan.co/wordpress/pricing/';
+$upgrade_url = apply_filters( 'dokan_admin_upgrade_url', 'https://dokan.co/wordpress/pricing/' );
-<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
+<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$upgrade_url = 'https://dokan.co/wordpress/pricing/';
?>
<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade
$upgrade_url = apply_filters( 'dokan_admin_upgrade_url', 'https://dokan.co/wordpress/pricing/' );
?>
<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade

@osmansufy osmansufy requested a review from mrabbani December 2, 2024 06:52
@osmansufy osmansufy added the Needs: Dev Review It requires a developer review and approval label Dec 2, 2024
Copy link
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: 9

🧹 Outside diff range and nitpick comments (36)
assets/js/dokan.asset.php (1)

1-1: Improve code formatting for better readability

Consider formatting the array according to WordPress coding standards:

-<?php return array('dependencies' => array(), 'version' => 'b7dae50e43db9b0fe708');
+<?php
+return array(
+    'dependencies' => array(),
+    'version'      => 'b7dae50e43db9b0fe708',
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

includes/Commission/Upugrader/Update_Product_Commission.php (2)

Line range hint 57-67: Review the arbitrary addition of 50 products to total count

The addition of $total_products + 50 appears to artificially inflate the number of products to process without clear justification. This could lead to:

  • Processing of non-existent products
  • Unnecessary batch scheduling
  • Increased resource usage

Consider one of these alternatives:

-$total_products = $total_products + 50;
+// Option 1: Remove artificial inflation
+$total_products = $total_products;
+
+// Option 2: If padding is needed, document the reason
+$padding = 50; // Padding to account for new products created during processing
+$total_products = $total_products + $padding;

Line range hint 11-24: Consider enhancing batch processing robustness

The current implementation could benefit from several improvements:

  1. The batch size of 10 might be too conservative for modern systems
  2. Missing error handling for queue operations
  3. No progress tracking or logging
  4. No mechanism to retry failed items

Consider implementing these enhancements:

 class Update_Product_Commission {
+    /**
+     * @var int Number of failed items
+     */
+    private $failed_items = 0;
+
     /**
      * The batch size for processing products
      *
      * @since DOKAN_PRO_SINCE
      */
-    const BATCH_SIZE = 10;
+    const BATCH_SIZE = 50; // Increased for better performance
+
+    /**
+     * @var string The option name for storing progress
+     */
+    const PROGRESS_OPTION = 'dokan_commission_upgrade_progress';

Would you like me to provide a complete implementation with error handling and progress tracking?

assets/js/setup-no-wc-style-rtl.css (1)

Line range hint 190-307: Consider implementing CSS custom properties for the color system

While the color updates are consistent, consider using CSS custom properties (variables) for the new color palette to make future theme changes easier to maintain.

Example implementation:

+ :root {
+   --dokan-primary: #7047EB;
+   --dokan-primary-hover: #4c19e6;
+   --dokan-primary-light: #c9baf8;
+ }

  .form-table .switch-input:checked + .switch-label:before {
-   background-color: #c9baf8;
+   background-color: var(--dokan-primary-light);
  }

  .form-table .switch-input:checked + .switch-label:after {
-   background-color: #7047EB;
+   background-color: var(--dokan-primary);
  }
assets/js/vue-admin.css (3)

Line range hint 1324-1366: Simplify CSS for switch button styles.

The styles for the switch button in .change-log can be optimized for maintainability. Consider refactoring repetitive code and using more concise selectors where possible.


Line range hint 1468-1527: Maintain consistent font families and weights.

Multiple font families and weights are used in the .version-list classes. Verify that the fonts are loaded correctly and consider consolidating font definitions to improve performance.


Line range hint 4755-4789: Maintain font consistency in modal popup.

The styles for the upgrade popup use "SF Pro Text", sans-serif. Confirm that this font is consistently used across the application and that appropriate fallbacks are specified.

assets/js/vue-admin-rtl.css (1)

670-673: Ensure cross-browser compatibility for text gradient effect

The use of background-clip: text and -webkit-background-clip: text may not be fully supported in all browsers. To improve compatibility, consider including standard and vendor-prefixed properties and providing fallback styles for browsers that do not support this feature.

assets/js/dokan-setup-wizard-commission.js (2)

Line range hint 1-134: Avoid direct usage of hasOwnProperty on objects

Using hasOwnProperty directly from an object can be unsafe if the object has overridden this property. It's recommended to use Object.hasOwn() for a more reliable check.

Apply this diff to update the checks:

- if (obj.hasOwnProperty(key)) {
+ if (Object.hasOwn(obj, key)) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


Line range hint 1-134: Remove unnecessary aliasing of this

The code assigns this to another variable within arrow functions, which is unnecessary since arrow functions inherit this from their enclosing scope.

Apply this diff to remove the unnecessary aliasing:

- const self = this;
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)

includes/Order/Admin/Hooks.php (1)

Line range hint 584-602: Add error handling for database queries

In the commission_meta_box method, consider adding error handling for the database query to handle potential failures gracefully.

Apply this diff to check for query results:

$data = $wpdb->get_row(
    $wpdb->prepare( "SELECT order_total, net_amount FROM {$wpdb->prefix}dokan_orders WHERE order_id = %d LIMIT 1", $order->get_id() )
);

+ if ( null === $data ) {
+     // Handle the error accordingly
+     return;
+ }
assets/css/vue-admin.css (1)

Line range hint 654-675: Make font sizes responsive for better accessibility

The font size of 51px in the .title class may not display well on smaller screens. Consider using responsive units or media queries to ensure readability across devices.

Example using responsive units:

-.dokan-pro-features .vendor-capabilities-banner .content .title {
-  font-size: 51px;
+  font-size: 3.2vw;
}
assets/css/dokan-setup-wizard-commission.css (2)

1-53: Consider using Tailwind CSS directly instead of duplicating its reset.

The CSS custom properties and utility classes appear to be copied from Tailwind CSS. Consider using Tailwind CSS directly through its CDN or as a dependency instead of maintaining a duplicate copy.

Benefits of using Tailwind CSS directly:

  1. Automatic updates for bug fixes and improvements
  2. Reduced maintenance overhead
  3. Smaller bundle size through tree-shaking
  4. Access to the full suite of Tailwind utilities

107-133: Consider consolidating utility classes.

The utility classes are well-structured but minimal. If you're implementing a utility-first approach, consider:

  1. Using a more comprehensive set of utilities
  2. Implementing a consistent naming convention for important flags
assets/js/setup.css (1)

Line range hint 1-6: Fix incorrect file location.

The file setup.css is incorrectly placed in the assets/js directory. Additionally, the spinner image path contains an unnecessary ../js/ segment.

- background: url(../js/../images/spinner-2x.gif) center center no-repeat;
+ background: url(../images/spinner-2x.gif) center center no-repeat;
includes/Fees.php (1)

Line range hint 56-126: Consider optimizing gateway fee calculation

While the documentation updates are good, the gateway fee calculation method could benefit from some improvements:

  1. Consider caching the processing fee calculation
  2. Use batch updates for better performance when processing multiple orders

Example optimization:

 public function calculate_gateway_fee( $order_id ) {
     global $wpdb;
+    // Cache processing fee calculation
+    static $processing_fee_cache = [];
+    
     $order          = wc_get_order( $order_id );
-    $processing_fee = $this->get_processing_fee( $order );
+    $processing_fee = $processing_fee_cache[$order_id] ?? $this->get_processing_fee( $order );
+    $processing_fee_cache[$order_id] = $processing_fee;

     if ( ! $processing_fee ) {
         return;
     }
assets/js/product-category-ui.js (1)

1-1: Consider using modern JavaScript features

The code uses jQuery and older JavaScript patterns. Consider modernizing:

  1. Use const/let instead of var
  2. Use arrow functions where appropriate
  3. Use template literals consistently

Example modernization:

-var g={
+const g = {
   init() {
-    e("body").on("click", ".dokan-product-category-li", this.categoryLiClick);
+    e("body").on("click", ".dokan-product-category-li", (event) => this.categoryLiClick(event));
   }
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

assets/js/admin.css (1)

253-259: Consider using CSS custom properties for consistent color management.

The new color scheme is applied consistently, but managing these color values could be improved by using CSS custom properties (variables).

Consider refactoring the color definitions:

+:root {
+  --dokan-primary: #7047EB;
+  --dokan-primary-hover: #EFEAFF;
+  --dokan-icon-bg: #E4E6EB;
+}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown .list-item a.active {
-  color: #7047EB;
+  color: var(--dokan-primary);
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown .list-item a.active .dokan-icon {
-  background-color: #E4E6EB;
+  background-color: var(--dokan-icon-bg);
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown .list-item a.active .dokan-icon svg path {
-  fill: #7047EB;
+  fill: var(--dokan-primary);
}

Also applies to: 265-265, 281-287

assets/css/admin.css (2)

118-118: Consider performance optimizations for animations and shadows.

While the styling is consistent, there are opportunities for performance improvements:

  1. Use transform instead of animating top property for better performance
  2. Optimize box-shadow by using less expensive properties

Consider these performance-focused changes:

.dokan-admin-header {
-  box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1);
+  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown {
-  top: 80px;
-  transition: all 0.2s ease;
+  transform: translateY(30px);
+  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon:hover .dropdown {
-  top: 42px;
+  transform: translateY(0);
}

Also applies to: 253-259, 265-265, 281-287


Line range hint 253-287: Consider enhancing accessibility for interactive elements.

While the current implementation maintains good accessibility practices, consider adding ARIA attributes for better screen reader support.

Add appropriate ARIA attributes to enhance accessibility:

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon {
+  role="button";
+  aria-haspopup="true";
+  aria-expanded="false";
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon:hover {
+  aria-expanded="true";
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown {
+  role="menu";
}

.dokan-admin-header .dokan-admin-header-menu .menu-item .menu-icon .dropdown .list-item a {
+  role="menuitem";
}
assets/js/dokan-tailwind.css (1)

110-114: Consider adjusting the mobile container width.

The 360px max-width for mobile containers might be too restrictive for modern devices. Many mobile devices have viewport widths of 375px or greater.

@media (min-width: 360px) {
    .container {
-        max-width: 360px;
+        max-width: 375px;
    }
}
includes/Product/Hooks.php (2)

Line range hint 464-519: Methods moved from Pro need additional validation

While the commission methods have been properly moved from Pro to Lite, there are a few security and validation improvements that could be made:

  1. The commission percentage validation could be stricter
  2. The commission type is hardcoded to 'fixed' without validation

Consider these improvements:

 public function add_per_product_commission_options() {
     if ( ! current_user_can( 'manage_woocommerce' ) ) {
         return;
     }
+    // Validate commission type
+    $allowed_types = array( 'fixed' );
+    $commission_type = in_array( $_POST['_per_product_admin_commission_type'], $allowed_types ) ? $_POST['_per_product_admin_commission_type'] : 'fixed';

     $product          = wc_get_product( get_the_ID() );
     $admin_commission = $product->get_meta( '_per_product_admin_commission' );
     $additional_fee   = $product->get_meta( '_per_product_admin_additional_fee' );

Line range hint 20-156: Consider performance optimizations for product search

The product search implementation is secure but could be optimized:

  1. Consider adding caching for frequent searches
  2. The SQL query could be optimized by using indexed columns

Consider adding caching:

 public function store_product_search_action() {
     if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'dokan_store_product_search_nonce' ) ) {
         wp_send_json_error( __( 'Error: Nonce verification failed', 'dokan-lite' ) );
     }

+    // Add caching
+    $cache_key = 'dokan_store_search_' . md5( $keyword . $store_id );
+    $results = wp_cache_get( $cache_key );
+    if ( false !== $results ) {
+        echo wp_json_encode( $results );
+        die();
+    }
includes/Commission.php (1)

Line range hint 54-503: Ensure backward compatibility for deprecated commission methods

The deprecation notices are well documented, but consider:

  1. Adding a migration path for existing implementations
  2. Documenting the migration process in the changelog

Consider adding a migration helper:

/**
 * Helper function to migrate from old commission methods to new ones
 * 
 * @since 3.14.0
 */
public function migrate_commission_settings() {
    // Migration logic here
}
includes/Admin/SetupWizard.php (1)

Line range hint 550-580: Enhance commission validation

The commission validation logic looks good, but consider adding a constant for the commission percentage limits (0-100) to make the code more maintainable.

+ const COMMISSION_PERCENTAGE_MIN = 0;
+ const COMMISSION_PERCENTAGE_MAX = 100;

 public function dokan_setup_commission_save() {
     // ...
     $dokan_commission_percentage = isset($_POST['dokan_commission_percentage']) ? (float) wc_format_decimal(sanitize_text_field(wp_unslash($_POST['dokan_commission_percentage']))) : 0;
-    if ($dokan_commission_percentage < 0 || $dokan_commission_percentage > 100) {
+    if ($dokan_commission_percentage < self::COMMISSION_PERCENTAGE_MIN || $dokan_commission_percentage > self::COMMISSION_PERCENTAGE_MAX) {
         $dokan_commission_percentage = 0;
     }
     // ...
 }
includes/Admin/Settings.php (1)

Line range hint 85-104: Consider enhancing validation reusability

The commission percentage validation logic is duplicated between SetupWizard and Settings classes. Consider extracting this to a shared utility class.

// New utility class
class CommissionValidator {
    const MIN_PERCENTAGE = 0;
    const MAX_PERCENTAGE = 100;

    public static function isValidPercentage($percentage) {
        return $percentage >= self::MIN_PERCENTAGE && $percentage <= self::MAX_PERCENTAGE;
    }
}

// Usage in both classes
if (!CommissionValidator::isValidPercentage($admin_percentage)) {
    $option_values['admin_percentage'] = $saved_admin_percentage;
}
assets/js/admin.asset.php (1)

1-1: Fix array formatting

The array formatting should follow PSR standards.

-<?php return array('dependencies' => array(), 'version' => 'c3d32b38d516ff742fe3');
+<?php return array(
+    'dependencies' => array(),
+    'version'      => 'c3d32b38d516ff742fe3',
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

assets/js/dokan-tailwind.asset.php (1)

1-1: Improve array formatting for better readability

Per WordPress coding standards, multi-item associative arrays should have each item on a new line.

-<?php return array('dependencies' => array(), 'version' => '2da709c485ff6df2f738');
+<?php return array(
+    'dependencies' => array(),
+    'version'      => '2da709c485ff6df2f738'
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-setup-wizard-commission.asset.php (1)

1-1: Improve array formatting for consistency

Follow the same formatting standard as other asset files.

-<?php return array('dependencies' => array(), 'version' => 'bf06db116d0976a40ce7');
+<?php return array(
+    'dependencies' => array(),
+    'version'      => 'bf06db116d0976a40ce7'
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-category-commission.asset.php (1)

1-1: Improve array formatting for consistency

Follow the same formatting standard as other asset files.

-<?php return array('dependencies' => array(), 'version' => 'd9f4264c2a84ab98a5ea');
+<?php return array(
+    'dependencies' => array(),
+    'version'      => 'd9f4264c2a84ab98a5ea'
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-promo-notice.asset.php (1)

1-1: Follow WordPress coding standards for array formatting.

The array formatting should follow WordPress coding standards for better readability.

Consider reformatting like this:

-<?php return array('dependencies' => array('jquery'), 'version' => '80157a00498fc183e7b3');
+<?php
+return array(
+    'dependencies' => array( 'jquery' ),
+    'version'      => '80157a00498fc183e7b3',
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

assets/js/dokan-admin-notice.asset.php (1)

1-1: Follow WordPress coding standards for array formatting.

For consistency with other files and better readability, consider reformatting the array structure.

Apply this format:

-<?php return array('dependencies' => array('jquery', 'wp-i18n'), 'version' => '8c23b3a662d033cc465e');
+<?php
+return array(
+    'dependencies' => array( 'jquery', 'wp-i18n' ),
+    'version'      => '8c23b3a662d033cc465e',
+);
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/setup-no-wc-style.css (1)

190-193: Consider using CSS custom properties for consistent color values.

The color scheme has been updated from red to purple throughout the file, but the values are hardcoded. Consider using CSS custom properties (variables) for better maintainability and consistency.

+:root {
+  --dokan-primary: #7047EB;
+  --dokan-primary-hover: #4c19e6;
+}
 .form-table .switch-input:checked + .switch-label:before {
-  background-color: #c9baf8;
+  background-color: var(--dokan-primary-hover);
 }
 .form-table .switch-input:checked + .switch-label:after {
-  background-color: #7047EB;
+  background-color: var(--dokan-primary);
 }

Also applies to: 274-280, 292-293, 299-300, 303-303, 306-307

assets/js/dokan-category-commission.css (2)

134-135: Consider using relative units for better scalability.

Some utility classes use specific pixel values which might not scale well across different screen sizes and zoom levels. Consider using relative units (rem/em) for better accessibility and responsiveness.

 .h-\[32px\] {
-    height: 32px;
+    height: 2rem;
 }
 .w-\[1px\] {
-    width: 1px;
+    width: 0.0625rem;
 }

Also applies to: 158-162, 200-202


Line range hint 709-714: Warning: Very small font sizes may affect readability.

The font sizes 6px and 8px defined in the mobile breakpoint are extremely small and may cause readability issues.

Consider increasing the minimum font size to at least 12px or 0.75rem for better accessibility:

 .d-xs\:text-\[6px\] {
-    font-size: 6px;
+    font-size: 0.75rem; /* 12px */
 }
 .d-xs\:text-\[8px\] {
-    font-size: 8px;
+    font-size: 0.875rem; /* 14px */
 }
assets/css/dokan-tailwind.css (1)

Line range hint 1-821: Consider consolidating duplicate Tailwind configurations.

This file appears to contain many duplicate utility classes and configurations also present in dokan-category-commission.css. Consider consolidating these into a single source of truth to avoid maintenance overhead and potential inconsistencies.

Recommendations:

  1. Create a single Tailwind configuration file
  2. Use the @apply directive to extend styles where needed
  3. Consider using Tailwind's build process to generate separate CSS files if needed for different contexts
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 649abf0 and e71675f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (82)
  • README.md (3 hunks)
  • assets/css/admin.css (3 hunks)
  • assets/css/dokan-category-commission.css (1 hunks)
  • assets/css/dokan-setup-wizard-commission.css (1 hunks)
  • assets/css/dokan-tailwind.css (13 hunks)
  • assets/css/global-admin.css (1 hunks)
  • assets/css/setup-no-wc-style.css (3 hunks)
  • assets/css/setup.css (3 hunks)
  • assets/css/vue-admin.css (23 hunks)
  • assets/css/vue-bootstrap.css (0 hunks)
  • assets/js/admin-rtl.css (3 hunks)
  • assets/js/admin.asset.php (1 hunks)
  • assets/js/admin.css (3 hunks)
  • assets/js/dokan-admin-notice.asset.php (1 hunks)
  • assets/js/dokan-admin-notice.js.LICENSE.txt (1 hunks)
  • assets/js/dokan-category-commission-rtl.css (1 hunks)
  • assets/js/dokan-category-commission.asset.php (1 hunks)
  • assets/js/dokan-category-commission.css (1 hunks)
  • assets/js/dokan-promo-notice.asset.php (1 hunks)
  • assets/js/dokan-setup-wizard-commission-rtl.css (1 hunks)
  • assets/js/dokan-setup-wizard-commission.asset.php (1 hunks)
  • assets/js/dokan-setup-wizard-commission.css (1 hunks)
  • assets/js/dokan-setup-wizard-commission.js (1 hunks)
  • assets/js/dokan-tailwind-rtl.css (13 hunks)
  • assets/js/dokan-tailwind.asset.php (1 hunks)
  • assets/js/dokan-tailwind.css (13 hunks)
  • assets/js/dokan.asset.php (1 hunks)
  • assets/js/global-admin-rtl.css (1 hunks)
  • assets/js/global-admin.asset.php (1 hunks)
  • assets/js/global-admin.css (1 hunks)
  • assets/js/product-category-ui.asset.php (1 hunks)
  • assets/js/product-category-ui.js (1 hunks)
  • assets/js/setup-no-wc-style-rtl.css (3 hunks)
  • assets/js/setup-no-wc-style.asset.php (1 hunks)
  • assets/js/setup-no-wc-style.css (3 hunks)
  • assets/js/setup-rtl.css (3 hunks)
  • assets/js/setup.asset.php (1 hunks)
  • assets/js/setup.css (3 hunks)
  • assets/js/vue-admin-rtl.css (23 hunks)
  • assets/js/vue-admin.asset.php (1 hunks)
  • assets/js/vue-admin.css (23 hunks)
  • assets/js/vue-bootstrap-rtl.css (0 hunks)
  • assets/js/vue-bootstrap.asset.php (1 hunks)
  • assets/js/vue-bootstrap.css (0 hunks)
  • dokan-class.php (1 hunks)
  • dokan.php (1 hunks)
  • includes/Admin/Notices/Manager.php (4 hunks)
  • includes/Admin/Settings.php (2 hunks)
  • includes/Admin/SetupWizard.php (2 hunks)
  • includes/Assets.php (1 hunks)
  • includes/Commission.php (19 hunks)
  • includes/Commission/Calculator.php (3 hunks)
  • includes/Commission/Formula/AbstractFormula.php (15 hunks)
  • includes/Commission/Formula/CategoryBased.php (22 hunks)
  • includes/Commission/Formula/Combine.php (15 hunks)
  • includes/Commission/Formula/Fixed.php (15 hunks)
  • includes/Commission/Formula/Flat.php (14 hunks)
  • includes/Commission/Formula/Percentage.php (12 hunks)
  • includes/Commission/FormulaFactory.php (2 hunks)
  • includes/Commission/Model/Commission.php (24 hunks)
  • includes/Commission/Model/Setting.php (17 hunks)
  • includes/Commission/Settings/Builder.php (2 hunks)
  • includes/Commission/Settings/DefaultSetting.php (3 hunks)
  • includes/Commission/Settings/GlobalSetting.php (4 hunks)
  • includes/Commission/Settings/InterfaceSetting.php (2 hunks)
  • includes/Commission/Settings/OrderItem.php (3 hunks)
  • includes/Commission/Settings/Product.php (3 hunks)
  • includes/Commission/Settings/Vendor.php (3 hunks)
  • includes/Commission/Strategies/AbstractStrategy.php (3 hunks)
  • includes/Commission/Strategies/DefaultStrategy.php (2 hunks)
  • includes/Commission/Strategies/GlobalStrategy.php (5 hunks)
  • includes/Commission/Strategies/OrderItem.php (7 hunks)
  • includes/Commission/Strategies/Product.php (4 hunks)
  • includes/Commission/Strategies/Vendor.php (6 hunks)
  • includes/Commission/Upugrader/Update_Category_Commission.php (3 hunks)
  • includes/Commission/Upugrader/Update_Product_Commission.php (2 hunks)
  • includes/Commission/Upugrader/Update_Vendor_Commission.php (1 hunks)
  • includes/Fees.php (6 hunks)
  • includes/Order/Admin/Hooks.php (2 hunks)
  • includes/Product/Hooks.php (2 hunks)
  • includes/Product/Manager.php (3 hunks)
  • includes/REST/AdminMiscController.php (1 hunks)
⛔ Files not processed due to max files limit (8)
  • includes/REST/CommissionControllerV1.php
  • includes/Upgrade/Upgrades/V_3_14_0.php
  • includes/Vendor/Vendor.php
  • includes/functions.php
  • package.json
  • readme.txt
  • src/admin/pages/VendorCapabilities.vue
  • templates/whats-new.php
💤 Files with no reviewable changes (3)
  • assets/js/vue-bootstrap-rtl.css
  • assets/js/vue-bootstrap.css
  • assets/css/vue-bootstrap.css
✅ Files skipped from review due to trivial changes (40)
  • assets/js/global-admin.asset.php
  • assets/js/vue-bootstrap.asset.php
  • assets/js/setup.asset.php
  • includes/Commission/Upugrader/Update_Vendor_Commission.php
  • includes/REST/AdminMiscController.php
  • assets/js/dokan-admin-notice.js.LICENSE.txt
  • includes/Commission/Calculator.php
  • includes/Commission/Settings/DefaultSetting.php
  • includes/Commission/Strategies/GlobalStrategy.php
  • assets/js/vue-admin.asset.php
  • includes/Commission/FormulaFactory.php
  • includes/Commission/Strategies/Product.php
  • assets/js/setup-no-wc-style.asset.php
  • includes/Product/Manager.php
  • includes/Commission/Strategies/AbstractStrategy.php
  • dokan-class.php
  • dokan.php
  • assets/css/global-admin.css
  • includes/Commission/Settings/InterfaceSetting.php
  • includes/Commission/Settings/Builder.php
  • assets/js/product-category-ui.asset.php
  • includes/Commission/Strategies/DefaultStrategy.php
  • includes/Commission/Formula/AbstractFormula.php
  • includes/Commission/Settings/Product.php
  • includes/Commission/Settings/GlobalSetting.php
  • includes/Commission/Strategies/Vendor.php
  • includes/Commission/Upugrader/Update_Category_Commission.php
  • includes/Assets.php
  • includes/Commission/Settings/OrderItem.php
  • assets/js/global-admin-rtl.css
  • includes/Commission/Settings/Vendor.php
  • includes/Commission/Strategies/OrderItem.php
  • includes/Commission/Formula/Flat.php
  • includes/Commission/Formula/Combine.php
  • includes/Commission/Formula/Percentage.php
  • includes/Commission/Model/Setting.php
  • includes/Commission/Formula/Fixed.php
  • includes/Commission/Formula/CategoryBased.php
  • assets/js/global-admin.css
  • includes/Commission/Model/Commission.php
🧰 Additional context used
🪛 Biome (1.9.4)
assets/js/product-category-ui.js

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

assets/js/dokan-setup-wizard-commission.js

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)


[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)


[error] 1-1: This aliasing of this is unnecessary.

Arrow functions inherits this from their enclosing scope.
Safe fix: Use this instead of an alias.

(lint/complexity/noUselessThisAlias)

🪛 LanguageTool
README.md

[misspelling] ~4-~4: This word is normally spelled as one.
Context: ... multivendor marketplace, multi seller, multi vendor, multivendor, multivendor marketplace ...

(EN_COMPOUNDS_MULTI_VENDOR)

🪛 Markdownlint (0.35.0)
README.md

352-352: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


353-353: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


354-354: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


355-355: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


356-356: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


357-357: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


358-358: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


359-359: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


360-360: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


361-361: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


362-362: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


363-363: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


364-364: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


365-365: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


366-366: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


384-384: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


385-385: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


389-389: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

🪛 GitHub Check: Run PHPCS inspection
assets/js/admin.asset.php

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

assets/js/dokan-admin-notice.asset.php

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-category-commission.asset.php

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-promo-notice.asset.php

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

assets/js/dokan-setup-wizard-commission.asset.php

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-tailwind.asset.php

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan.asset.php

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

🔇 Additional comments (45)
assets/js/dokan.asset.php (1)

1-1: Version update looks good

The version hash update aligns with the plugin version increment from 3.13.1 to 3.14.0.

🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

includes/Commission/Upugrader/Update_Product_Commission.php (1)

Line range hint 122-134: LGTM! Documentation update only

The version update in the @SInCE tag is appropriate, and the implementation remains sound, following WooCommerce's async processing patterns.

assets/js/setup-no-wc-style-rtl.css (4)

190-193: LGTM: Switch input styling updates align with new color scheme

The color updates for the switch input maintain good contrast while adhering to the new purple theme.


274-280: LGTM: Step indicators properly reflect the new theme

The color updates for active and completed steps maintain clear visual hierarchy while matching the new design system.


292-300: LGTM: Button styling provides clear interaction states

The color updates for buttons maintain good contrast and proper visual feedback for different states (normal/hover/active).


303-307: LGTM: Link and checkbox styling maintains consistency

The color updates for links and checkboxes align with the new theme while maintaining good contrast and visual consistency with other interactive elements.

assets/js/vue-admin.css (17)

482-484: Verify consistent styling in .cta-section.

The addition of background-size: cover;, padding, and color properties enhances the visual appeal of the .cta-section class. Ensure these changes do not affect the layout adversely on different screen sizes.


Line range hint 492-504: Ensure sufficient color contrast for accessibility.

The color: #FFC700; applied to the heading in .cta-section h2 may not provide enough contrast against certain backgrounds, potentially impacting readability for users with visual impairments. Consider verifying the color contrast ratio meets WCAG AA standards.


507-516: Check browser compatibility for inline-flex and align-items.

The use of display: inline-flex; and align-items: center; in .cta-section .btn may not be fully supported in older browsers. Ensure that these properties are compatible with the browsers supported by your application or provide suitable fallbacks.


519-520: Enhance hover effect for better user interaction.

The addition of box-shadow on hover in .cta-section .btn:hover improves visual feedback. Ensure the shadow effect aligns with the overall design language of the application.


529-530: Specify SVG dimensions using CSS for scalability.

Defining width and height for SVG elements in .cta-section .btn svg ensures consistent sizing across different devices and resolutions.


666-674: Ensure cross-browser compatibility for gradient text effect.

The use of background-clip: text and -webkit-text-fill-color: transparent; to create a gradient text effect in .vendor-capabilities-banner .content .title may not be supported in all browsers, such as older versions of Firefox and Internet Explorer. Verify that the text remains legible in unsupported browsers or provide appropriate fallbacks.


675-679: Improve text readability on various background colors.

Setting the color: #FFFFFF; in .vendor-capabilities-banner .content p ensures text is visible on dark backgrounds. Ensure that this text remains readable if the background changes or in situations where images fail to load.


683-683: Maintain visual consistency in button styles.

The updates to the button styles in .vendor-capabilities-banner a and the hover state enhance the user interface. Ensure that the hover background color #7047EB provides sufficient contrast with the text color for accessibility.

Also applies to: 685-687, 691-691


1270-1296: Confirm the scope of Vue.js scoped styles.

The addition of scoped styles using [data-v-5f26ba64] suggests usage within a Vue.js component. Ensure that these styles are correctly scoped and do not unintentionally affect other components.


Line range hint 1405-1463: Optimize scrollbar styles for better UX.

Custom scrollbar styling in .version-dropdown enhances the user experience. Ensure that these custom styles do not hinder usability, especially on different operating systems and browsers.


Line range hint 1534-1555: Ensure responsive design for various screen sizes.

Media queries added between lines 1534-1555 adjust the layout for different screen widths. Verify that the content displays correctly on all target devices.


Line range hint 1562-1647: Improve readability on mobile devices.

The adjustments made for screens with max-width of 991px and 768px aim to improve mobile usability. Test these changes on actual devices to ensure optimal user experience.


Line range hint 1660-1676: Check the visibility of the scroll-to-top button.

The .scroll-to-top button has opacity: 0; and visibility: hidden;. Ensure that it becomes visible when appropriate and that the transition effects are smooth.


2101-2139: Optimize vendor widget styling for consistency.

The .wm-box-container and child classes have been updated. Verify that these changes align with the overall design system and do not conflict with other components.


Line range hint 3211-3241: Ensure consistent layout in responsive design.

The media queries for screens up to 768px adjust the layout of .nav-tab-wrapper and .metabox-holder. Test these changes to confirm that the navigation and content areas are displayed correctly on smaller screens.


4687-4706: Check background images and padding in banners.

The updates to .vendor-capabilities-banner adjust padding and margins. Ensure that background images are correctly positioned and that the content remains centered and visually appealing.


1369-1390: 🛠️ Refactor suggestion

Ensure dropdown menus are accessible.

The styles for .jump-version and its dropdown menu should ensure that the menu is accessible via keyboard navigation and screen readers.

assets/js/vue-admin-rtl.css (3)

492-492: Verify color contrast for accessibility compliance

The heading color #FFC700 (bright yellow) may not provide sufficient contrast against the background, potentially affecting readability for users with visual impairments. Please verify that the color contrast ratio meets the WCAG accessibility guidelines.


1270-1275: LGTM

The addition of CSS transitions for fade effects enhances the user interface animations.


2101-2126: Verify proper scoping of CSS selectors

The selectors use data attributes like [data-v-7e4e2d4c], indicating scoped styles for Vue components. Ensure that these attributes are correctly generated and that the styles apply as intended to maintain encapsulation.

assets/js/dokan-setup-wizard-commission-rtl.css (1)

1-134: Code changes approved

The RTL styles are appropriately defined to support right-to-left layouts.

assets/js/dokan-setup-wizard-commission.css (1)

1-134: Code changes approved

The utility classes and CSS variables are well-defined for styling the setup wizard commission components.

assets/js/setup.css (1)

61-64: Verify color contrast ratios for accessibility.

The new color scheme (#7047EB and #c9baf8) should be verified for WCAG compliance:

  1. Text color against background (#7047EB for links and buttons)
  2. Toggle switch states (#c9baf8 for background)

Also applies to: 145-178

assets/css/setup.css (1)

Line range hint 1-178: Remove duplicate CSS file.

This file appears to be a duplicate of assets/js/setup.css. Having two copies of the same styles can lead to maintenance issues and inconsistencies.

Recommendations:

  1. Keep only one copy of setup.css in the correct location (assets/css/)
  2. Update all references to point to the correct file
  3. Ensure the build process handles the file location correctly
✅ Verification successful

Remove duplicate setup.css file from assets/js/ directory

The verification confirms there are two copies of setup.css with nearly identical content, but the file in assets/js/setup.css is misplaced and uses a simpler path to the spinner image. The correct file is assets/css/setup.css which is properly referenced in SetupWizard.php using DOKAN_PLUGIN_ASSEST . '/css/setup.css'.

Recommendations:

  • Delete the misplaced duplicate at assets/js/setup.css
  • Keep the correctly referenced version at assets/css/setup.css
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all references to setup.css to ensure proper updating

echo "Files referencing setup.css:"
rg -l "setup\.css"

echo "\nPotential duplicate CSS files:"
fd -e css -x md5sum {} \; | sort | uniq -w32 -d

Length of output: 1003


Script:

#!/bin/bash
# Let's verify if there's actually a duplicate setup.css file in assets/js/
# and compare their contents if both exist

echo "Checking for setup.css files:"
fd "setup.css$"

echo -e "\nComparing files if both exist:"
if [ -f "assets/js/setup.css" ] && [ -f "assets/css/setup.css" ]; then
    diff "assets/js/setup.css" "assets/css/setup.css"
fi

echo -e "\nChecking actual file path in SetupWizard.php:"
rg "setup\.css" "includes/Admin/SetupWizard.php" -C 2

Length of output: 925

assets/js/setup-rtl.css (1)

61-61: LGTM: Consistent color scheme update

The color scheme changes are systematically applied across all UI elements, maintaining a cohesive visual identity with the new brand colors. The primary color (#7047EB) and its variations are appropriately used for interactive elements.

Also applies to: 64-64, 145-146, 150-151, 163-164, 170-171, 174-174, 177-178

includes/Admin/Notices/Manager.php (2)

Line range hint 134-158: LGTM: Well-structured notice implementation

The logo update notice implementation includes:

  • Proper version annotation
  • Type safety with array parameters
  • Secure nonce implementation
  • Dismissible notice functionality

Line range hint 197-228: LGTM: Robust version compatibility check

The plugin update notice implementation correctly:

  • Compares version numbers
  • Provides clear upgrade instructions
  • Prevents dismissal of critical compatibility notices
includes/Fees.php (1)

Line range hint 219-243: LGTM: Well-documented fee recipient handling

The shipping tax fee recipient implementation includes:

  • Clear version documentation
  • Proper type hints
  • Backward compatibility handling
  • Appropriate filter hooks
assets/js/product-category-ui.js (1)

1-1: Add error handling for wp.hooks

The wp.hooks.doAction call assumes WordPress hooks are always available.

Consider adding error handling:

removeCatBox() {
  e(this).closest(".dokan-select-product-category-container")[0].remove();
- wp.hooks.doAction("dokan_removed_multistep_category");
+ if (wp && wp.hooks) {
+   wp.hooks.doAction("dokan_removed_multistep_category");
+ }
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

assets/js/admin.css (1)

118-118: LGTM! Improved vertical alignment.

The addition of align-items: center enhances the vertical alignment of the logo and its accompanying elements.

assets/js/admin-rtl.css (1)

118-118: LGTM! Excellent RTL support implementation.

The RTL styles correctly mirror the LTR version while maintaining the same visual hierarchy and spacing. All directional properties (margin, padding, float, position) are properly reversed.

Also applies to: 253-259, 265-265, 281-287

assets/js/dokan-tailwind-rtl.css (1)

629-631: Well-implemented RTL support.

The RTL implementation correctly handles:

  • Directional properties (margin, padding)
  • Border radiuses
  • Text alignment
  • Flexbox direction

This ensures proper layout mirroring for RTL languages.

Also applies to: 652-654, 655-658, 662-667, 691-696, 706-708

README.md (1)

350-367: Documentation accurately reflects code changes

The changelog properly documents the commission-related changes we've seen in the code:

  1. Commission UI updates
  2. New commission types implementation
  3. Movement of vendor edit page from Pro to Lite
🧰 Tools
🪛 Markdownlint (0.35.0)

352-352: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


353-353: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


354-354: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


355-355: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


356-356: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


357-357: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


358-358: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


359-359: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


360-360: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


361-361: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


362-362: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


363-363: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


364-364: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


365-365: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


366-366: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)

includes/Admin/SetupWizard.php (1)

503-506: LGTM: Method documentation update

The @SInCE tag has been correctly updated to version 3.14.0, and the initialization of commission_category_based_values is properly handled.

includes/Admin/Settings.php (1)

64-80: LGTM: New method for commission type handling

The new method properly sets a default commission type when none is specified. The implementation is clean and well-documented.

assets/js/dokan-tailwind.asset.php (1)

1-1: Verify version hash generation

The version hash has changed from '57f872b060dff564047e' to '2da709c485ff6df2f738'. Let's verify this is generated correctly from the build process.

✅ Verification successful

Version hash change is expected from the build process

The version hash change is expected and correct. The webpack configuration shows that the project uses the default WordPress scripts configuration (@wordpress/scripts/config/webpack.config) which automatically generates content-based hashes for cache busting. The hash changes whenever the source files or their dependencies are modified, which is the intended behavior for proper cache invalidation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the version hash matches the build output
# Look for build configuration files that might generate this hash
fd -e json -e js "webpack|rollup|vite" -x cat {} \; | grep -A 5 "dokan-tailwind"

Length of output: 273


Script:

#!/bin/bash
# Let's check the webpack configuration to understand how the hash is generated
fd -e js "webpack.config" -x cat {} \;

Length of output: 4757

🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-category-commission.asset.php (1)

1-1: Verify category commission dependencies

As this is a new file for category commission functionality, we should verify if it requires any WordPress core dependencies.

✅ Verification successful

No WordPress dependencies required for category commission asset

The category commission component is a Vue.js component that only depends on:

  • Vue.js (handled by webpack)
  • Tailwind CSS (for styling)
  • Accounting.js (accessed via global accounting object)
  • Dokan global object (for currency settings)

The asset file correctly declares no WordPress dependencies as it's bundled with all its frontend dependencies through webpack.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential missing dependencies
# Look for imports in the corresponding JS file
rg -A 5 "import|require" "assets/js/dokan-category-commission.js"

Length of output: 65


Script:

#!/bin/bash
# First, let's check if the JS file exists and see its content
fd "dokan-category-commission.js" assets/

# If file exists, let's see its content
fd "dokan-category-commission.js" assets/ -x cat {}

# Let's also check for any webpack config that might define dependencies
rg -l "dokan-category-commission" . --type js

Length of output: 200


Script:

#!/bin/bash
# Let's check the webpack config to see how this file is configured
cat webpack.config.js

# Let's also check the actual JS file content since the previous cat didn't show output
cat assets/js/dokan-category-commission.js

Length of output: 4784


Script:

#!/bin/bash
# Let's check the source file for category commission since webpack shows it's in src/admin/components/Commission/
cat src/admin/components/Commission/index.js

# Also check if there are any other related files in that directory
ls -la src/admin/components/Commission/

Length of output: 510


Script:

#!/bin/bash
# Let's check the Vue component to see what dependencies it uses
cat src/admin/components/Commission/CategoryBasedCommission.vue

# Also check the style file
cat src/admin/components/Commission/style.css

Length of output: 19364

🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

assets/js/dokan-promo-notice.asset.php (1)

1-1: LGTM! Version update and dependency configuration look correct.

The jQuery dependency is appropriate for promo notices, and the version hash update will ensure proper cache invalidation.

🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.


[failure] 1-1:
Expected 1 space before the array closer in a single line array. Found: no spaces

assets/js/dokan-admin-notice.asset.php (1)

1-1: LGTM! Good inclusion of internationalization support.

The dependencies are well-chosen:

  • jQuery for DOM manipulation
  • wp-i18n for proper internationalization support
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[failure] 1-1:
Expected 1 space after the array opener in a single line array. Found: no spaces


[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

Comment on lines 1300 to 1315
.dokan-help-page .section-wrapper .dokan-notice[data-v-5f26ba64] {
background: rgba(223, 0, 0, 0.05);
margin: -15px -20px 0;
padding: 15px 15px 0;
}
.dokan-help-page .section-wrapper .change-log[data-v-525b077c] {
background: rgba(223, 0, 0, 0.05);
.dokan-help-page .section-wrapper .change-log[data-v-5f26ba64] {
background: #efeaff;
margin: -15px -20px 0;
}
.dokan-help-page .section-wrapper .change-log.lite-change-log[data-v-525b077c] {
.dokan-help-page .section-wrapper .change-log.lite-change-log[data-v-5f26ba64] {
height: 340px;
}
.dokan-help-page .section-wrapper .change-log.pro-change-log[data-v-525b077c] {
.dokan-help-page .section-wrapper .change-log.pro-change-log[data-v-5f26ba64] {
height: 400px;
}
.dokan-help-page .section-wrapper .change-log h3[data-v-525b077c] {
.dokan-help-page .section-wrapper .change-log h3[data-v-5f26ba64] {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Check for color contrast in headings.

The use of color: transparent; in headings within .dokan-help-page may render text invisible or inaccessible. Ensure that this is intentional and that alternative text or styles are provided for users relying on visual cues.

Comment on lines 521 to 526
.cta-section .btn p {
color: #FFF;
font-size: 24px;
font-style: normal;
font-weight: 600;
line-height: normal;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Avoid invalid HTML structure by nesting block elements within inline elements.

Using a <p> tag inside a <button> or an <a> tag is not semantically correct and can cause HTML validation issues or unexpected behavior. Consider replacing <p> with <span> or restructuring the markup to maintain valid HTML semantics.

Apply the following diff to correct the issue:

-.cta-section .btn p {
+.cta-section .btn span {
  color: #FFF;
  font-size: 24px;
  font-style: normal;
  font-weight: 600;
  line-height: normal;
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.cta-section .btn p {
color: #FFF;
font-size: 24px;
font-style: normal;
font-weight: 600;
line-height: normal;
.cta-section .btn span {
color: #FFF;
font-size: 24px;
font-style: normal;
font-weight: 600;
line-height: normal;

@@ -187,10 +187,10 @@ body {
display: inline-block;
}
.form-table .switch-input:checked + .switch-label:before {
background-color: #fbcbc4;
background-color: #c9baf8;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider consolidating duplicate CSS files

This file appears to be a duplicate of setup-no-wc-style.css in the root directory. Having two files with identical styles can lead to maintenance challenges.

Consider:

  1. Keeping only one version of the file
  2. Using a build process to copy/minify the file to the required location

Also applies to: 193-193, 274-275, 279-280, 292-293, 299-300, 303-303, 306-307

!function(e){let a=e("#dokan-product-category-modal"),t=e("#dokan-cat-search-res"),o=e("#dokan-cat-search-res-ul"),n=e(".dokan-single-categories-right"),c=e(".dokan-single-categories-left"),d=[],s=[],i="",l=0,r="";var g={init(){e("body").on("click",".dokan-product-category-li",this.categoryLiClick),e("body").on("click",".dokan-cat-search-res-li",this.clickSearchResLi),e("body").on("keyup","#dokan-single-cat-search-input",g.debounce(this.typeToSearch,500)),e("body").on("scroll","#dokan-single-categories",this.categoryScroll),e("body").on("click",".dokan-single-categories-right-box",g.indicatorScrollTo),e("body").on("click",".dokan-single-categories-left-box",(function(){g.indicatorScrollTo(!1)})),e("body").on("click",".dokan-single-cat-select-btn",g.chooseCatButton),e("body").on("click",".dokan-category-open-modal",g.initModal),e("body").on("click","#dokan-category-close-modal",g.hideCategoryModal),e("body").on("click",".dokan-single-cat-add-btn",g.addANewCatBox),e("body").on("click",".dokan-select-product-category-remove-container",g.removeCatBox)},initModal(){i=e(this).data("dokansclevel"),l=e(this).data("selectfor");let a=e(this).siblings(".dokan-cat-inputs-holder").find(".dokan_chosen_product_cat");e(this).parent().attr("data-activate","yes"),g.openModal(a)},removeCatBox(){e(this).closest(".dokan-select-product-category-container")[0].remove(),wp.hooks.doAction("dokan_removed_multistep_category")},categoryLiClick(){let{catlevel:a,termId:t,name:o,haschild:n}=e(this).data();r=t,g.removeAfterClickedUls(a,t),g.loadChildCategories(a,t,o,n)},clickSearchResLi(){let{termid:a,index:t,name:o}=e(this).data();a&&(r=a,g.setCatUiBasedOnOneCat(a,s[t]))},typeToSearch(){let a=e(this).val();e("#dokan-cat-search-text-limit").html(a.length),a.length>0?(g.hideSearchResults(!1),g.doSearchCates(a)):g.hideSearchResults()},categoryScroll(){let a=e("#dokan-single-categories").get(0).scrollWidth-e("#dokan-single-categories").innerWidth(),t=e(this).scrollLeft(),o=a-t;g.showIndicators(c,t),g.showIndicators(n,o)},chooseCatButton(){let a=`.dokan-select-product-category-container.dokan_select_cat_for_${l}_${i}[data-activate='yes']`;e(a).parent().children(".dokan-select-product-category-container").children(".dokan-cat-inputs-holder").find(`.dokan_chosen_product_cat_${r}`).length?dokan_sweetalert(dokan_product_category_data.i18n.duplicate_category,{icon:"warning"}):(g.setCatName(g.getSelectedLabel(),e(a)),g.setCatId(r,e(a)),g.hideCategoryModal(),wp.hooks.doAction("dokan_selected_multistep_category",r),e(a).attr("data-activate","no"))},setCatUiBasedOnOneCat:function(e,a){let t=void 0!==a.children.length&&a.children.length>0;g.disableDoneBtn(t);let o=[...a.parents],n=[...a.parents];o.unshift(0),n.push(Number(e));let c=o.map(((e,a)=>g.getCategoriesWithParentId(e,a+1,n[a])));d=c,g.updateCategoryUi(),g.hideSearchResults(),g.scrollTo(c.length)},async doSearchCates(e){let a=[];for(const t in dokan_product_category_data.categories){let o=dokan_product_category_data.categories[t],n=o.name;e=e.toLowerCase(),n.toLowerCase().indexOf(e)>=0&&a.push(o)}s=a,g.updateSearchResultUi()},hideSearchResults(e=!0){e?t.addClass("dokan-hide"):t.removeClass("dokan-hide")},showIndicators(e,a){a>5?e.removeClass("dokan-hide"):e.addClass("dokan-hide")},showCategoryModal(){r="",g.disableDoneBtn(),a.css("display","flex"),g.hideSearchResults(),e("#dokan-single-cat-search-input").val(""),d=[],g.loadAllParentCategories()},disableDoneBtn(a=!0){e(".dokan-single-cat-select-btn").prop("disabled",a)},hideCategoryModal(){a.css("display","none"),e(".dokan-select-product-category-container").attr("data-activate","no")},loadAllParentCategories(){d.push(g.getCategoriesWithParentId()),g.updateCategoryUi()},getCategoriesWithParentId(e=0,a=1,t=!1){let o=[];for(const a in dokan_product_category_data.categories){let n=dokan_product_category_data.categories[a];n.parent_id==e&&(n.uiActivaion=Number(n.term_id)===t&&"dokan-product-category-li-active",o.push(n))}return o.sort(((e,a)=>e.name.toLowerCase()>a.name.toLowerCase()?1:a.name.toLowerCase()>e.name.toLowerCase()?-1:0)),{categories:o,level:a,term_id:e}},loadChildCategories(e,a,t,o){const n=dokan_product_category_data.any_category_selection;if(o&&!0!==Boolean(n)?g.disableDoneBtn():g.disableDoneBtn(!1),o){let t=g.getCategoriesWithParentId(a,e+1);d.push(t),g.updateCategoryUi(),g.scrollTo(e)}},updateSearchResultUi(){let e="";e=s.map(((e,a)=>`<li data-name="${e.name}" data-termid="${e.term_id}" data-index="${a}" class="dokan-cat-search-res-li">\n <div class="dokan-cat-search-res-item">\n ${e.name}\n </div>\n <div class="dokan-cat-search-res-history">\n ${g.getSearchedParentHistory(e.parents,e.name)}\n </div>\n </li>`)),0==s.length&&(e=`<li data-name="" data-termid="" data-index="" class="dokan-cat-search-res-li">\n <div class="dokan-cat-search-res-item">\n ${window.dokan.i18n_no_result_found}\n </div>\n <div class="dokan-cat-search-res-history">\n </div>\n </li>`),o.html(e)},getSearchedParentHistory(e,a){let t="";return t=e.map(((e,a)=>`<span class="dokan-cat-search-res-suggestion">${g.findCategory(e).name}</span>\n <span class="dokan-cat-search-res-indicator"><i class="fas fa-caret-right"></i></span>`)).join(""),t+=`<span class="dokan-cat-search-res-suggestion-selected">${g.highlight(a)}</span>`,t},highlight(a){let t=e("#dokan-single-cat-search-input").val().toLowerCase(),o=a.toLowerCase().indexOf(t);if(o>=0)return`<span>${a.substring(0,o)}</span>\n <span class='dokan-cat-highlight'>${a.substring(o,o+t.length)}</span>\n <span>${a.substring(o+t.length)}</span>`},updateCategoryUi(){let a=g.getCatUlHtml();e("#dokan-single-categories").html(a),g.updateSelectedLabel(),g.adjustCategoryPosition()},updateSelectedLabel(){e("#dokan-selected-category-span").html(g.getSelectedLabel())},adjustCategoryPosition(){e.each(e(".dokan-product-category-ul").find(".dokan-product-category-li-active"),(function(a,t){let{catlevel:o,indexli:n}=e(t).data();e(`#${o}-level-cat-ul`).scrollTop(36.38*n)}))},getSelectedLabel(){let a=e(".dokan-product-category-li-active"),t=a.length,o="";return a.each(((e,a)=>{var n=a.dataset;o+=`<span class="dokan-selected-category-product ${t==e+1?"dokan-cat-selected":""}">${n.name}</span>\n ${t!=e+1?'<span class="dokan-selected-category-icon"><i class="fas fa-chevron-right"></i></span>':""}`})),o},updateCategorySelection(e,a){let t=d[e-1].categories.map((e=>(e.term_id==a?e.uiActivaion="dokan-product-category-li-active":e.uiActivaion="",e)));d[e-1].categories=t,g.updateCategoryUi()},getCatUlHtml:()=>d.map(((e,a)=>{let t=g.getCatLiHtml(e.categories,e.level);return`<ul id="${e.level}-level-cat-ul" class="dokan-product-category-ul ${e.level}-level-cat" data-level="${e.level}">${t}</ul>`})),getCatLiHtml(e,a){let t="";return e.forEach(((e,o)=>{t+=`<li data-indexli="${o}" data-haschild="${e.children.length>0}" data-name="${e.name}" data-catLevel="${a}" class="${e.uiActivaion?e.uiActivaion:""} dokan-product-category-li ${e.children.length>0?"dokan-cat-has-child":""}" data-term-id="${e.term_id}" data-taxonomy="product_cat">\n <span class="dokan-product-category">${e.name}</span>\n <span class="dokan-product-category-icon"><i class="fas fa-chevron-right"></i></span>\n </li>`})),t},removeAfterClickedUls(e,a){let t=d.filter((a=>{if(a.level<=e)return a}));d=t,g.updateCategorySelection(e,a)},scrollTo(a=0){e("#dokan-single-categories").animate({scrollLeft:300*a},800)},indicatorScrollTo(a=!0){e("#dokan-single-categories").animate({scrollLeft:(a?"+":"-")+"=350px"},800)},setCatId(e,a){let t=`<input data-field-name="chosen_product_cat" type="hidden" class="dokan_chosen_product_cat dokan_chosen_product_cat_${e}" name="chosen_product_cat[]" value="${e}"></input>`;t+=`<input type="hidden" name="chosen_product_cat_bulk[]" value="${e}"></input>`,a.children(`.dokan-cih-level-${i}`).html(t)},setCatName(e,a){a.children(".dokan-select-product-category").children(`.dokan-ssct-level-${i}`).html(e)},addANewCatBox(){let a=e(this)[0],t=e(a).data("selectfor");l=t;let o=e(this).parent().siblings(".dokan-add-new-cat-box").children(".dokan-select-product-category-container").length,n=e(this).parent().siblings(".dokan-add-new-cat-box").children(".dokan-select-product-category-container")[o-1],c=e(n).find("#dokan-category-open-modal").data("dokansclevel")+1;isNaN(c)&&(c=0);let d=`\n <div data-activate="no" class="dokan-select-product-category-container dokan_select_cat_for_${t}_${c}">\n <div class="dokan-form-group dokan-select-product-category dokan-category-open-modal" data-dokansclevel="${c}" id="dokan-category-open-modal" data-selectfor="${t}">\n <span id="dokan_product_cat_res" class="dokan-select-product-category-title dokan-ssct-level-${c}">- ${dokan_product_category_data.i18n.select_a_category} -</span>\n <span class="dokan-select-product-category-icon"><i class="fas fa-edit"></i></span>\n </div>\n ${dokan_product_category_data.is_single?"":'\n <div class="dokan-select-product-category-remove-container">\n <span class="dokan-select-product-category-remove"><i class="fas fa-times"></i></span>\n </div>'}\n <span class="dokan-cat-inputs-holder dokan-cih-level-${c}" ></span>\n </div>\n `;e(this).parent().parent().children(`.cat_box_for_${t}`).append(d)},findCategory:e=>dokan_product_category_data.categories[e],debounce(e,a,t){var o;return function(){var n=this,c=arguments,d=t&&!o;clearTimeout(o),o=setTimeout((function(){o=null,t||e.apply(n,c)}),a),d&&e.apply(n,c)}},openModal(e){if(g.showCategoryModal(),e.length>0){let a=e.val();r=a;let t=dokan_product_category_data.categories[a];g.setCatUiBasedOnOneCat(a,t)}}};e(document).ready((function(){g.init()}))}(jQuery);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Address code quality issues flagged by static analysis

Several code quality issues were identified:

  1. Assignments within expressions can lead to confusion
  2. Usage of unsafe isNaN instead of Number.isNaN

Consider refactoring to improve code clarity and safety:

-isNaN(c)&&(c=0);
+if (Number.isNaN(c)) {
+  c = 0;
+}

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: 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] 1-1: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Comment on lines 1 to 484
.d-xs\:text-\[6px\] {
font-size: 6px
}
.d-xs\:text-\[8px\] {
font-size: 8px
}
.d-xs\:shadow-md {
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
}
@media (min-width: 640px) {
.sm\:w-fit {
width: -moz-fit-content;
width: fit-content
}
.sm\:text-\[12px\] {
font-size: 12px
}
.sm\:text-\[14px\] {
font-size: 14px
}
}
@media (min-width: 768px) {
.md\:flex {
display: flex
}
.md\:w-auto {
width: auto
}
.md\:\!rounded-l-\[5px\] {
border-top-left-radius: 5px !important;
border-bottom-left-radius: 5px !important
}
.md\:\!rounded-r-\[5px\] {
border-top-right-radius: 5px !important;
border-bottom-right-radius: 5px !important
}
.md\:border-0 {
border-width: 0px
}
.md\:\!border-l-\[0\.957434px\] {
border-left-width: 0.957434px !important
}
.md\:\!border-r-\[0\.957434px\] {
border-right-width: 0.957434px !important
}
.md\:\!border-r-\[1px\] {
border-right-width: 1px !important
}
.md\:border-l-\[0\.957434px\] {
border-left-width: 0.957434px
}
.md\:border-l-\[1px\] {
border-left-width: 1px
}
.md\:border-r-\[0\.957434px\] {
border-right-width: 0.957434px
}
.md\:\!bg-gray-100 {
--tw-bg-opacity: 1 !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important
}
.md\:bg-transparent {
background-color: transparent
}
.md\:p-2 {
padding: 0.5rem
}
.md\:\!pl-\[5px\] {
padding-left: 5px !important
}
.md\:pl-2 {
padding-left: 0.5rem
}
.md\:pl-4 {
padding-left: 1rem
}
.md\:pl-6 {
padding-left: 1.5rem
}
.md\:pr-2 {
padding-right: 0.5rem
}
.md\:text-left {
text-align: left
}
.md\:shadow-md {
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
.md\:shadow-none {
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consolidate duplicate CSS files and fix directory structure.

  1. This file is duplicated in assets/js/dokan-category-commission.css
  2. CSS files should not be in the js directory

Recommendations:

  1. Remove the duplicate file from the js directory
  2. Consider using Tailwind's JIT mode to reduce the CSS file size by only including used utilities
  3. Consider extracting common styles into reusable components

Consider implementing CSS modules or CSS-in-JS solutions for better maintainability and to avoid global scope pollution.

Comment on lines 1 to 484
.d-xs\:text-\[6px\] {
font-size: 6px
}
.d-xs\:text-\[8px\] {
font-size: 8px
}
.d-xs\:shadow-md {
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
}
@media (min-width: 640px) {
.sm\:w-fit {
width: -moz-fit-content;
width: fit-content
}
.sm\:text-\[12px\] {
font-size: 12px
}
.sm\:text-\[14px\] {
font-size: 14px
}
}
@media (min-width: 768px) {
.md\:flex {
display: flex
}
.md\:w-auto {
width: auto
}
.md\:\!rounded-l-\[5px\] {
border-top-right-radius: 5px !important;
border-bottom-right-radius: 5px !important
}
.md\:\!rounded-r-\[5px\] {
border-top-left-radius: 5px !important;
border-bottom-left-radius: 5px !important
}
.md\:border-0 {
border-width: 0px
}
.md\:\!border-l-\[0\.957434px\] {
border-right-width: 0.957434px !important
}
.md\:\!border-r-\[0\.957434px\] {
border-left-width: 0.957434px !important
}
.md\:\!border-r-\[1px\] {
border-left-width: 1px !important
}
.md\:border-l-\[0\.957434px\] {
border-right-width: 0.957434px
}
.md\:border-l-\[1px\] {
border-right-width: 1px
}
.md\:border-r-\[0\.957434px\] {
border-left-width: 0.957434px
}
.md\:\!bg-gray-100 {
--tw-bg-opacity: 1 !important;
background-color: rgb(243 244 246 / var(--tw-bg-opacity)) !important
}
.md\:bg-transparent {
background-color: transparent
}
.md\:p-2 {
padding: 0.5rem
}
.md\:\!pl-\[5px\] {
padding-right: 5px !important
}
.md\:pl-2 {
padding-right: 0.5rem
}
.md\:pl-4 {
padding-right: 1rem
}
.md\:pl-6 {
padding-right: 1.5rem
}
.md\:pr-2 {
padding-left: 0.5rem
}
.md\:text-left {
text-align: right
}
.md\:shadow-md {
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
.md\:shadow-none {
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Modernize RTL support and fix directory structure.

  1. The file is incorrectly placed in the js directory

  2. Consider using CSS logical properties instead of physical properties for better RTL support

  3. Move the file to the css directory

  4. Replace physical properties with logical properties:

.mr-20 {
-    margin-left: 5rem
+    margin-inline-start: 5rem
}

.border-l-[1px] {
-    border-right-width: 1px
+    border-inline-start-width: 1px
}

Consider using CSS logical properties (margin-inline, padding-inline, border-inline, etc.) which automatically handle both LTR and RTL layouts, potentially eliminating the need for a separate RTL stylesheet.

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 371 to 373
.\!border-0 {
border-width: 0px !important;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Reduce usage of !important declarations.

Excessive use of !important flags makes the CSS harder to maintain and override when needed. Consider restructuring the selectors to achieve higher specificity without !important.

Example refactor approach:

-.\!border-0 {
-    border-width: 0px !important;
-}
+[data-theme="dokan"] .border-0,
+.dokan-theme .border-0 {
+    border-width: 0px;
+}

Also applies to: 407-409, 428-430, 449-451, 452-454, 455-457, 458-460

Comment on lines 709 to 714
.d-xs\:text-\[6px\] {
font-size: 6px;
}
.d-xs\:text-\[8px\] {
font-size: 8px;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider increasing minimum font sizes for better readability.

The font sizes of 6px and 8px in the mobile view (360px breakpoint) are too small for comfortable reading and accessibility. Most mobile devices and design guidelines recommend a minimum font size of 12px.

Consider updating the font sizes:

-.d-xs\:text-\[6px\] {
-    font-size: 6px;
-}
-.d-xs\:text-\[8px\] {
-    font-size: 8px;
-}
+.d-xs\:text-\[12px\] {
+    font-size: 12px;
+}

Committable suggestion skipped: line range outside the PR's diff.

@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => 'bf06db116d0976a40ce7');
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the code analysis from the ripgrep results, I can generate the final response:

Add WordPress core dependencies to the asset file

The JavaScript code shows Vue.js usage and requires WordPress core dependencies:

  • wp-i18n: For internationalization (__() function usage)
  • wp-element: For WordPress element abstraction (Vue.js integration)
🔗 Analysis chain

Verify setup wizard dependencies

As this is a new file for the setup wizard commission functionality, we should verify if it requires any WordPress core dependencies (e.g., wp-element, wp-i18n).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential missing dependencies
# Look for imports in the corresponding JS file
rg -A 5 "import|require" "assets/js/dokan-setup-wizard-commission.js"

Length of output: 19426

🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[warning] 1-1:
When a multi-item array uses associative keys, each value should start on a new line.

@osmansufy osmansufy force-pushed the enhance/plugin-header-section-redesign branch from e657ef3 to 4b1483a Compare December 4, 2024 11:18
templates/admin-header.php Outdated Show resolved Hide resolved
@mrabbani mrabbani added Needs: Author Reply and removed Needs: Dev Review It requires a developer review and approval labels Dec 5, 2024
Copy link
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: 0

🧹 Outside diff range and nitpick comments (1)
templates/admin-header.php (1)

Line range hint 102-159: Add security attributes to external links

External links in the menu should include rel="noopener noreferrer" for security.

Example fix for one link:

-<a href="https://wedevs.com/account/tickets/?utm_source=plugin&utm_medium=wp-admin&utm_campaign=dokan-lite" target="_blank">
+<a href="https://wedevs.com/account/tickets/?utm_source=plugin&utm_medium=wp-admin&utm_campaign=dokan-lite" target="_blank" rel="noopener noreferrer">

Please apply similar changes to all external links in the menu.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e657ef3 and 9150148.

📒 Files selected for processing (1)
  • templates/admin-header.php (2 hunks)
🔇 Additional comments (4)
templates/admin-header.php (4)

7-7: Fix typo in constant name 'DOKAN_PLUGIN_ASSEST'

The constant name has a typo and should be 'DOKAN_PLUGIN_ASSETS'.

-<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
+<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSETS . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>

22-22: Add null check for dokan_pro()

The condition should include a null check for dokan_pro() to prevent potential errors.

-if ( dokan_pro() && dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
+if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {

43-46: Make upgrade URL configurable

The upgrade URL should be configurable rather than hardcoded, and the external link should include security attributes.

-$upgrade_url = 'https://dokan.co/wordpress/pricing/';
+$upgrade_url = apply_filters( 'dokan_admin_upgrade_url', 'https://dokan.co/wordpress/pricing/' );
-<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
+<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">

Line range hint 1-167: Overall structure looks good!

The new header section is well-organized with clear separation between logo, version tags, and menu sections. The conditional rendering for Pro version and upgrade button is handled effectively.

Copy link
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: 0

🧹 Outside diff range and nitpick comments (2)
templates/admin-header.php (2)

14-18: Consider adding version comparison for update notifications

The version display could be enhanced by comparing current versions with latest available versions to notify admins of updates.

 $lite_version = DOKAN_PLUGIN_VERSION;
+$latest_version = dokan_get_latest_version();
 ?>
 <span class="version-tag lite">
-    Lite: <?php echo esc_html( $lite_version ); ?>
+    Lite: <?php echo esc_html( $lite_version ); ?>
+    <?php if ( version_compare( $lite_version, $latest_version, '<' ) ) : ?>
+        <span class="update-available">(Update available)</span>
+    <?php endif; ?>
 </span>

Line range hint 72-167: Enhance external links security and tracking

The menu links that open in new tabs should:

  1. Include rel="noopener noreferrer" for security
  2. Consider adding analytics tracking for better user behavior insights

Example implementation:

-<a href="https://wedevs.com/docs/dokan/getting-started/?utm_source=plugin&utm_medium=wp-admin&utm_campaign=dokan-lite" target="_blank">
+<a href="<?php echo esc_url( apply_filters( 'dokan_docs_url', 'https://wedevs.com/docs/dokan/getting-started/?utm_source=plugin&utm_medium=wp-admin&utm_campaign=dokan-lite' ) ); ?>" 
+   target="_blank" 
+   rel="noopener noreferrer"
+   onclick="dokanTrackClick('documentation_link')">
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9150148 and 385004f.

📒 Files selected for processing (1)
  • templates/admin-header.php (2 hunks)
🔇 Additional comments (4)
templates/admin-header.php (4)

7-7: Fix typo in constant name 'DOKAN_PLUGIN_ASSEST'

The constant name appears to be misspelled. It should be DOKAN_PLUGIN_ASSETS.


22-22: Add null check for dokan_pro()

The condition should check if dokan_pro() returns a valid object before accessing its properties to prevent potential PHP errors.


43-46: Make upgrade URL configurable

The upgrade URL should be:

  1. Configurable through filters
  2. Include proper security attributes for external links

1-2: Well-structured header implementation

The header implementation provides a clear organization of plugin information and helpful resources. The separation of content into distinct sections (logo, version tags, and menu) promotes good maintainability.

@osmansufy osmansufy added Needs: Dev Review It requires a developer review and approval Needs: Author Reply and removed Needs: Author Reply Needs: Dev Review It requires a developer review and approval labels Dec 5, 2024
@mrabbani mrabbani removed the Needs: Dev Review It requires a developer review and approval label Dec 6, 2024
@mrabbani mrabbani added Needs: Testing This requires further testing 👍 Dev Review Done labels Dec 6, 2024
@shashwatahalder01 shashwatahalder01 added QA In Progress and removed Needs: Testing This requires further testing labels Dec 9, 2024
@shashwatahalder01

This comment was marked as resolved.

@shashwatahalder01

This comment was marked as resolved.

@shashwatahalder01

This comment was marked as resolved.

@shashwatahalder01 shashwatahalder01 added QA In Progress QA approved This PR is approved by the QA team and removed Type: Bug QA In Progress labels Dec 10, 2024
@shohag121 shohag121 merged commit 31194fa into develop Dec 10, 2024
1 of 2 checks passed
@shohag121 shohag121 deleted the enhance/plugin-header-section-redesign branch December 10, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA approved This PR is approved by the QA team 👍 Dev Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants