Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions typescript/approvals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,54 @@ import { MiscTypes } from '..'
import type { ConditionalPredicate } from './conditions'
import type { EndpointConfiguration, IdResource } from './misc'

/** Container kinds that appear in {@link FormApprovalPrefillElementPath.containers}. */
export type FormApprovalPrefillPathContainerKind = 'repeatableSet' | 'form'

/**
* One nesting level from the form root toward a field (repeatable set row or
* nested form submission object).
*/
export type FormApprovalPrefillPathSegment = {
kind: FormApprovalPrefillPathContainerKind
/** `id` of the repeatable set or nested form element */
formElementId: string
}

/**
* Locates a field in the form tree: outermost container first, then the leaf
* element that holds the submission value. Repeatable sets are **not** scoped
* to a single row — prefill copies **every** source row to the same index on
* the target repeatable set.
*/
export type FormApprovalPrefillElementPath = {
containers: FormApprovalPrefillPathSegment[]
/** Leaf element `id` (must have a `name` used in submission). */
formElementId: string
}

/**
* Maps one source field path to one approval field path. Repeatable set levels
* must align with repeatable sets on the other side; nested form (`form`)
* wrappers may appear on only one side (extra `form` segments are skipped when
* aligning).
*/
export type FormApprovalFormPrefillMapping = {
sourcePath: FormApprovalPrefillElementPath
approvalPath: FormApprovalPrefillElementPath
}

export type FormApprovalFlowNodeBase = {
/** The unique label for the node */
label: string
/** The group that will be assigned an approval for this node */
group: string
/** The id of a form that should be submitted with approval */
approvalFormId?: number
/**
* Prefill the approval form from the original submission when the approver
* opens it. Requires {@link FormApprovalFlowNodeBase.approvalFormId}.
*/
approvalFormPrefillMappings?: FormApprovalFormPrefillMapping[]
/** Configuration to hide the deny button on approval actioning screens */
hideApprovalDenyButton?: boolean
}
Expand Down Expand Up @@ -202,6 +243,11 @@ type BaseFormSubmissionApproval = {
updatedBy?: string
/** The id of a form that should be submitted with approval */
approvalFormId?: number
/**
* Prefill the approval form from the original submission when the approver
* opens it. Requires {@link BaseFormSubmissionApproval.approvalFormId}.
*/
approvalFormPrefillMappings?: FormApprovalFormPrefillMapping[]
/** The id of a form that should be submitted with approval */
additionalNotes?: FormSubmissionApprovalNote[]
/** The id of a submission that was submitted with approval */
Expand Down