IWSN: "Połącz z IWSN" — a person of Intecion connects the site (contract 1.8.0)

- the state block on the e-mail tab (method IWSN): the button while the service offers the confirmation page
  (connectAvailable) or before the site has enrolled; a click asks the site's server for the link
  (POST /api/iapl/mail-relay/connect-link, admin only), which asks the service (POST /v1/connect, enrolling first),
  checks that it begins with the service's own {base}/connect?, and hands it over without storing or logging it;
  the browser opens it in a new tab with noopener noreferrer; the block asks /v1/status every 5 s for 10 min
- states: waiting for confirmation (button), waiting for approval (no page), connected, stopped; 503
  connect-unavailable and 429 said in the admin's language; a load of the panel asks the service while the site waits
- dashboard alert for a waiting site (live); doctor mail-relay-connect (error) — replaces the pending warning and the
  "not enrolled yet" note of mail-relay-state
- opt-out mail.relay.connectButton: false (no button, no route); building blocks requestRelayConnectLink,
  isRelayConnectUrl, RELAY_CONNECT_LINK_PATH; the fake service implements /v1/connect, connectAvailable and
  confirmConnect
- contract copy 1.8.0 (IWDL working tree, checksums match); docs, AGENT.md, setup / upgrade / debug skills, changelog

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 21:42:23 +01:00
co-authored by Claude Opus 5.5
parent 347e3bafa1
commit 2c0262367d
41 changed files with 1113 additions and 57 deletions
+29
View File
@@ -14,6 +14,35 @@ once there are more than 20.
This heading and the 1.17.2 section below (never released on its own) become one 1.18.0 entry at release. Read every
"what changes for an existing site" list: the one here and the one in each subsection.
### IWSN: "Połącz z IWSN" — a person of Intecion connects the site (docs/email.md, contract 1.8.0)
> **What changes for an existing site:** nothing for a site whose "Sending method" is SMTP or Microsoft Graph, and
> nothing for a site already active on IWSN. A site on IWSN that is new or still waits now shows **"Połącz z IWSN"**
> on Site integrations → E-mail sending: pressing it opens the service's confirmation page in a new tab, where a
> person of Intecion signs in with an `@intecion.com` address and presses "Potwierdź"; the panel then shows
> "Connected to IWSN" by itself. Until then the site's e-mails are refused (`relay-pending`), the dashboard alert says
> so, and `iapl-doctor --deep` reports an **error** (`mail-relay-connect`). No schema change, no import-map change.
- **The button** (state block on the e-mail tab, method IWSN): shown while the service offers the confirmation page
(`connectAvailable` in `/v1/status`) or before the site has enrolled. A click asks the site's server for the link
(`POST /api/iapl/mail-relay/connect-link`, admin only, enrolling first when there is no token); the server asks the
service (`POST /v1/connect`), checks that the link begins with the service's own `{base}/connect?`, and hands it
over without storing or logging it; the browser opens it with `noopener noreferrer`. The panel then asks
`/v1/status` every 5 seconds for at most 10 minutes; every load of the panel asks too while the site waits.
- **States shown:** "Waiting for confirmation" (with the button), "waiting for approval" (no button: no confirmation
page), "Connected to IWSN", stopped. "The confirmation page is not available now" for `503 connect-unavailable`; a
wait in minutes for more than 10 links an hour.
- **Dashboard alert** for a waiting site (live, no call to the service); the text of `relay-pending` now speaks of
confirmation.
- **Doctor:** `mail-relay-connect` (error, deep) — the method is IWSN and the site is not connected or not confirmed.
`mail-relay-state` no longer reports "waiting for approval" (warning) or "not enrolled yet" (info): both are this error.
- **Opt-out:** `mail: { relay: { connectButton: false } }` — no button, no route.
- **Building blocks:** `requestRelayConnectLink(payload, options?)` (`ConnectLinkResult`), `isRelayConnectUrl(url, base)`,
`RELAY_CONNECT_LINK_PATH`, `RelayStatus.connectAvailable`; `relayPanelEndpoints(own, { connectLink })`. The stand-in:
`createFakeRelay({ connect: 'available' | 'unavailable' })`, `relay.confirmConnect(connectUrl)`, `connectAvailable` in
its `/v1/status`, `/v1/connect`.
- The contract copy is 1.8.0 (`RELAY_CONTRACT_VERSION`); additive, every other route unchanged.
### Two-step verification: the first set-up is confirmed by e-mail (docs/security.md)
> **Read before upgrading — what changes for an existing site, most important first:**