Skip to content

Conversation

abdelmalekkkkk
Copy link
Collaborator

@abdelmalekkkkk abdelmalekkkkk commented Sep 15, 2025

Summary

Addresses issue:

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Sep 15, 2025

Size Change: +92 B (0%)

Total Size: 2.01 MB

ℹ️ View Unchanged
Filename Size Change
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.css 124 B 0 B
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.js 20 B 0 B
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 42.7 kB 0 B
./dist/assets/blocks/reader-revenue-manager/common/editor-styles.css 307 B 0 B
./dist/assets/blocks/reader-revenue-manager/common/editor-styles.js 20 B 0 B
./dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 5.88 kB 0 B
./dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 5.07 kB 0 B
./dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 5.88 kB 0 B
./dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 5.07 kB 0 B
./dist/assets/blocks/sign-in-with-google/editor-styles.css 84 B 0 B
./dist/assets/blocks/sign-in-with-google/editor-styles.js 20 B 0 B
./dist/assets/blocks/sign-in-with-google/index.js 17.8 kB 0 B
./dist/assets/css/googlesitekit-admin-css-********************.min.css 62.5 kB 0 B
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.7 kB 0 B
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 846 B 0 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.43 kB 0 B
./dist/assets/js/146-********************.js 963 B 0 B
./dist/assets/js/201-********************.js 2.85 kB 0 B
./dist/assets/js/315-********************.js 3.08 kB 0 B
./dist/assets/js/379-********************.js 3.7 kB 0 B
./dist/assets/js/590-********************.js 1.89 kB 0 B
./dist/assets/js/640-********************.js 2.36 kB 0 B
./dist/assets/js/909-********************.js 1.01 kB 0 B
./dist/assets/js/analytics-advanced-tracking-********************.js 475 B 0 B
./dist/assets/js/googlesitekit-activation-********************.js 24 kB 0 B
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 53.4 kB 0 B
./dist/assets/js/googlesitekit-adminbar-********************.js 34.3 kB 0 B
./dist/assets/js/googlesitekit-api-********************.js 7.76 kB 0 B
./dist/assets/js/googlesitekit-block-tracking-********************.js 5.51 kB 0 B
./dist/assets/js/googlesitekit-components-********************.js 5.64 kB 0 B
./dist/assets/js/googlesitekit-consent-mode-********************.js 25.5 kB 0 B
./dist/assets/js/googlesitekit-data-********************.js 1.68 kB 0 B
./dist/assets/js/googlesitekit-datastore-forms-********************.js 6.99 kB 0 B
./dist/assets/js/googlesitekit-datastore-location-********************.js 1.51 kB 0 B
./dist/assets/js/googlesitekit-datastore-site-********************.js 16.9 kB 0 B
./dist/assets/js/googlesitekit-datastore-ui-********************.js 7.11 kB 0 B
./dist/assets/js/googlesitekit-datastore-user-********************.js 22.7 kB 0 B
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 54.8 kB 0 B
./dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 1.74 kB 0 B
./dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 745 B +92 B (+14.09%) ⚠️
./dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 1.74 kB 0 B
./dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 1.66 kB 0 B
./dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 1.69 kB 0 B
./dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 1.75 kB 0 B
./dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 1.13 kB 0 B
./dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 1.74 kB 0 B
./dist/assets/js/googlesitekit-i18n-********************.js 6.16 kB 0 B
./dist/assets/js/googlesitekit-key-metrics-setup-********************.js 21.7 kB 0 B
./dist/assets/js/googlesitekit-main-dashboard-********************.js 127 kB 0 B
./dist/assets/js/googlesitekit-metric-selection-********************.js 51.2 kB 0 B
./dist/assets/js/googlesitekit-modules-********************.js 19.8 kB 0 B
./dist/assets/js/googlesitekit-modules-ads-********************.js 47.4 kB 0 B
./dist/assets/js/googlesitekit-modules-adsense-********************.js 123 kB 0 B
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 184 kB 0 B
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 23.5 kB 0 B
./dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 43 kB 0 B
./dist/assets/js/googlesitekit-modules-search-console-********************.js 65.2 kB 0 B
./dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 32.3 kB 0 B
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 30 kB 0 B
./dist/assets/js/googlesitekit-notifications-********************.js 62.7 kB 0 B
./dist/assets/js/googlesitekit-polyfills-********************.js 230 B 0 B
./dist/assets/js/googlesitekit-settings-********************.js 120 kB 0 B
./dist/assets/js/googlesitekit-splash-********************.js 64.5 kB 0 B
./dist/assets/js/googlesitekit-user-input-********************.js 44.6 kB 0 B
./dist/assets/js/googlesitekit-vendor-********************.js 322 kB 0 B
./dist/assets/js/googlesitekit-widgets-********************.js 102 kB 0 B
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 59 kB 0 B
./dist/assets/js/runtime-********************.js 1.9 kB 0 B

compressed-size-action

Copy link

github-actions bot commented Sep 15, 2025

Build files for e5707f7 are ready:

@abdelmalekkkkk abdelmalekkkkk force-pushed the enhancement/11011-easy-digital-downloads-ecee-integration branch from b2b034d to 6e4518b Compare September 15, 2025 14:52
@abdelmalekkkkk abdelmalekkkkk force-pushed the enhancement/11011-easy-digital-downloads-ecee-integration branch from 6e4518b to 5ee3661 Compare September 15, 2025 15:04
Copy link
Collaborator

@hussain-t hussain-t left a comment

Choose a reason for hiding this comment

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

Nice work, @abdelmalekkkkk! The changes look good. However, there are some feedback to be addressed before we merge.

We also need unit test coverage for the following methods, and we can mock the EDD methods if necessary:

  • register_hooks
  • get_enhanced_conversions_data_from_session
  • extract_user_data_from_session

Comment on lines 102 to 104
if ( ! edd_is_success_page() ) {
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we check if the function exists?

Suggested change
if ( ! edd_is_success_page() ) {
return;
}
if ( ! function_exists( 'edd_is_success_page' ) || ! edd_is_success_page() ) {
return;
}

return;
}

$purchase_session = edd_get_purchase_session();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. Let's check if the function exists.

Suggested change
$purchase_session = edd_get_purchase_session();
if ( ! function_exists( 'edd_get_purchase_session' ) ) {
return;
}
$purchase_session = edd_get_purchase_session();

*
* @return array
*/
protected function get_enhanced_conversions_data_from_session( $session ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
protected function get_enhanced_conversions_data_from_session( $session ) {
protected function get_enhanced_conversions_data_from_session( $session_data ) {

* @return array
*/
protected function get_enhanced_conversions_data_from_session( $session ) {
if ( ! is_array( $session ) ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if ( ! is_array( $session ) ) {
if ( ! is_array( $session_data ) ) {

return array();
}

$user_data = $this->extract_user_data_from_session( $session );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$user_data = $this->extract_user_data_from_session( $session );
$user_data = $this->extract_user_data_from_session( $session_data );

Comment on lines 206 to 208
// Attempt to get full region name.
$region = edd_get_state_name( $user_data['address']['country'], $region );
$address_data['region'] = Enhanced_Conversions::get_normalized_value( $region );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's check the edd_get_state_name function existence and have a fallback.

Suggested change
// Attempt to get full region name.
$region = edd_get_state_name( $user_data['address']['country'], $region );
$address_data['region'] = Enhanced_Conversions::get_normalized_value( $region );
// Attempt to retrieve the full region name if the EDD function exists and the country is available.
if ( function_exists( 'edd_get_state_name' ) && ! empty( $country ) ) {
$region = edd_get_state_name( $country, $region );
}
$address_data['region'] = Enhanced_Conversions::get_normalized_value( $region );

Comment on lines 162 to 175
$email = $session_info['email'] ?? $session['user_email'];
$first_name = $session_info['first_name'];
$last_name = $session_info['last_name'];

if ( isset( $session['user_info']['address'] ) ) {
$session_address = $session_info['address'];

$phone_number = $session_address['phone'];
$street = $session_address['line1'];
$city = $session_address['city'];
$region = $session_address['state'];
$postal_code = $session_address['zip'];
$country = $session_address['country'];
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The variables are declared inside the if block. This causes "Undefined array key" errors when the if condition is false.

Either we should declare the variable early, or add null coalescing (??) fallbacks when extracting user data. This would have been evident with unit test coverage.

$email      = $session_info['email'] ?? $session['user_email'] ?? '';
$first_name = $session_info['first_name'] ?? '';
$last_name  = $session_info['last_name'] ?? '';
...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I tried adding null coalescing to all the variables at first but that increased the class complexity. I went with another (slightly more verbose) approach and just verify the existence (!empty) of every item in the $session_data array.

* @var Easy_Digital_Downloads
*/
private $contactform;
private $edd;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add unit test coverage for other methods as well?

@abdelmalekkkkk
Copy link
Collaborator Author

Thanks for the review @hussain-t. I addressed your comments and improved the EDD class coverage. Please take another look.

@abdelmalekkkkk
Copy link
Collaborator Author

The pipeline failures seem unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants