Skip to content

components 0.5.4: document requirement components (contract request #117) and the upload review fixes - #203

Merged
joelmsanto merged 16 commits into
mainfrom
partner/document-requirement-components
Nov 4, 2026
Merged

joelmsanto merged 16 commits into
mainfrom
partner/document-requirement-components

Conversation

@joelmsanto

@joelmsanto joelmsanto commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Owner, 2026-11-03 and 2026-11-04. Version 0.5.4, unpublished.

Document requirement components (contract request #117)

Fed by a getMyStatus checklist item, so no host keeps a document type of its own.

  • Partner/DocumentRequirementCard (portable): a Paper Card with the rule's title, the host's subtitle, the photos, the note, the rule's explanation, and actions. An action is { label, onPress, isDisabled?, mode?, loading? }.
  • Partner/DocumentCaptureCard, controlled: { item, subtitle?, pages, onPagesChange, onSend, isSending }.
    • Photos only. The photo button is a text button; «Enviar a revisión» is outlined and is the only button with a border.
    • The host keeps the photos until its send succeeds.
    • Progress shows on the button (loading).
    • Notes: «Repetir» once every page is taken, and «not sent yet» while the photos are unsent.
  • Partner/DocumentCovers (internal): one cover, or a Material 3 hero carousel. Its measures are Material's (8 dp gap, 56 dp peek). It snaps natively and with CSS scroll snap on the web, shows a scroll bar on the web, keeps its place on rotation, and shows the pages side by side where they fit. Tapping a photo opens the library's DocumentViewer full screen.
  • Partner/DocumentVersionList and PartnerViewModel.documentVersionRow(s): one version row for every page that lists versions. The expiry date is formatted («Vence el 23 nov 2026», key documentExpiresOn), and the scan's label shows while the version is not clean (pending, infected).

Photo picker (ImagePicker)

  • Library: opens with no permission. Android 13+ and iOS limited access were being blocked by a permission the Photo Picker and PHPicker do not need.
  • Errors: read from errorCode. The permission alert shows only for permission errors; anything else gets the generic failure.
  • Taps: one launch at a time.
  • Web: goes straight to the library when it is the only choice.
  • captureOptions for the caller. Documents capture at maxWidth/maxHeight 5120, quality 1, assetRepresentationMode: 'compatible', conversionQuality 1:
    • PDF417 at 5 px per module over AAMVA's 0.170 mm minimum needs ≥ 3,597 px for an ID-1 card filling 70 % of the frame (ISO/IEC 15415).
    • 300 ppi over an A4 page needs ≥ 5,011 px.
    • ICAO 9303: no visible compression artefacts.
    • iOS HEIC becomes JPEG.

Translations

  • New: documentNotSent, documentExpiresOn, documentFront / documentBack.
  • Moved from the app: documentRetake.
  • Wording: «Agregar el anverso / reverso», and «Ahora toma una foto del reverso del documento».

Tests

  • Partner/__tests__/documentRequirement.test.js
  • ImagePicker/__tests__/ImagePickerAPI.test.js (new)
  • ImagePicker/__tests__/ImagePickerAvatar.test.js
  • __tests__/noLocalRedefinition.test.js
  • __tests__/portableEntry.test.js

To be published by the owner. CustomerApp then pins 0.5.4 together with partner 0.2.54 (workspaces#42).

🤖 Generated with Claude Code

Also adds contract request #118: the version row by date and state, the staff labels, and partner 0.2.54 as its peer. Published from this PR's head before merging; the merge changes no package file.

Joely and others added 16 commits November 3, 2026 11:27
…rsions and its capture, fed by the checklist item (contract request #117)

The partner's documents screens paint getMyStatus's checklist item (partner 0.2.53, K-32), so the library gets the
pieces, with no document type of their own:

- Partner/DocumentRequirementCard (portable): a Paper Card composed as Paper composes one. The title is the rule's
  name for the market, else the catalogue's (viewModel requirementTitle); the host's subtitle; a photo taken and not
  sent as the cover; what to do now and the rule's explanation; actions as Paper Buttons straight inside
  Card.Actions, which gives them their modes. Without actions it only reads (the console).
- Partner/DocumentVersionList (portable): the item's versions as ListRows from viewModel documentVersionRows (the
  verification's label or «Superseded»; when sent, in the app's locale; «Scanning»; the reason; «Expires»). They
  open nothing, so no chevron.
- Partner/DocumentCaptureCard (barrel only, the picker is native): the card with the way to send it, as
  item.capture says: one photo, or the front then the back (the front waits as the cover); «Subir un PDF» only with
  capture.pdf and an onUploadPdf.
- ImagePicker.Avatar variant="sheet": no control of its own; the caller opens the sheet with the ref's show(), so
  its own Paper Button sits in Card.Actions (owner, 2026-11-03: the card's own button). avatar and button are as
  before.
- documentAddFront, documentAddBack, documentAddBackPrompt, documentUploadPdf and documentSuperseded move here from
  the app's catalogue, same words (owner, 2026-11-03).

Stories: Partner/DocumentRequirement.stories.js, the local circuit's real items (US, US-MA). Tests: the view model,
the three components and the picker's sheet variant (14). The R1 and portable-entry guards pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng; «Send to review» does (owner, 2026-11-03)

DocumentCaptureCard keeps the pages taken (one, or the front then the back) and shows them as the card's covers.
The card's actions follow MD3 (the main action last, Card.Actions makes it contained): «Cancel» drops what was taken,
«Send to review» (the catalogue's existing `sendToReview`) hands the pages to onCapture in order. With nothing taken,
the PDF link and the add button as before.

DocumentRequirementCard takes `covers` (the photos in order) instead of one `cover`. Stories: the front waiting for
the back, and both sides ready to send. Tests: one page, two sides, cancel at each step, the PDF, sending disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds nothing; «Send to review» does»

Owner, 2026-11-04: picking the photo from the device sends it, as before (the licence sends after its back).

This reverts commit 403c1b0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no PDF (owner, 2026-11-04)

DocumentCaptureCard drops onUploadPdf and its «Upload a PDF» action, the ActingAsNoPdf story goes, and
documentUploadPdf leaves the catalogues (the card was its only reader here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e photo button stays (owner, 2026-11-04)

DocumentCaptureCard: taking a photo sends nothing; the pages show as the card's covers (DocumentRequirementCard
`covers`, back from 403c1b0). Its actions are always the photo button (outlined) and «Send to review» (contained,
last per MD3, disabled until every page is taken). A photo taken once every page is there starts the document
again, which is how a wrong one is replaced. No «Cancel», no PDF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3 carousel (owner, 2026-11-04)

DocumentCovers (new, portable, not exported): one photo is the card's cover; more are a hero carousel, a horizontal
ScrollView that snaps item by item (snapToInterval on iOS/Android, pagingEnabled's CSS scroll snap on the web, the one
snapping prop react-native-web implements), items spacing.x2 apart and the next peeking spacing.x14: Material's 8 dp
and 56 dp (material-components-android carousel). Its width is measured (onLayout), not assumed.

DocumentRequirementCard: the photos move into its Card.Content, above the note and the explanation, with the space a
cover gets: Card.Content takes its top padding from a Card.Cover or Card.Title just above it, so a carousel beside it
would leave the text against the photos. `covers` are now `{ uri, label }`; each photo is an image a screen reader
names. DocumentCaptureCard names them «Front»/«Back» (documentFront/documentBack, the console's words) on a two-sided
document, else «Document».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… text button; only «Send to review» has a border (owner, 2026-11-04)

DocumentRequirementCard actions take an optional Paper Button `mode`, which Card.Actions keeps (it gives a mode only to
a child without one). DocumentCaptureCard: the photo button `text`, «Send to review» `outlined`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one version's row for every page that lists versions

documentVersionRows maps it; the documents list renders its program versions with it too, so one version reads the
same in a requirement's history and in the list (the server's values, the catalogue's labels; owner, 2026-11-04).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thout a permission, reports its errors, launches once, goes straight to the library on the web and takes the caller's capture options

- chooseFromLibrary asks for no permission: image-picker 8 opens Android's Photo Picker and iOS's PHPicker, which
  need none; asking blocked Android 13+ (READ_EXTERNAL_STORAGE is not declared) and iOS limited access.
- The picker's errorCode is read (8.x never sets `error`): the permission alert only for a permission error, the
  generic failure (global.somethingWentWrong / global.tryAgainLater) for any other; no `Alert(...)` call, no debug
  logs, no `allowsMultipleSelection`. takePhoto / chooseFromLibrary always resolve: the asset or null.
- The sheet ignores taps while a pick is in progress.
- Where the sheet would offer a single choice (the web), show() takes it.
- ImagePicker.Avatar `captureOptions` are laid over the defaults; callers that pass none behave as before.
- ImagePickerAPI tests with image-picker and permissions mocked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd its scan shows while it is not clean

- documentVersionRow formats `expires_at`, a calendar day, with the existing formatDateTime in UTC (no reader's zone
  moves it) inside the new key documentExpiresOn: «Expires %{date}» / «Vence el %{date}», the text of the app's
  partnerRequirements.expiresOn. documentExpires stays for the app's older list.
- The scan's catalogue label shows whenever the scan is not SCAN_STATUS.CLEAN (pending, and partner 0.2.54's
  infected), with no status spelled here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s its photos until the host's send succeeds, shows its progress and says what is left

- DocumentCaptureCard is controlled: `pages`, `onPagesChange(pages)`, `onSend()`, `isSending` replace `onCapture`
  and `isDisabled`. It never clears the pages; the host clears them once its send succeeded. While `isSending`
  every action is disabled and «Send to review» shows Paper Button's `loading`.
- Every document photo is taken at 5,120 px on its long side at most, quality 1, as JPEG
  (DOCUMENT_CAPTURE_OPTIONS, with the standards they come from).
- Once every page is taken the photo button reads «Retake» (`documentRetake`, moved from the app with its values),
  and the note says the photos are not sent yet (`documentNotSent`).
- DocumentRequirementCard: actions take `loading`; Card.Actions wraps through its `style` (flexWrap, a spacing.x2
  row gap); buttons are keyed by position, not by their label; the note sits in a polite live region that stays
  mounted.
- Wording: es «Agregar el anverso/reverso»; the back prompt names the document, not «tu licencia».
- Stories render DocumentCaptureCard itself with `pages` (front taken, ready to send, sending).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and the carousel keeps its place, shows its scrollbar on the web and gives way where both fit

- Tapping a photo opens the library's DocumentViewer full screen (Paper Portal + Modal, a close action with
  global.close) on that page, with the sides (the covers' labels, documentFront / documentBack) for two pages. The
  cover keeps its label and is an image button (a button with aria-label on the web).
- On the web the carousel shows its scrollbar: a mouse has no swipe.
- The item the carousel rests on is followed from the scroll position; a new width (rotation, resize) scrolls back
  to it.
- Where the measured width fits every cover at Material's largest large item (twice the cover's height) plus the
  gap, they show whole, side by side, without a carousel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one does not throw

The picker resolves after its own screen closes; by then the caller may have unmounted the sheet, so closing it is
guarded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and opens with its state, and a reviewer reads the staff's labels (contract request #118)

- documentVersionRow: the title is when it was sent; the description opens with its state, in the cause's words, as a requirement's row does.
- staffDetailsCodeLabel and staffScanLabel; the rule's clause for what the partner reads.
- The pure row tests move to their own suite, which needs no native module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s nothing of where the requirement stands

Its subtitle names the vehicle; a version's row and the requirement's list row say the state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rule clause for what the partner reads and the staff label groups are that version's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joelmsanto
joelmsanto merged commit cf906c7 into main Nov 4, 2026
1 check failed
@joelmsanto
joelmsanto deleted the partner/document-requirement-components branch November 8, 2026 18:00
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