@oneblink/apps-react
    Preparing search index...

    Function getFlowInstanceNodesWithMeta

    • Inputs a form approval flow instance and set of form submission approvals and returns a flattened array of nodes/steps with inlcuded metadata.

      const formApprovalFlowInstance = {
      steps: [
      {
      type: 'STANDARD',
      group: 'oneblink:administrator',
      isSkipped: false,
      label: 'Manager Approval',
      approvalFormId: '1234',
      },
      {
      type: 'CONCURRENT',
      nodes: [
      {
      label: 'HR Review',
      group: 'oneblink:administrator',
      isSkipped: false,
      approvalFormId: '1234',
      },
      {
      label: 'Finance Review',
      group: 'oneblink:administrator',
      isSkipped: false,
      approvalFormId: '1234',
      },
      ],
      },
      ],
      }

      const formSubmissionApprovals = [
      {
      id: 'approval1',
      stepLabel: 'Manager Approval',
      status: 'APPROVED',
      createdAt: '2024-03-20T10:00:00Z',
      updatedAt: '2024-03-20T10:00:00Z',
      updatedBy: 'fake@fake.com',
      group: 'oneblink:administrator',
      approvalFormId: '1234',
      },
      ]

      const nodesWithMeta = getFlowInstanceNodesWithMeta(
      formApprovalFlowInstance,
      formSubmissionApprovals,
      )

      Concurrent nodes are ordered as actioned (by the time they were actioned), then the currently viewed pending approval if currentlyViewingFormSubmissionApprovalId is provided, then remaining unactioned nodes in definition order. Sequential steps around a concurrent group are not reordered.

      Parameters

      • formApprovalFlowInstance: FormApprovalFlowInstance
      • formSubmissionApprovals: FormSubmissionApproval[]
      • OptionalcurrentlyViewingFormSubmissionApprovalId: string

        The id of the approval currently being viewed, used to keep that pending concurrent step next to already actioned siblings.

      Returns FlowInstanceNodeWithMeta[]

      ApprovalTypes.FlowInstanceNodeWithMeta[]