Design system / Organisms
Organism / Intake and review
ImportMedia
ImportMedia attaches existing public S3 references to imported drafts, with separate optional availability checks.
Intent and composition
This imports-owned organism renders state and commands from useImportMedia; it does not embed transport or authorization. Select a matching exporter manifest, preview the selected job's imported source IDs, then approve its buckets and media rights. Attach is the default path: it writes database references in batches of at most 50 without contacting S3. Saved attachment evidence is restored by preview and skipped without availability checks. No files are downloaded, copied or rebuilt; WordPress-only links are excluded. Unknown sizes stay unknown. Only after every preview reference is attached can the optional check controls run. Checks contact S3 and can record known source failures without removing attachments. Neither checks nor attachment publish submissions.
Coordinated concerns: Manifest selection, job-scoped preview, bucket/rights approval, database-only attachment, optional availability checks and durable error-report feedback.
Receives state/commands from useImportMedia and disabled from its parent. The hook owns request lifecycle and cancellation; the route/domain service enforces local non-production access and job scope.
Real component specimen
Actual ImportMedia with fixed fictional saved attachments and one known optional-check failure. All operation controls are disabled. No behavior hook is mounted, no source URL is supplied and no tenant, S3 or publication operation can run.
Real component, fictional data. Product operations are not enabled.
4. Media (optional)
After importing drafts, choose the matching media manifest JSON. Its filename and collection name do not need to match your CSV. Only source IDs imported by this selected job are included.
Available with local, non-production PostgreSQL only. Attach saves the original S3 links in small database batches without contacting S3. No media is downloaded, copied or rebuilt. File sizes may be unknown. Link checking is optional and separate; WordPress-only copying is not run here.
1 unresolved media reference(s). The original manifest is unchanged.
These sources failed their last optional availability check. Their links can remain attached. Review the report; attaching or publishing does not repair an unavailable source.
- Source example-2: Fictional unavailable image.jpg
S3 returned HTTP 403; 1 attempt(s).
Read-only fictional saved state. No operations are enabled.
Supported inputs and ownership
| Input | Responsibility |
|---|---|
| state | Return value of useImportMedia. Includes manifest/region, preview, consent, attachedCount, operation/progress, results, failures and commands. The colocated hook owns asynchronous requests, aborts and checkpoints; no Context/store is used. |
| disabled | Required parent busy/dirty/run guard. Disables manifest, consent and operation controls; it is not server authorization. Availability remains local, non-production PostgreSQL only. |
| preview and approval | Preview reports included references, imported drafts, excluded links and missing manifest links. It does not prove archive completeness. File/region changes invalidate preview and approval. |
| saved progress and optional checks | Reopen the job, reselect the manifest and preview to restore saved attachments/errors. Attachment skips saved references. Check resume is local to this open session; reopening can check saved references again. Pause or hiding/leaving the page aborts in-flight work; saved batches remain. |
| errors and publication | Known optional-check errors remain visible with attempt counts and a complete downloadable report. Retry failed checks only is separate from attachment. An attached link can still be unavailable; publication is a separate ImportReview action. |
| interaction and styling | Native labelled file/region/consent controls, details disclosures, status regions and progress use existing shared controls and semantic theme classes. No new typography or theme contract is introduced. |
This is an integration summary, not a replacement for the implementation's complete prop types. A disabled control or hidden destination does not enforce permission.
Using it in a page
Integrate the section through its supported props and context requirements. Routes supply permitted data; instances bind product copy and behavior; templates arrange slots. Keep feature hooks and operations with their feature owner. Generic layouts must not load business data or enforce product policy.
Related page assemblies: Reviewed data import and optional media.
Implementation
Repository path: src/components/imports/importMedia.tsx