Premium Analytics: add the fields package for widget DataForm controls#49575
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
dcde93f to
e6bf2e5
Compare
642e5e7 to
5263046
Compare
5263046 to
6fe4a4d
Compare
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
New internal packages/fields package holding custom DataForm field controls for dashboard widgets, starting with ReportParamsField (the date-range/comparison editor, moved from the widgets-toolkit port). The package declares wpScriptModuleExports, which is the point: widget *metadata* modules (widget.ts) are built without style plugins, so a styled editor cannot be bundled into them — but an import from this package is externalized to a registered script module that is built in its own pipeline (Phase-1 transpile compiles the CSS-module graph via the style runtime). Widget metadata carries only a module dependency, resolved at runtime through the page import map, and one shared copy of the controls serves every widget on the page. Completes the parent-manifest link: entries (data, routing, fields) the fields module's bundle resolves through, per the #49189 mechanism. The widgets-toolkit copy of the field is left in place for now; it is deleted when the toolkit dissolves (widgets consume this package instead).
6fe4a4d to
6554cb4
Compare
chihsuan
left a comment
There was a problem hiding this comment.
Looks good — clean packaging move 🚢
|
closing and reopening because CI checks seem stalled. |
With #49575 in trunk, the reportParams attribute gains its real editor: ReportParamsField from @jetpack-premium-analytics/fields, externalized as a script-module dependency so the styled date-picker graph never enters the metadata module's style-less build.
This is part of the analytics updates work that is happening
Proposed changes
Note
This internal package should become irrelevant in follow-ups by moving towards native (if/when updated) Data Form fields. However, this initial implementation exists to unblock current work on porting the existing WooCommerce Analytics work over to the new analytics dasboard.
Adds the internal
packages/fieldspackage: custom DataForm field controls for dashboard widgets, starting withReportParamsField— the date-range/comparison editor (fullDateFiltersPaneldate picker), moved from the widgets-toolkit port.Why a separate script-module package: widget metadata modules (
widget.ts) declare attribute editors as dataviewsEditcomponents, but wp-build's widget metadata pipeline has no style plugins — a styled editor's.module.scssgraph cannot be bundled there (No loader is configured for ".scss" files). This package declareswpScriptModuleExports, so:build-module/output;widget.tsimport of@jetpack-premium-analytics/fieldsis externalized — the metadata bundle carries only a module dependency, resolved at runtime through the page import map.One shared copy of the controls serves every widget on the page, instead of each metadata module bundling its own editor.
Also completes the parent-manifest
link:entries (data,routing,fields) that the fields module's bundle resolves through (#49189 mechanism), and extends the existing ui-package lint override topackages/fields(same upstream code style).The widgets-toolkit copy of the field stays for now; it gets deleted when the toolkit dissolves and widgets consume this package instead.
Stacked on the ui script-module PR (base of this PR) — the field's
DateFiltersPanelimport externalizes to the ui module.Related product discussion/links
Rangeattribute editor in a follow-up commit there once this lands.try/wooa7s-1460-widget-inline-report-params-field.Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm --filter @automattic/jetpack-premium-analytics build— Phase 2 reports✔ Bundled fieldsand✔ Bundled ui;build/modules/fields/index.min.asset.phplists@jetpack-premium-analytics/uias a static module dependency.pnpm --filter @automattic/jetpack-premium-analytics typecheckand eslint onpackages/fields/**— clean.