Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

07 - Component Library (Webhooks Module)

Module-specific widgets on top of 00-shared/03 (authoritative component library). Shared components (AppTextField, AppButton, AppDialog, AppSnackbar, AppCard, AppListTile, AppMenu, AppChips, AppBadge, AppFAB, AppSwitch, AppStatTile, AppSkeleton, AppEmptyState, AppErrorState, AppBottomSheet) are reused as-is; this file adds only what the module needs that shared does not define.


1. EventPickerChipField

AttributeValue
PurposeMulti-select of domain event types (the webhook's events array)
Datavocabulary from event-queue-map.ts:6-43 + WebhookTested (webhooks.service.ts:134); stored value string[] (webhook.schema.ts:16-17)
Propsselected: Set<String>, onChanged, allowCustom: bool = false, maxVisible: int = 12
BehaviourAppChips filterable grid; free-text "custom event" input chip when allowCustom (API accepts any string - create-webhook.dto.ts:20-24); grouped by source module (users/attendance/homework/results/students/teachers/staff/parents/fees/payments, event-queue-map.ts:6-43)
Validation≥ 1 selected (mirror @ArrayMinSize(1), create-webhook.dto.ts:22-23)
a11yeach chip semanticsLabel "Event X, selected/unselected"; group headers as Semantics headers

2. SecretField

AttributeValue
PurposeSigning-secret input with generate/reveal (create + edit + detail)
Propsvalue, onChanged, obscured: bool = true, onGenerate, canReveal
Behaviourobscure toggle (eye icon); "Generate" fills a strong random secret (client-side only - no server generator); copy button on detail read-only variant
Security notesecret is stored plaintext and returned by API (webhooks.service.ts:31-47); field never logs; auto-clear clipboard after 30 s (proposed)
Validationrequired on create (@IsString, create-webhook.dto.ts:27-28); blank = keep on edit

3. DeliveryLogTile

AttributeValue
PurposeOne delivery attempt row (S5 list, S3 preview)
Datalog doc: eventType, status, responseCode?, attemptedAt, completedAt? (webhook-delivery-log.schema.ts:12-38)
Layoutleading status icon (pending clock / success check / failed alert), title eventType, subtitle responseCode · attemptedAt, trailing chevron
Statesbadge color per status: pending amber, success green, failed red - always with text (00-shared/09)
Interactionstap → detail sheet; optional quick "Retry" on failed rows
NoteattemptCount exists on the schema (:31-32) but is always 0 today - tile hides it until the worker increments it (14_QA_Checklist.md G-2)

4. MetricsTile (4-stat grid)

AttributeValue
PurposeHealth summary on S3
Data{ total, success, failed, pending } from GET /webhooks/:id/metrics (webhooks.service.ts:142-156)
Layout2×2 AppStatTile grid; failed tile highlighted when > 0 with "Retry" affordance
Statesper-tile load/error - one failure never blanks the grid

5. SignatureVerifyCard (developer helper) (forward-looking)

AttributeValue
PurposeClient-side verification of a captured signature against a body+secret
AlgorithmHMAC-SHA256 hex digest of raw request body (webhook-delivery.worker.ts:103-105) - mirrors the worker's sign()
Usepaste body + signature + secret → "Valid ✓ / Invalid ✗"
Notedocumentation aid; not required by the API - receiver side is external. Signature has no timestamp/replay window today (QA G-4)

Composition map (screen → module widgets)

Screen (05)Module widgets
S2/S4EventPickerChipField, SecretField
S3SecretField (read-only), MetricsTile
S5DeliveryLogTile
S6payload/response code blocks (monospace selectable text)
S3/S5/S6SignatureVerifyCard (dev mode)