ProductDoctor: Reassure users about what was just verified, given the active stock availability mode#6546
Conversation
…availability mode
🦋 Changeset detectedLatest commit: 419353a The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## fix/new-availability-logic #6546 +/- ##
==============================================================
+ Coverage 48.63% 48.65% +0.02%
==============================================================
Files 2591 2591
Lines 46143 46153 +10
Branches 10598 10882 +284
==============================================================
+ Hits 22441 22456 +15
+ Misses 23322 23316 -6
- Partials 380 381 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends ProductDoctor’s availability diagnostics and public API verification UI to be aware of Saleor’s stock availability mode (Shop.useLegacyShippingZoneStockAvailability, Saleor 3.23+), so diagnostics severity/copy and the verification reassurance are unambiguous in both legacy (shipping-zone-gated) and direct (warehouse↔channel-gated) modes.
Changes:
- Extend the diagnostics GraphQL query + hook result to include
useLegacyShippingZoneStockAvailability, and thread it into availability checks and UI. - Adjust shipping/warehouse diagnostics behavior and copy based on the active mode; add a new “stock outside channel warehouses” advisory.
- Update ProductDoctor UI to (a) avoid promoting info-level advisories to “Issues” in channel headers and (b) show mode-aware reassurance under the public API verification badge; add UI tests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/products/queries.ts | Adds shop.useLegacyShippingZoneStockAvailability to diagnostics query. |
| src/products/components/ProductDoctor/utils/types.ts | Extends DiagnosticsResult with the mode flag for UI consumers. |
| src/products/components/ProductDoctor/utils/availabilityChecks.ts | Adds mode-aware logic for shipping/warehouse checks and a new “stock outside channel warehouses” info check. |
| src/products/components/ProductDoctor/utils/availabilityChecks.test.ts | Adds/updates test coverage for mode-specific behavior and new check. |
| src/products/components/ProductDoctor/primitives.tsx | Adds test IDs/attrs to IssueBadge. |
| src/products/components/ProductDoctor/messages.ts | Updates/extends i18n strings for mode-aware copy and reassurance. |
| src/products/components/ProductDoctor/hooks/useProductAvailabilityDiagnostics.ts | Plumbs the mode flag from query → checks → hook result. |
| src/products/components/ProductDoctor/hooks/useProductAvailabilityDiagnostics.test.tsx | Tests the mode-flag plumbing and fallback behavior. |
| src/products/components/ProductDoctor/AvailabilityChannelItem.tsx | Treats info issues as non-blocking for header state; adds mode-aware verification badge props and info visuals. |
| src/products/components/ProductDoctor/AvailabilityCard.tsx | Adds a stock-availability mode indicator + mode-aware reassurance line rendering; refactors badge rendering. |
| src/products/components/ProductDoctor/AvailabilityCard.test.tsx | Adds UI tests for mode indicator, severity gating, and reassurance text. |
| src/graphql/types.generated.ts | Regenerates types for the updated diagnostics query. |
| src/graphql/hooks.generated.ts | Regenerates query document for the updated diagnostics query. |
| locale/defaultMessages.json | Adds/removes message IDs to match updated i18n messages. |
| .changeset/tender-impalas-tickle.md | Patch changeset for adding mode support. |
| .changeset/curly-doves-dance.md | Patch changeset for UI reassurance + copy tightening. |
Comments suppressed due to low confidence (1)
src/products/components/ProductDoctor/AvailabilityCard.tsx:466
StockAvailabilityModeIndicatoruses a plain<Box>as theTooltip.Trigger, which is not keyboard-focusable by default. To keep the tooltip accessible (keyboard + screen readers), consider rendering the trigger as a semantic button (e.g.as="button",type="button") and adding anaria-label(there are several examples in the codebase such asSearchTooltip).
<Tooltip>
<Tooltip.Trigger>
<Box
display="flex"
alignItems="center"
gap={2}
__cursor="help"
data-test-id="stock-availability-mode-indicator"
data-test-mode={useLegacyShippingZoneStockAvailability ? "legacy" : "direct"}
>
<Layers size={14} color="var(--mu-colors-text-default2)" />
<Text size={2} color="default2">
{intl.formatMessage(labelMessage)}
</Text>
</Box>
Builds on #6545 Adds a mode-aware reassurance line under the verification badge so "Purchasable" unambiguously reflects the shop's stock-availability mode. Tightens noWarehouses / warehouseNotInZone descriptions that became misleading after #6545