Wire real CiviCRM DEV custom fields and dynamic option fetching

This commit is contained in:
Joel Brock
2026-05-09 20:42:35 -07:00
parent 54555c74d2
commit c58a49be6d
7 changed files with 663 additions and 213 deletions

View File

@@ -78,13 +78,17 @@ export interface FieldConfig {
/** Visibility rule. If absent, field is always visible (within its visible section). */
visibleWhen?: VisibilityRule;
/**
* The CiviCRM custom-field reference, if this maps to a custom field on the
* Org Engagement Submission activity. Format: `custom_<id>` or
* `custom_<group_name>.<field_name>` depending on APIv4 conventions.
* The CiviCRM custom-field reference. APIv4 format: `<group_name>.<field_name>`.
* Leave undefined for fields that don't write back to Civi (e.g. transient
* UI helpers).
*/
civiField?: string;
/**
* If this field's options come from a CiviCRM option group, set its ID here.
* `/api/data` will fetch the option-group values and embed them in
* FormDataPayload.options so the renderer can use real CRM-defined choices.
*/
optionGroupId?: number;
}
export interface StageSectionConfig {
@@ -134,6 +138,12 @@ export interface FormDataPayload {
* Fields with no prior value are simply absent from this map.
*/
prefill: Record<string, unknown>;
/**
* Option-group values fetched at request time, keyed by option_group_id.
* Each entry is a list of {value, label}. The form merges these into
* field configs whose `optionGroupId` matches.
*/
options?: Record<number, SelectOption[]>;
}
/**