Skip to content

Enhancement/12551 top earning#13035

Open
zutigrm wants to merge 27 commits into
developfrom
enhancement/12551-top-earning
Open

Enhancement/12551 top earning#13035
zutigrm wants to merge 27 commits into
developfrom
enhancement/12551-top-earning

Conversation

@zutigrm

@zutigrm zutigrm commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

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.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 This comment is automatically updated by CI workflows. Each section is managed independently.

📚 Storybook for 334c5b8:

📦 Build files for 334c5b8:

🎭 Playwright reports for 334c5b8:

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 3.62 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 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 42.9 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 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 6.01 kB 0 B
dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 5.21 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 6.02 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 5.21 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 0 B 0 B 🆕
dist/assets/blocks/sign-in-with-google/index.js 18.5 kB 0 B
dist/assets/css/googlesitekit-admin-css-********************.min.css 72.8 kB 0 B
dist/assets/css/googlesitekit-adminbar-css-********************.min.css 12.7 kB 0 B
dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 851 B 0 B
dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 9.09 kB 0 B
dist/assets/js/146-********************.js 969 B 0 B
dist/assets/js/201-********************.js 3 kB 0 B
dist/assets/js/273-********************.js 52.7 kB 0 B
dist/assets/js/314-********************.js 101 kB 0 B
dist/assets/js/315-********************.js 3.08 kB 0 B
dist/assets/js/379-********************.js 3.84 kB 0 B
dist/assets/js/397-********************.js 477 kB 0 B
dist/assets/js/590-********************.js 2.26 kB 0 B
dist/assets/js/640-********************.js 2.41 kB 0 B
dist/assets/js/909-********************.js 1.03 kB 0 B
dist/assets/js/analytics-advanced-tracking-********************.js 404 B 0 B
dist/assets/js/googlesitekit-activation-********************.js 27.3 kB 0 B
dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 65.6 kB 0 B
dist/assets/js/googlesitekit-admin-pointers-tracking-********************.js 5.37 kB 0 B
dist/assets/js/googlesitekit-adminbar-********************.js 41 kB 0 B
dist/assets/js/googlesitekit-api-********************.js 8.04 kB 0 B
dist/assets/js/googlesitekit-block-tracking-********************.js 5.56 kB 0 B
dist/assets/js/googlesitekit-components-********************.js 6.28 kB 0 B
dist/assets/js/googlesitekit-consent-mode-********************.js 26 kB 0 B
dist/assets/js/googlesitekit-data-********************.js 1.83 kB 0 B
dist/assets/js/googlesitekit-datastore-forms-********************.js 7.21 kB 0 B
dist/assets/js/googlesitekit-datastore-location-********************.js 1.6 kB 0 B
dist/assets/js/googlesitekit-datastore-pdf-********************.js 1.2 kB 0 B
dist/assets/js/googlesitekit-datastore-site-********************.js 19 kB 0 B
dist/assets/js/googlesitekit-datastore-ui-********************.js 7.37 kB 0 B
dist/assets/js/googlesitekit-datastore-user-********************.js 23.7 kB 0 B
dist/assets/js/googlesitekit-entity-dashboard-********************.js 79.5 kB 0 B
dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 2.35 kB 0 B
dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 1.12 kB 0 B
dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 2.34 kB 0 B
dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 2.3 kB 0 B
dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 2.22 kB 0 B
dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 2.44 kB 0 B
dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 1.08 kB 0 B
dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 2.44 kB 0 B
dist/assets/js/googlesitekit-i18n-********************.js 4.43 kB 0 B
dist/assets/js/googlesitekit-key-metrics-setup-********************.js 59.6 kB 0 B
dist/assets/js/googlesitekit-main-dashboard-********************.js 218 kB +28 B (+0.01%)
dist/assets/js/googlesitekit-metric-selection-********************.js 64.7 kB 0 B
dist/assets/js/googlesitekit-modules-********************.js 27.9 kB 0 B
dist/assets/js/googlesitekit-modules-ads-********************.js 49.7 kB 0 B
dist/assets/js/googlesitekit-modules-adsense-********************.js 159 kB +436 B (+0.27%)
dist/assets/js/googlesitekit-modules-analytics-4-********************.js 250 kB 0 B
dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 27.3 kB 0 B
dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 55.2 kB 0 B
dist/assets/js/googlesitekit-modules-search-console-********************.js 75.1 kB 0 B
dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 35.1 kB 0 B
dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32 kB 0 B
dist/assets/js/googlesitekit-notifications-********************.js 75.3 kB 0 B
dist/assets/js/googlesitekit-polyfills-********************.js 228 B 0 B
dist/assets/js/googlesitekit-settings-********************.js 167 kB 0 B
dist/assets/js/googlesitekit-splash-********************.js 90.6 kB 0 B
dist/assets/js/googlesitekit-user-input-********************.js 56.9 kB 0 B
dist/assets/js/googlesitekit-vendor-********************.js 791 kB 0 B
dist/assets/js/googlesitekit-vendor-lazy-pdf-********************.js 13.4 kB +226 B (+1.72%)
dist/assets/js/googlesitekit-widgets-********************.js 132 kB +23 B (+0.02%)
dist/assets/js/googlesitekit-wp-dashboard-********************.js 68.6 kB 0 B
dist/assets/js/runtime-********************.js 1.95 kB 0 B
dist/assets/js/sign-in-with-google-********************.js 1.14 kB 0 B

compressed-size-action

@tofumatt tofumatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left some questions and comments here; everything largely looks good but I think there's some improvements to be made before we merge this. Please let me know what you think 🙂

);
} );

it( 'selects a widget whose eligibility resolves after the initial seeding, without re-seeding deselected ones', async () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is "seeding" in this context, I don't understand. 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was refering to the initially loaded/available widget, I updated it to be more clear

Comment on lines +251 to +252
// A widget gated on a store value that is not available when the panel
// opens, like a `pdf.isActive` that reads a not-yet-resolved setting.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please don't use the word "gated"; it's the kind of language an LLM will generate but isn't as human-readable as something like: "A widget that appears when the panel opens."

I'm not sure what "like a pdf.isActive that reads a not-yet-resolved setting." means. Can you clarify this whole comment?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. I expanded on all referenced comments so it is more clear


openPanel();

// The initial seeding runs with the gated widget still ineligible.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See above re: "seeding" and "gated".

Ineligible to what?

queryByRole( 'checkbox', { name: /^Revenue$/ } )
).not.toBeInTheDocument();

// The user deselects a seeded widget before the gate resolves.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this something like?

		// The user deselects a widget with populated data before the check (to what?) resolves.

registry.dispatch( CORE_UI ).setValue( 'adSenseLinked', true );
} );

// The late widget appears checked; the deselected one is not re-seeded.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is the widget late for? 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was refering to newly appeared widget/the one that doesn't show immediately. I clarified this and other comments with more details

const topEarningGetData = jest.fn( () =>
Promise.resolve( { data: null } )
);
// The Top earning pages widget gates PDF inclusion on the AdSense link,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again: please don't use "gates" or "gated" as verbs. They're very specific to LLM-generated text and overly technical.

function provideReports( {
main = MAIN_REPORT,
titles = TITLES_REPORT,
}: { main?: unknown; titles?: unknown } = {} ) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are these unknown? Surely we know the types if we have defaults. 🤔

import { MODULES_ADSENSE } from '@/js/modules/adsense/datastore/constants';
import getPDFData from './getPDFData';

type Registry = WPDataRegistry & GetPDFDataParams[ 'registry' ];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's with the GetPDFDataParams type here? It seems to include its own registry prop, this is a confusing type…

If we can't use the regular registry type here we should document why, but this seems wrong.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

GetPDFDataParams['registry'] is just the registry getPDFData expects - a normal registry plus resolveSelect (which the loader calls but isn't in the upstream WPDataRegistry type). WPDataRegistry & on top was excessive, I simplified it and added a note on why the regular type doesn't work on its own:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file is named reportOptions.ts but it exports a single function: getTopEarningPagesReportOptions.

Why not call it getTopEarningPagesReportOptions.ts? 🤔

Comment on lines +37 to +42
/** Report rows, the currency code, and the page titles, or `null` when cancelled. */
data: {
rows: ReportRow[];
currencyCode: string;
titles: Record< string, string >;
} | null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems odd to return this in a data attribute; why not just return each property in an object directly rather than as an object inside this single property? 🤔

@zutigrm zutigrm Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Every PDF widget's getData has to return an object shaped { data, chartImages? } - that's the return type of getData in the WidgetPDFConfig interface (assets/js/googlesitekit/widgets/types.ts). It's not something specific to this widget; it's the contract all the PDF loaders share.

In PDFExportOrchestrator.tsx, after it calls getData, it reaches into the result and pulls result.data out to pass down to the widget's Component as its data prop (alongside chartImages):

I updated this to split the types so the nesting isn't confusing

@zutigrm

zutigrm commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @tofumatt PR udpated.

E2E is failing for unrelated flakiness

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