Update pro tips and support sale api#2340
Conversation
|
Warning Rate limit exceeded@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 17 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis change centralizes and standardizes the addition of UTM parameters to upgrade and promotional links throughout the application. A new helper method, Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant FrmSalesApi
participant FrmAppHelper
Caller->>FrmSalesApi: get_best_sale_value('some_cta_link')
alt Link exists
Caller->>FrmAppHelper: maybe_add_missing_utm(link, utm_params)
FrmAppHelper-->>Caller: Link with missing UTM params added
else Link does not exist
Caller->>FrmAppHelper: admin_upgrade_link(utm_params)
FrmAppHelper-->>Caller: Default upgrade link with UTM params
end
Possibly related PRs
Suggested labels
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
classes/controllers/FrmAppController.php(2 hunks)classes/helpers/FrmAppHelper.php(2 hunks)classes/helpers/FrmDashboardHelper.php(1 hunks)classes/helpers/FrmTipsHelper.php(13 hunks)classes/views/dashboard/templates/pro-features-list.php(1 hunks)classes/views/frm-settings/license_box.php(2 hunks)classes/views/shared/admin-footer-links.php(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
classes/views/shared/admin-footer-links.php (1)
classes/helpers/FrmAppHelper.php (2)
FrmAppHelper(6-4568)pro_is_installed(279-281)
classes/views/dashboard/templates/pro-features-list.php (1)
classes/helpers/FrmAppHelper.php (2)
FrmAppHelper(6-4568)admin_upgrade_link(121-162)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP trunk
🔇 Additional comments (12)
classes/helpers/FrmAppHelper.php (2)
164-190: Well-structured helper method for consistent UTM parameter handling.This new method provides a centralized way to handle UTM parameters for promotional links. It checks if specific UTM parameters already exist in a URL and only adds missing ones, which prevents duplicate parameters while ensuring consistent tracking.
1462-1472: Good implementation of the new UTM parameter handling.The refactored code in
print_admin_bannerorganizes the UTM parameters in a separate array and uses the newmaybe_add_missing_utmmethod to ensure upgrade links have consistent tracking parameters. This approach is more maintainable than directly embedding the parameters in each URL.classes/views/shared/admin-footer-links.php (1)
10-21: Consistent approach to UTM parameter handling in footer links.The code now clearly defines UTM parameters in a separate array and handles both existing and fallback link scenarios appropriately. This ensures all footer upgrade links have consistent tracking parameters regardless of their source.
classes/views/dashboard/templates/pro-features-list.php (1)
22-30: Improved UTM parameter handling for discount links.The implementation follows the new pattern of defining UTM parameters separately and using the
maybe_add_missing_utmhelper method consistently. This standardizes tracking across promotional links in the dashboard.classes/views/frm-settings/license_box.php (1)
12-20: Good implementation of the new UTM parameter handling pattern.The approach of defining UTM parameters separately and checking for existing links before generating fallbacks keeps the code clean and consistent with other parts of the application.
classes/helpers/FrmDashboardHelper.php (1)
205-214: Standardized UTM parameter handling for upgrade linksThis change improves the consistency of UTM tracking by centralizing the UTM parameter handling. When a sale link exists, it ensures parameters are properly added; otherwise, it falls back to the standard admin upgrade link.
classes/controllers/FrmAppController.php (2)
359-365: Improved upgrade link handling with standardized UTM trackingThe code now first checks if a custom upgrade link exists from the sales API, then enhances it with UTM parameters. This approach is more maintainable and ensures consistent tracking across promotional links.
582-588: Consistent upgrade link handling with UTM parameter trackingThis change follows the same pattern as the previous upgrade link modification. It separates the UTM parameters into a dedicated variable and uses a consistent approach to either enhance existing links or generate new ones with proper tracking parameters.
classes/helpers/FrmTipsHelper.php (4)
58-58: Refactored tip link generation for better maintainabilityThe code now delegates link generation to a dedicated method instead of inline logic, improving readability and maintainability.
79-99: Added helper method for centralized tip link generationThe new
get_tip_linkmethod standardizes how tip links are constructed, ensuring consistent UTM parameter tracking across all promotional tip links. This is a good refactoring that improves code organization and maintainability.
109-112: Enhanced CTA label customizationThis improvement allows for dynamic promotional text from the sales API, providing more flexibility in marketing messaging without code changes.
134-135: Updated promotional messaging for consistency and clarityMultiple tip descriptions have been refined for better clarity, engagement, and consistency. The promotional calls-to-action now use the centralized
cta_label()method for unified messaging across the plugin.Also applies to: 150-151, 166-167, 184-185, 192-193, 200-201, 218-219, 242-243, 250-251, 258-259, 274-275, 282-283, 290-291, 298-299, 316-317, 350-351, 366-367
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
classes/views/frm-settings/license_box.php (1)
38-52:⚠️ Potential issueExact duplicate block still present – please remove to avoid conflicting values
This duplicate code was pointed out in the previous review but remains unchanged. Re-querying the same sale values and rebuilding the UTM parameters increases maintenance burden and can accidentally overwrite the variables set above.
- $unlock_more_upgrade_text = FrmSalesApi::get_best_sale_value( 'global_settings_unlock_more_cta_text' ); - if ( ! $unlock_more_upgrade_text ) { - $unlock_more_upgrade_text = __( 'upgrading to PRO', 'formidable' ); - } - - $unlock_more_upgrade_link = FrmSalesApi::get_best_sale_value( 'global_settings_unlock_more_cta_link' ); - $utm = array( - 'medium' => 'settings-license', - 'content' => 'global-settings-license-box-unlock-more', - ); - if ( $unlock_more_upgrade_link ) { - $unlock_more_upgrade_link = FrmAppHelper::maybe_add_missing_utm( $unlock_more_upgrade_link, $utm ); - } else { - $unlock_more_upgrade_link = FrmAppHelper::admin_upgrade_link( $utm ); - }After removal, the first block (27-36) will supply the
$unlock_more_upgrade_textand$unlock_more_upgrade_linkvalues exactly once.
🧹 Nitpick comments (1)
classes/views/frm-settings/license_box.php (1)
27-36: Potential variable shadowing & unnecessary recomputation
$utmis re-declared a second time a few lines later (38-47). Although PHP allows this, the second declaration is redundant and makes the intent harder to follow. Consider defining the array only once per logical block (button vs unlock-more) to avoid confusion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
classes/views/frm-settings/license_box.php(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
🔇 Additional comments (1)
classes/views/frm-settings/license_box.php (1)
12-20: Nice consolidation of UTM handling for the “Get Formidable Now” linkUsing a single
$utmarray andmaybe_add_missing_utm()keeps the link-building logic DRY and consistent with the new helper.
No description provided.