Skip to content

React admin scoping, WordPress Interactivity API, full WooCommerce integration + 14 audit fixes - #1

Merged
akshat009 merged 1 commit into
mainfrom
feat/react-interactivity-woocommerce
Aug 17, 2026
Merged

React admin scoping, WordPress Interactivity API, full WooCommerce integration + 14 audit fixes#1
akshat009 merged 1 commit into
mainfrom
feat/react-interactivity-woocommerce

Conversation

@akshat009

@akshat009akshat009 commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

Three rounds of work on this branch, all verified end-to-end (not just unit-tested):

1. Fixed 14 findings from a detailed audit

  • React build pipeline silently failed (missing --webpack-src-dir)
  • CI's npm ci had no lockfile to consume → npm install
  • composer.json's version field failed composer validate --strict
  • PHP 8.4 implicit-nullable deprecation in Plugin.php
  • Elementor add_action hooks moved from build_services() to boot() so a DI-injected $services array still registers them
  • get_instance() now threads its $services param through (was dead code)
  • validateNamespace allows Vendor\Plugin namespaces
  • validatePrefix rejects reserved words (wp, php, wordpress)
  • validateOutputDir allows paths outside cwd (e.g. ../sibling-plugin)
  • phpcs.xml prefix/VIP-exclude rules are now real template placeholders instead of fragile exact-string runtime patching
  • dead ternaries removed; runGenerator throws instead of process.exit
  • added .distignore template

2. React rescoped to wp-admin + new Interactivity API module

  • React admin app pipeline now targets wp-admin only (Assets.php on admin_enqueue_scripts, auto-scoped to the settings page hook suffix when admin_settings is also selected), mounting a real interactive component instead of a no-op console.log
  • New interactivity module: WordPress's native Interactivity API (data-wp-interactive directives, Script Modules) for real frontend interactivity without shipping a React runtime to visitors
  • Requires at least auto-bumps to 6.5 when this module is selected

3. WooCommerce module now scaffolds a full, working integration

  • Payment gateway (classic checkout and WooCommerce Blocks payment method registration — without this a gateway is invisible in the block-based checkout)
  • Shipping method, custom order email (with its own template files), custom product type, HPOS compatibility
  • Cart & Checkout Blocks content integration via ExperimentalOrderMeta
  • A real native Gutenberg block (assets/src/blocks/cart-summary) showing a live cart summary, auto-discovered by wp-scripts
  • webpack.config.js now correctly merges wp-scripts' lazily-computed entry function with our own explicit entries — spreading it as a plain object ({ ...defaultConfig.entry }) silently drops every auto-discovered block entry. Found and fixed during testing.
  • Requires at least auto-bumps to 6.4 (block.json render field)

Verification

  • 20 regression tests (up from 7) — all passing
  • Real php -l, composer validate --strict, composer lint (WPCS, zero errors), composer test against multiple generated fixtures
  • Real npm install && npm run build confirming the admin app, Interactivity view script, WooCommerce gateway block, Blocks integration script, and native Cart Summary block all compile together correctly

…dd Interactivity API + full WooCommerce integration
Bug fixes (all verified with real composer install/lint/test):
- React build pipeline silently failed (missing --webpack-src-dir)
- CI's npm ci had no lockfile to consume -> npm install
- composer.json version field failed composer validate --strict
- PHP 8.4 implicit-nullable deprecation in Plugin.php constructor
- Elementor add_action hooks moved from build_services() to boot() so
DI-injected still registers them
- get_instance() now threads its param through (was dead code)
- validateNamespace allows Vendor\Plugin namespaces
- validatePrefix rejects reserved words (wp, php, wordpress)
- validateOutputDir allows paths outside cwd (e.g. ../sibling-plugin)
- phpcs.xml prefix/VIP-exclude rules are now real template placeholders
instead of fragile exact-string runtime patching
- dead ternaries removed; runGenerator throws instead of process.exit
- added .distignore template
React scope correction:
- React admin app pipeline now targets wp-admin only (Assets.php on
admin_enqueue_scripts, auto-scoped to the settings page hook suffix
when admin_settings is also selected), mounting a real interactive
component instead of a no-op console.log
- new 'interactivity' module: WordPress's native Interactivity API
(data-wp-interactive directives, Script Modules) for real frontend
interactivity without shipping a React runtime to visitors
WooCommerce module now scaffolds a full, working integration:
- Payment gateway (classic checkout + WooCommerce Blocks payment method
registration, so it isn't invisible in the block-based checkout)
- Shipping method, custom order email (with its own template files),
custom product type, HPOS compatibility
- Cart & Checkout Blocks content integration via ExperimentalOrderMeta
- a real native Gutenberg block (assets/src/blocks/cart-summary) showing
a live cart summary, auto-discovered by wp-scripts
- webpack.config.js now correctly merges wp-scripts' lazily-computed
entry *function* with our own explicit entries -- spreading it as a
plain object ({ ...defaultConfig.entry }) silently drops every
auto-discovered block entry, which was caught and fixed during testing
Requires-at-least bumps automatically: 6.4 for the block.json render
field (WooCommerce module), 6.5 for the Interactivity API.
20 regression tests (up from 7), plus manual end-to-end verification:
php -l, composer validate --strict, composer lint, composer test, and
real npm install && npm run build against multiple fixture combinations.
@akshat009
akshat009 merged commit 6c0ba4a into mainAug 17, 2026
2 checks passed
@akshat009
akshat009 deleted the feat/react-interactivity-woocommerce branch August 17, 2026 14:35
akshat009 added a commit that referenced this pull request Aug 29, 2026
CI's self-consumption lint (the first run of `npm run lint:js` against a
real scaffold, added for audit #1) surfaced five ESLint/Prettier errors in
three Woo integration files that had never been linted:
- blocks/cart-summary/index.js: useBlockProps() was called from a lowercase
`edit: () => {}` arrow -> react-hooks/rules-of-hooks. Extracted a named
`Edit()` component and hoisted the placeholder string to a module const
("Cart Summary (live on the frontend)" -> "Cart summary" so the __() call
stays on one line for any realistic slug).
- blocks-integration.js: `'{{SLUG}}-order-meta'` inline in createElement
pushed the line past printWidth once the slug was substituted. Hoisted to
`const cls`.
- wc-gateway-block.js: the label fallback `__( '{{PLUGIN_NAME}}', '{{SLUG}}' )`
went over printWidth with real values (and was unescaped). Replaced with a
raw `{{PLUGIN_NAME_ESC}}` const (brand names aren't translated anyway),
dropped the now-unused `__` alias, and pre-broke the `Content` createElement
to the multi-line form Prettier wants.
Verified end to end on a regenerated all-modules+React scaffold:
lint-js / lint-style / build / test-unit-js all exit 0.
Sign up for freeto 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.

1 participant

@akshat009