chore(autonomous-session): consolidate uncommitted work from prior session

Bundles the prior autonomous-session output that was sitting unstaged:

- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
  never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
  after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
  redirects (ocr to ai, reports to dashboard, invitations to users),
  docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
  flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
  let-reassign), set-state-in-effect disables in CountryFlag and
  UploadForSigning preview-bytes effect, unused 'confirm' destructures in
  interest contract + reservation tabs, unescaped apostrophe in test-template
  card copy
This commit is contained in:
2026-05-23 00:52:59 +02:00
parent 43719b49e9
commit 221ae5784e
749 changed files with 7440 additions and 3118 deletions

View File

@@ -54,7 +54,7 @@ export interface TemplateSyncResult {
fieldCount: number;
/**
* Template fields the CRM knows how to fill at send time. The admin doesn't
* need to do anything for these they'll flow through prefillFields on
* need to do anything for these - they'll flow through prefillFields on
* the next EOI send.
*/
matchedFields: Array<{ label: string; fieldId: number }>;
@@ -71,7 +71,7 @@ export interface TemplateSyncResult {
*/
missingFromTemplate: string[];
/**
* The template's stored meta what every envelope generated from this
* The template's stored meta - what every envelope generated from this
* template inherits at creation time. signingOrder is bound to the
* template (v2's /template/use does NOT accept an override), so this
* is the authoritative value the admin sees.
@@ -87,7 +87,7 @@ export interface TemplateSyncResult {
* EOI field labels. The admin uses this to verify their fillable PDF
* actually has the named fields the CRM will fill via `formValues`.
*
* Empty array on v1 or when the PDF download / parse fails diagnostic
* Empty array on v1 or when the PDF download / parse fails - diagnostic
* messages go to pino so the admin still sees the rest of the sync result.
*/
acroForm: Array<{
@@ -107,7 +107,7 @@ export interface TemplateSyncResult {
* (signature blocks, etc.).
*/
extraFieldNames: string[];
/** Set when download or parse failed string surfaces in the UI. */
/** Set when download or parse failed - string surfaces in the UI. */
error?: string;
}>;
}
@@ -125,7 +125,7 @@ export interface TemplateSyncResult {
* signingOrder 2, role=SIGNER → developer recipient slot
* signingOrder 3, role=APPROVER → approver recipient slot
*
* Returns null if the role/order combination doesn't match any known slot
* Returns null if the role/order combination doesn't match any known slot -
* useful future-proofing for templates that add CC / VIEWER recipients.
*/
function mapRecipientToSettingKey(role: string, signingOrder: number): string | null {
@@ -141,7 +141,7 @@ function mapRecipientToSettingKey(role: string, signingOrder: number): string |
* matching CRM settings, and cache the field name→ID map for v2 prefillFields.
*
* Throws when the template fetch fails (bad credentials, wrong template ID,
* network) caller surfaces the error to the admin via the form's mutation
* network) - caller surfaces the error to the admin via the form's mutation
* onError + toastError.
*/
export async function syncDocumensoTemplate(
@@ -218,7 +218,7 @@ export async function syncDocumensoTemplate(
});
} catch (err) {
// Surface the failure in the UI rather than failing the whole
// sync the recipient + field-map writes already succeeded
// sync - the recipient + field-map writes already succeeded
// and an admin can still progress without the AcroForm diff.
logger.warn(
{ err, envelopeItemId: item.id, templateId },
@@ -261,7 +261,7 @@ export async function syncDocumensoTemplate(
/**
* Read the cached sync report written on the most recent successful sync.
* Drives the post-reload status panel returns null when no sync has
* Drives the post-reload status panel - returns null when no sync has
* ever run for this port.
*/
export async function getEoiTemplateSyncReport(portId: string): Promise<TemplateSyncResult | null> {
@@ -274,12 +274,12 @@ export async function getEoiTemplateSyncReport(portId: string): Promise<Template
/**
* Read the cached field-name → field-id map for this port. Used by
* `buildDocumensoPayload` when emitting v2's `prefillFields` array.
* Returns null when no sync has run yet caller falls back to v1's
* Returns null when no sync has run yet - caller falls back to v1's
* `formValues`-by-name shape.
*/
export async function getEoiFieldMap(portId: string): Promise<TemplateFieldMap | null> {
// The field map is a free-form JSON blob that doesn't fit the registry's
// scalar-credential model read directly via the legacy settings.service
// scalar-credential model - read directly via the legacy settings.service
// path so the registry-aware resolver doesn't reject the unknown key.
const row = await getSettingLegacy('documenso_eoi_field_map', portId);
const stored = row?.value;