Skip to main content
The wizard lives in frontend/portal-customer. It is a thin client: the backend decides the step, and the portal renders it and sends the customer’s input.

Route and orchestrator

There is a single route, /{locale}/contract/{contractId}, for the five portal locales (es, en, fr, it, pt).

Boot

The session is kept in the browser tab, bound to its contract id, so a reload lands on the same step without a new link.

What the orchestrator renders

In order:
  1. An invalid contract id or a server error → Redirecting out of the wizard.
  2. A session that cannot start → Access recovery, which offers to resend the link. The screen names the reason:
  3. While booting or waiting for the first state → Validating.
  4. Otherwise, the screen for state.stage.

The ContractState

Every screen reads one object, ContractState, returned by GET /api/v3/contract/{id}/state, by POST …/sessions and inside the realtime snapshots. The portal never computes the stage itself. Stages. The account holder goes NOT_STARTED → IDENTITY → SUMMARY → PAYMENT → SIGNATURE → COMPLETED. A later company administrator goes IDENTITY → SUMMARY → SIGNATURE. The stage stays SIGNATURE while the contract is in signature, review and countersignature, and becomes COMPLETED only once the documents are sealed and the session user has a portal password. Password screen. The portal, not the stage, decides when to show it: as soon as the session user’s own seat is signed and they press Create password on the success ticket, whatever the review status. A signer who already has a password goes straight to the customer portal through the handoff. Flags. Signing status. signing.status tells the portal where the pipeline is without exposing internal statuses: NOT_REQUESTED, PREPARING, IN_PROGRESS, COMPLETED or FAILED.

Screens

Overlays available on several steps:
  • Exit, labelled Reject (contract-abandon-modal.tsx): cancels this registration as the customer. It is shown from Identity until Signature, not on Welcome or Password.
  • Back (use-contract-rewind.ts): shows Payment or Summary again from Signature, before anyone signs, and Summary from Payment (account holder). It is a local view: the backend keeps its stage, and only a confirm with a different method or period changes the contract.
The Welcome step also asks the browser for its location when the customer continues. The prompt never blocks the wizard and the result is not stored.

Realtime

The orchestrator subscribes to private-contract-{id}. In real mode the channel is authorized by horizon-api (POST /api/v3/realtime/pusher/auth); the events and their payloads are in Realtime — Channels & Events. How the portal applies them:
  • A full state replaces the cached state, keeping the visitor’s own fields (password, re-entry, own seat, contract text); a patch is merged into it. The portal never re-reads the state just because an event arrived.
  • With Pusher configured, a successful step does not move the wizard on its own: the button stays loading until the event arrives. If the event does not come within about 10 seconds, the portal applies the response it already received. A later company administrator’s identity and summary results, and a re-entry identity result, are applied right away; their summary patch is broadcast but not awaited. Without a Pusher key every step is applied right away.
  • After the socket reconnects, the portal reads GET …/state once to catch up on missed events. It does not poll while realtime is configured; without a Pusher key it polls GET …/state on the signature step.
  • While documents are PREPARING and no signature group shows up, the portal calls POST …/signature/send (it is idempotent) and offers a retry if the pipeline still does not start.
  • Back from Fintoc (?resumed=payment&enrollment=…), the payment screen stays open and waits for the enrollment event.

Mock and real modes

NEXT_PUBLIC_CONTRACT_API_MODE switches the whole wizard between two backends without touching the service layer: real is the default since 2026.11.2 and the only mode of the hosted environments, which no longer set the variable; mock is a switch for local development only. The document preview (preview.pdf) is always served by the portal itself, in both modes; mock mode does not implement signer-summary.

Code