Docs: reconcile agent, developer and module docs with the code
- AGENT.md, skills, PROGRAMISTA, vibe, README and module pages checked against src/ and package.json; every mismatch fixed (consent/analytics loading, revalidation scope, generateStaticParams, construction gating, Turnstile fail modes, email/Graph, MCP, i18n, links, slug, hooks, ...) - New pages: frontend.md, media.md, integrations.md; docs/README.md now indexes every page - Main rule (plugin helps, never limits) at the top of AGENT.md, PROGRAMISTA.md, docs/README.md, README and the setup/plugin-gap skills; module pages gain a "Wyłączenie, nadpisanie, rozszerzenie" section - README/PROGRAMISTA: stop telling projects to install packages ipal-kit already depends on; peer table; publish flow matches prepublishOnly - ipal-skills: refuse --dest without a value or pointing at the project root (previously could delete ipal-* folders in cwd) - docsConsistency: option keys, IPAL_* env names, relative links, README index, AGENT.md section refs, skill frontmatter, frontend.md helper keys, no `pnpm add` of own dependencies Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
12fbd424a5
commit
6e0f59c62b
@@ -0,0 +1,77 @@
|
||||
# integrations — global Site Integrations i status integracji w panelu
|
||||
|
||||
Klucze usług zewnętrznych edytowane w panelu oraz informacja dla redaktora, że któraś z nich
|
||||
przestała działać — bez cronów i pollingu: status zapisuje serwer, gdy faktycznie używa integracji.
|
||||
|
||||
Powiązane: [email.md](./email.md) (SMTP/Graph), [turnstile.md](./turnstile.md),
|
||||
[analytics.md](./analytics.md), [seo.md](./seo.md) (IndexNow), [deployment.md](./deployment.md).
|
||||
|
||||
## Global `site-integrations` (panel: Settings → Site Integrations)
|
||||
|
||||
Dodawany przez plugin zawsze. Zakładki (nienazwane — dane płaskie, np. `ga4MeasurementId`):
|
||||
|
||||
| Zakładka | Pola |
|
||||
|---|---|
|
||||
| Analytics | `ga4MeasurementId`, `gtmContainerId`, `metaPixelId`, `clarityProjectId`, `linkedInPartnerId`, `tiktokPixelId` |
|
||||
| Turnstile | `turnstileSiteKey`, `turnstileSecretKey`, ukryty `turnstileStatus` + baner |
|
||||
| SMTP | `emailTransport` (`smtp` / `graph`), `smtpHost`, `smtpPort`, `smtpUser`, `smtpPassword`, `smtpFromAddress`, `smtpFromName`, przycisk testu, ukryty `emailStatus` + baner |
|
||||
| IndexNow | `indexNowKey` (generowany przy pierwszym zapisie) |
|
||||
| Custom | pola z opcji `integrationsFields` — tylko gdy podane |
|
||||
|
||||
Dostęp: odczyt i zapis tylko dla roli `admin` (sekrety) — anonimowi i redaktorzy nie dostaną nic
|
||||
przez REST/GraphQL. Po stronie serwera czytaj przez Local API:
|
||||
|
||||
```ts
|
||||
import { getSiteIntegrations } from '@intecion/ipal-kit'
|
||||
const integrations = await getSiteIntegrations<SiteIntegration>(payload) // overrideAccess — nie wysyłaj całości do przeglądarki
|
||||
```
|
||||
|
||||
Przycisk „Send test” (SMTP) woła `POST /api/ipal/test-email` (endpoint dodawany zawsze).
|
||||
|
||||
## Status integracji — alert na dashboardzie i baner na zakładce
|
||||
|
||||
- **Zapis:** `mailAdapter()` przy każdej wysyłce (`emailStatus`) i weryfikacja Turnstile przy
|
||||
formularzu (`turnstileStatus`) wołają `recordIntegrationStatus`. Zapis tylko przy zmianie stanu
|
||||
albo co najwyżej co 10 min, gdy błąd trwa; nigdy nie rzuca wyjątku.
|
||||
- **Zmiana kluczy w panelu** (Turnstile, `emailTransport` / `smtp*`) czyści stary status tej integracji.
|
||||
- **`IntegrationAlerts`** (`@intecion/ipal-kit/admin`) — plugin wpina go zawsze w
|
||||
`admin.components.beforeDashboard`: lista integracji w stanie `degraded` + problemy z kluczami
|
||||
Turnstile + link „Open Site Integrations” (z `adminRoute`). Gdy wszystko działa — nic nie renderuje.
|
||||
- **`IntegrationStatusBanner`** (`/admin`) — baner na zakładce: czerwony przy błędzie (komunikat,
|
||||
kod, od kiedy), zielona linia po naprawie, nic przed pierwszym użyciem.
|
||||
|
||||
## Klocki do własnych integracji
|
||||
|
||||
Ten sam mechanizm dla integracji projektu (pola przez `integrationsFields`):
|
||||
|
||||
```ts
|
||||
import { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from '@intecion/ipal-kit'
|
||||
|
||||
ipalKit({
|
||||
integrationsFields: [
|
||||
buildIntegrationStatusBanner('crmStatus', 'CRM'), // pole UI `crmStatusBanner`
|
||||
{ name: 'crmApiKey', type: 'text' },
|
||||
buildIntegrationStatusField('crmStatus'), // ukryta grupa: state, code, message, since, checkedAt
|
||||
],
|
||||
})
|
||||
|
||||
// po wywołaniu CRM (previous = aktualny crmStatus z getSiteIntegrations)
|
||||
await recordIntegrationStatus(payload, 'crmStatus', previous, { state: 'degraded', code: 'http-500', message: 'CRM is down' })
|
||||
await recordIntegrationStatus(payload, 'crmStatus', previous, { state: 'ok' })
|
||||
```
|
||||
|
||||
Po dodaniu banera: `pnpm payload generate:importmap`; Postgres: `migrate:create`.
|
||||
|
||||
Typy: `IntegrationState` (`'ok' | 'degraded'`), `IntegrationStatus`. Dashboardowy
|
||||
`IntegrationAlerts` sprawdza domyślnie tylko `emailStatus` i `turnstileStatus` (prop `checks`) —
|
||||
własną integrację pokażesz, wpinając drugi `IntegrationAlerts` z `checks: { crmStatus: 'CRM' }`
|
||||
w `beforeDashboard`.
|
||||
|
||||
## Wyłącz / nadpisz
|
||||
|
||||
- Global `site-integrations`, endpoint `/api/ipal/test-email` i `IntegrationAlerts` na dashboardzie
|
||||
są **obecnie zawsze dodawane** — nie ma opcji, żeby je wyłączyć. Obejście: plugin projektu
|
||||
wpięty po `ipalKit()`, który usuwa / podmienia wpis w `config.globals`, `config.endpoints` albo
|
||||
`admin.components.beforeDashboard`.
|
||||
- Rozszerzenie: `integrationsFields` (zakładka Custom). Zakładek, dostępu i etykiet pluginu nie da
|
||||
się obecnie nadpisać opcją.
|
||||
Reference in New Issue
Block a user