Skip to content

Match the plans manager to the WooCommerce Subscriptions global plans UI#16

Draft
vbelolapotkov wants to merge 11 commits into
trunkfrom
update/plans-ui-canonical-parity
Draft

Match the plans manager to the WooCommerce Subscriptions global plans UI#16
vbelolapotkov wants to merge 11 commits into
trunkfrom
update/plans-ui-canonical-parity

Conversation

@vbelolapotkov

Copy link
Copy Markdown
Contributor

Aligns the storewide plans manager (WooCommerce > Settings > Subscriptions) with the WooCommerce Subscriptions 9.x global-plans UI patterns, and hardens the data path it sits on.

Part of WOOSUBS-1796.

List

  • Drag-handle grip column with visible affordance; HTML5 drag-and-drop reorder plus keyboard-accessible Move up / Move down row actions
  • Plain uppercase column headers; persistent kebab row actions (no hover-revealed icons, no sticky column)
  • New Expiration column ("5 payments" / em dash)
  • Currency-aware discount formatting from store settings ("14%", "$10.00", scope suffix); em dashes for empty values
  • Search box, filters, view-config, and pagination removed (storewide plans are a short list); fetches up to 100 plans by sort order
  • Status column and archive/restore stay (deliberate divergence: this UI supports deprecating plans without deleting them)

Modal

  • Per-field uppercase labels replace the old section headers; intro sentence and per-field helper texts
  • Frequency as number stepper + unit select; discount value input with %/$ affix that follows the pricing type
  • "Applies to" (all / first / first N cycles) restyled to the same label+control pattern; "Expire subscription after a set number of payments" reveals a Total number of payments stepper
  • Name and description inputs removed: plan names are derived from the billing frequency ("1 month", "2 weeks"), matching the list column exactly

Accessibility

  • Validation errors are tied to their inputs (aria-invalid + aria-describedby); help text renders outside InputControl, which otherwise replaces external describedby ids when help is set
  • Grip column announces "Reorder" with a hint pointing to the Move up / Move down actions instead of advertising a mouse-only drag
  • Discount input carries its unit in the accessible name ("Discount (%)" / "Discount (USD)")

New copy to review

  • Discounted-cycles field label: "Number of discounted payments", help: "How many payments the discount applies to, starting with the first payment."

Testing

  • npm install && npm run build:scripts, then npm run test:js (36 tests incl. new formatter, derivation-guard, and error-rendering component suites) and composer test:integration against wp-env
  • Manual: create/edit/archive/restore/reorder plans under WooCommerce > Settings > Subscriptions; please hand-check the drag gesture and compare against a WooCommerce Subscriptions 9.x global plans screen

🤖 Generated with Claude Code

List: grip drag-handle column, plain headers, kebab-only row actions,
expiration column, currency-aware discount formatting, no search or
pagination chrome. Modal: per-field labels replacing section headers,
canonical helper texts, value-first discount input with currency affix,
revealed total-payments and discounted-cycles steppers. Plan names are
derived from the billing frequency; the name and description inputs are
removed.
Validation errors are now associated with their inputs (aria-invalid +
aria-describedby, with help text rendered outside InputControl since it
replaces external describedby ids when help is set). The reorder grip
column stops advertising an inoperable drag to screen readers and hints
at the Move up / Move down row actions instead. The discount input
carries its unit in the accessible name. Frequency labels and derived
plan names always include the interval (1 month, 2 weeks). Adds
component tests for error rendering and derivation-guard cases.
React.act is test-only and not re-exported by wordpress/element; react
itself comes from the wordpress/scripts jest environment, so declaring
it as a dependency would only risk version skew.
Drop the Card wrapper so the table sits flush in the settings column,
use the default DataViews density (12px cells, 57px rows), remove the
stale per-cell content padding left over from the title-column layout,
align the first column at 24px, and lighten row separators to gray-100.
The released global-plans UI gives its table wrapper a white background;
without the removed Card the transparent DataViews table sat directly on
the gray admin background.
DataViews re-creates its row elements after this component's effects run
(it defers data rendering internally), so the per-row draggable
attributes and listeners silently disappeared and a drag could never
start. The wrapper now carries one set of delegated drag listeners and a
MutationObserver re-stamps the rows whenever DataViews swaps them.
Reordering follows the released implementation: a local optimistic copy
reorders live on dragover and commits once on dragend, with the moved
row dimmed. Also collapses the DataViews 15ch content minimum on the
icon-only grip column.
Replace the per-row hidden hint text with an aria-label on the grip
handle - hidden text inside the row rendered unclipped in the browser
drag ghost, turning the drag preview into a large blob. Dim and tint the
dragged row like the released UI. Lift DataViews' 15ch per-cell minimum
so columns share the available width on narrower screens. Rename the
footer button to Add subscription plan. Also reference MutationObserver
via window for the linter.
The Add subscription plan button now sits inside the same white panel
as the table, in a padded footer like the released UI, and the actions
column drops its DataViews-supplied background so the whole row tints
uniformly while dragged.
Validation errors now appear when a field loses focus and clear as the
value changes, matching the released plan editor, with its error copy
(Discount cannot be negative. / Percentage discount cannot exceed
100%.). Success and error notifications dispatch to the notices store
as snackbars - rendered bottom-left by the WooCommerce admin layout -
including a new confirmation when plans are reordered. The inline
notice stays only for list-load failures.
The previous lockfile update was written by a newer npm and left
entries npm 10 (used in CI) requires, failing npm ci with EUSAGE.
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.

1 participant