diff --git a/reference/.agents/skills/ipal-form/SKILL.md b/reference/.agents/skills/ipal-form/SKILL.md index 275755d..c25aad9 100644 --- a/reference/.agents/skills/ipal-form/SKILL.md +++ b/reference/.agents/skills/ipal-form/SKILL.md @@ -103,8 +103,10 @@ Never build this by hand (your own ``, upload route or upload browser posts files to the plugin's endpoint `POST /api/ipal/forms/submit` — no route file, no `next.config` change. Classes: `file`, `help`, `fileList`, `fileItem`, `fileRemove` in `formClasses.ts`. Your own markup: `f.getFileProps(field)`, `f.getFiles(field)`, `f.removeFile(field, i)`, `f.helpId(field)`. -5. Texts: Form messages → **Files** (`fileTooLarge`, `fileType`, `fileCount`, `fileNotSent`, `fileRemove`) — - English and Polish defaults; fill every other language of the site. +5. Texts: Form messages → **Files** (`fileTooLarge`, `fileType`, `fileRefused`, `fileCount`, `fileNotSent`, + `fileOptional`, `fileRemove`) — English and Polish defaults; fill every other language of the site. Each tells + the visitor that the problem is the **file**, why, and what to do (a smaller file, another format; on an + optional field also "send the form without the file"). They show at the File field; what the visitor typed stays. 6. Mail size: **Site integrations → E-mail sending → Test e-mail** with **Attach a 10 MB test file** must arrive. SMTP: the provider's limit decides (a 10 MB server limit carries only ~7 MB of file — lower the field's maximum). Microsoft Graph: files of 3 MB and more need the `Mail.ReadWrite` permission on the agency app @@ -112,8 +114,8 @@ Never build this by hand (your own ``, upload route or upload drops to about 2.8 MB by itself. Keep Graph small on purpose: `mailAdapter({ graph: { largeAttachments: false } })`. Tell the client plainly: **there is no antivirus scan** (the e-mail says so), the macro check of old `.doc` / `.xls` -files is best-effort, and when the e-mail cannot be sent the file is gone — the visitor sees "We could not send your -file", staff get a notice without the file, and the submission shows **File delivery: Not sent**. +files is best-effort, and when the e-mail cannot be sent the file is gone — the visitor sees "We could not send the +file …" at the File field, staff get a notice without the file, and the submission shows **File delivery: Not sent**. ## 4. Page — block data once (blocks do not import `lib/*`) From `createPageRoute` (PROGRAMISTA §2.8): @@ -179,8 +181,9 @@ Details the seed already covers, which you check after every manual change in th - [ ] multi-step form: Next with an empty step → errors, the step stays; Back keeps the entered values; - [ ] form with a **File** field: a PDF arrives attached to the company e-mail, the customer e-mail has no file, the submission shows *Files* and *File delivery: Handed to the mail server*, Media has no new record; - a `.exe` renamed to `.pdf` → "…is not an accepted file type", no submission; a file over the limit → the - size message before sending; keyboard only: Tab to the field, pick a file, Tab to "Remove …", Enter removes it; + a `.exe` renamed to `.pdf` → "The file … was refused: …" at the File field, no submission, the typed answers + still there; a file over the limit → "…is too large. Choose a file of up to N MB." before sending; each + message in every language of the site; keyboard only: Tab to the field, pick a file, Tab to "Remove …", Enter removes it; - [ ] `ipal-audit --quick` → zero hardcoding in FormBlock, no copy of the form engine; - [ ] `ipal-consent-check` → still 0 violations (Turnstile is necessary, not tracking). @@ -192,7 +195,7 @@ Details the seed already covers, which you check after every manual change in th | `reason: 'validation'`, `kind: 'unknown_fields'` | the frontend sends a field the form does not have (custom renderer with an extra field, typo in `name`) | | "Next/Back" buttons in English | empty Form messages → next / back / stepOf in that language | | `reason: 'not_found'` | `formId` from another database (seeded on dev, another ID on prod) — use a relationship from the panel, not a fixed ID in code | -| "We could not send your file", submission says *Not sent* | the mail server refused the message (size limit: see the note on the submission), or Graph without `Mail.ReadWrite` and no SMTP settings → Test e-mail with the 10 MB file; lower the field's maximum or fix the transport (email.md "Attachments") | +| "We could not send the file …", submission says *Not sent* | the mail server refused the message (size limit: see the note on the submission), or Graph without `Mail.ReadWrite` and no SMTP settings → Test e-mail with the 10 MB file; lower the field's maximum or fix the transport (email.md "Attachments") | | the form with a File field cannot be saved ("Add an e-mail with a fixed recipient…") | every e-mail of the form is addressed with a placeholder → add the company notification with a fixed address | | the File field does not appear in the builder | `forms.attachments` is off, or `forms.fields.file: false` | | a file is refused although its type is ticked | the content does not match the extension, the name has a second extension (`cv.pdf.docx`), the document has macros, or it is password-protected | diff --git a/reference/src/payload-types.ts b/reference/src/payload-types.ts index c54676f..950bed2 100644 --- a/reference/src/payload-types.ts +++ b/reference/src/payload-types.ts @@ -2940,14 +2940,22 @@ export interface Notification { * Use {file} for the file name and {types} for the accepted types. */ fileType?: string | null; + /** + * For a program, an archive, macros or content that does not match; use {file} and {types}. + */ + fileRefused?: string | null; /** * Use {field} for the field label and {max} for the limit. */ fileCount?: string | null; /** - * Shown when the file could not be sent by e-mail. + * Shown when the file could not be sent by e-mail; use {file} for the file name. */ fileNotSent?: string | null; + /** + * Added to a file message when the file field is not required. + */ + fileOptional?: string | null; /** * Use {file} for the file name. */ @@ -3298,8 +3306,10 @@ export interface NotificationsSelect { notFound?: T; fileTooLarge?: T; fileType?: T; + fileRefused?: T; fileCount?: T; fileNotSent?: T; + fileOptional?: T; fileRemove?: T; next?: T; back?: T;