Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace formService

Helper functions for form handling

import { formService } from '@oneblink/apps'

Index

Type aliases

CivicPlusHCMSContentItem: { contentTypeDisplayName: string; contentTypeId: string; contentTypeName: string; created: string; createdBy: string; data: { submission-json-v1?: S3SubmissionData }; id: string; lastModified: string; lastModifiedBy: string; status: CivicPlusHCMSContentItemStatus; statusColor: string; version: number }

Type declaration

  • contentTypeDisplayName: string
  • contentTypeId: string
  • contentTypeName: string
  • created: string

    ISO datetime string

  • createdBy: string
  • data: { submission-json-v1?: S3SubmissionData }
  • id: string
  • lastModified: string

    ISO datetime string

  • lastModifiedBy: string
  • status: CivicPlusHCMSContentItemStatus
  • statusColor: string

    HEX colour

  • version: number
CivicPlusHCMSContentItemStatus: "Draft" | "Published"
CivicPlusHCMSContentItemsResult: { items: CivicPlusHCMSContentItem[]; total: number }

Type declaration

  • items: CivicPlusHCMSContentItem[]

    The HCMS Content Type's items

  • total: number

    Represents the total number of items based on the search. Can be used to achieve paging or infinite scrolling to load more.

FormElementLookupResult: FormElementLookup & { records: FormElementLookupStaticDataRecord[] | null; runLookupOnClear: boolean; url: string | null }
FormElementOptionsSetResult: { options: unknown; type: "OPTIONS" } | { searchQuerystringParameter: string; type: "SEARCH"; url: string } | { error: OneBlinkAppsError; type: "ERROR" }

Variables

dateFormatMap: Record<ReceiptDateFormat, string> = ...

Functions

  • deleteCivicPlusHCMSContentItem(options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }): Promise<void>
  • Delete CivicPlus HCMS content item.

    Parameters

    • options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }
      • Optional abortSignal?: AbortSignal

        Allows request to be aborted

      • contentId: string

        The identifier for the HCMS Content to be deleted

      • formId: number

        The identifier for the Form to determine the HCMS Content Type.

      • formsAppId: number

        The identifier for the Forms App to determine the HCMS Content Type.

    Returns Promise<void>

  • draftHCMSContentItem(options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }): Promise<unknown>
  • Change the status of a CivicPlus HCMS content item to draft.

    Parameters

    • options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }
      • Optional abortSignal?: AbortSignal
      • contentId: string
      • formId: number
      • formsAppId: number

    Returns Promise<unknown>

  • getAPINSWLiquorLicence(formId: number, licenceId: string, abortSignal?: AbortSignal): Promise<LiquorLicenceDetails>
  • Get the details for a single API.NSW Liquor licence based on the licenceID.

    Example

    const formId = 1
    const licenceId = '1-RL22KV'
    const result = await formService.getAPINSWLiquorLicence(
    formId,
    licenceId,
    )

    Parameters

    • formId: number
    • licenceId: string
    • Optional abortSignal: AbortSignal

    Returns Promise<LiquorLicenceDetails>

  • getBSBRecord(formId: number, bsb: string, abortSignal?: AbortSignal): Promise<BSBRecord>
  • Get BSB record based on a BSB number codes from Civica name register

    Example

    const formId = 1
    const bsb = '123-321'
    const results = await formService.getBSBRecord(formId, bsb)

    Parameters

    • formId: number
    • bsb: string
    • Optional abortSignal: AbortSignal

    Returns Promise<BSBRecord>

  • getForm(formId: number, formsAppId?: number, abortSignal?: AbortSignal): Promise<Form>
  • Get a OneBlink Form.

    Example

    const formId = 1
    const formsAppId = 1 // `formsAppId` is optional
    const form = await formService.getForm(formId, formAppId)

    Parameters

    • formId: number
    • Optional formsAppId: number
    • Optional abortSignal: AbortSignal

    Returns Promise<Form>

  • getFormElementLookupById(organisationId: string, formsAppEnvironmentId: number, formElementLookupId: number, abortSignal?: AbortSignal): Promise<FormElementLookupResult | undefined>
  • Get a OneBlink Form Element Lookup.

    Example

    const organisationId = '1234567890ABCDEFG'
    const formsAppEnvironmentId = 1
    const formElementLookupId = 1
    const formElementLookup = await formService.getFormElementLookupById(
    organisationId,
    formsAppEnvironmentId,
    formElementLookupId,
    )
    if (formElementLookup) {
    // Use lookup
    }

    Parameters

    • organisationId: string
    • formsAppEnvironmentId: number
    • formElementLookupId: number
    • Optional abortSignal: AbortSignal

    Returns Promise<FormElementLookupResult | undefined>

  • getFormElementLookups(organisationId: string, formsAppEnvironmentId: number, abortSignal?: AbortSignal): Promise<FormElementLookupResult[]>
  • Get an array of OneBlink Form Element Lookups.

    Example

    const organisationId = '1234567890ABCDEFG'
    const formsAppEnvironmentId = 1
    const formElementLookups = await formService.getFormElementLookups(
    organisationId,
    formsAppEnvironmentId,
    )

    Parameters

    • organisationId: string
    • formsAppEnvironmentId: number
    • Optional abortSignal: AbortSignal

    Returns Promise<FormElementLookupResult[]>

  • Get the options for an options set.

    Parameters

    • formElementOptionsSet: FormElementOptionSet

      The form element options set to generate options from

    • formsAppEnvironmentId: number

      The environment to pull options from

    • abortSignal: AbortSignal

      A signal to abort any asynchronous processing

    Returns Promise<FormElementOptionsSetResult>

    A result object containing potential options or a predictable error

  • getFormElementOptionsSets(organisationId: string, abortSignal: AbortSignal): Promise<FormElementOptionSet[]>
  • Get a list of options sets for an organisation.

    Parameters

    • organisationId: string

      The identifier for the organisation to fetch options sets for

    • abortSignal: AbortSignal

      A signal to abort any asynchronous processing

    Returns Promise<FormElementOptionSet[]>

    An array of options sets

  • getForms(formsAppId: number, abortSignal?: AbortSignal): Promise<Form[]>
  • Get an array of OneBlink Forms.

    Example

    const formsAppId = 1
    const forms = await formService.getForms(formAppId)

    Parameters

    • formsAppId: number
    • Optional abortSignal: AbortSignal

    Returns Promise<Form[]>

  • getFreshdeskFields(formId: number, abortSignal: AbortSignal): Promise<FreshdeskField[]>
  • Get the Freshdesk Fields associated with a form

    Parameters

    • formId: number

      The identifier for the form to fetch freshdesk fields for

    • abortSignal: AbortSignal

      A signal to abort any asynchronous processing

    Returns Promise<FreshdeskField[]>

    An array of Freshdesk Fields

  • getGeoscapeAddress(formId: number, addressId: string, abortSignal?: AbortSignal): Promise<GeoscapeAddress>
  • Get the details for a single geoscape address based on the Id of a geoscape address resource.

    Example

    const formId = 1
    const addressId = 'ABC123'
    const result = await formService.getGeoscapeAddress(formId, addressId)

    Parameters

    • formId: number
    • addressId: string
    • Optional abortSignal: AbortSignal

    Returns Promise<GeoscapeAddress>

  • getGeoscapeReverseGeocoding(options: { abortSignal?: AbortSignal; formId: number; lat: number; lng: number }): Promise<{ reverseGeocodeResult: GeoscapeAddress }>
  • Get a geoscape address from a latitude and longitude

    Example

    const lat = 41.9475427
    const lng = -87.6562292
    const formId = 1
    const result = await formService.getGeoscapeReverseGeocoding({
    lat,
    lng,
    formId,
    })

    Parameters

    • options: { abortSignal?: AbortSignal; formId: number; lat: number; lng: number }
      • Optional abortSignal?: AbortSignal
      • formId: number
      • lat: number
      • lng: number

    Returns Promise<{ reverseGeocodeResult: GeoscapeAddress }>

  • getPointAddress(formId: number, addressId: string, abortSignal?: AbortSignal): Promise<PointAddress>
  • Get the details for a single Point address based on the Id of a Point address resource.

    Example

    const formId = 1
    const addressId = 'ABC123'
    const result = await formService.getPointAddress(formId, addressId)

    Parameters

    • formId: number
    • addressId: string
    • Optional abortSignal: AbortSignal

    Returns Promise<PointAddress>

  • loadFormElementDynamicOptions(forms: Form[], abortSignal: AbortSignal): Promise<void>
  • Load the options for Form Elements that are using a OneBlink List. Useful to cache all the dynamic options when first opening an application.

    Parameters

    • forms: Form[]
    • abortSignal: AbortSignal

    Returns Promise<void>

  • publishHCMSContentItem(options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }): Promise<unknown>
  • Change the status of a CivicPlus HCMS content item to published.

    Parameters

    • options: { abortSignal?: AbortSignal; contentId: string; formId: number; formsAppId: number }
      • Optional abortSignal?: AbortSignal
      • contentId: string
      • formId: number
      • formsAppId: number

    Returns Promise<unknown>

  • searchAPINSWLiquorLicences(options: { formId: number; searchText: string }, abortSignal?: AbortSignal): Promise<any[]>
  • Search for API.NSW Liquor licences based on a partial text search.

    Example

    const result = await formService.searchAPINSWLiquorLicences({
    formId: 1,
    search: 'SMITH',
    })

    Parameters

    • options: { formId: number; searchText: string }
      • formId: number
      • searchText: string
    • Optional abortSignal: AbortSignal

    Returns Promise<any[]>

  • searchCivicPlusHCMSContentItems(options: { $filter?: string; $orderby?: string; $search?: string; $skip?: number; $top?: number; abortSignal?: AbortSignal; formId: number; formsAppId: number }): Promise<CivicPlusHCMSContentItemsResult>
  • Search CivicPlus HCMS content items.

    Parameters

    • options: { $filter?: string; $orderby?: string; $search?: string; $skip?: number; $top?: number; abortSignal?: AbortSignal; formId: number; formsAppId: number }
      • Optional $filter?: string

        Optional OData filter definition.

      • Optional $orderby?: string

        Optional OData order definition.

      • Optional $search?: string

        Optional OData full text search.

      • Optional $skip?: number

        How many items to skip in the result. Can be used to achieve paging or infinite scrolling to load more.

      • Optional $top?: number

        How many items to return in the result. Can be used to achieve paging or infinite scrolling to load more.

      • Optional abortSignal?: AbortSignal

        Allows request to be aborted

      • formId: number

        The identifier for the Form to determine the HCMS Content Type.

      • formsAppId: number

        The identifier for the Forms App to determine the HCMS Content Type.

    Returns Promise<CivicPlusHCMSContentItemsResult>

  • searchCivicaStreetNames(formId: number, queryParams: { search?: string; top?: number }, abortSignal?: AbortSignal): Promise<CivicaStreetName[]>
  • Search for street names in Civica

    Example

    const formId = 1
    const queryParams = {
    search: '1 Station ',
    top: 10,
    }
    const result = await formService.searchCivicaStreetNames(
    formId,
    queryParams,
    )

    Parameters

    • formId: number
    • queryParams: { search?: string; top?: number }
      • Optional search?: string
      • Optional top?: number
    • Optional abortSignal: AbortSignal

    Returns Promise<CivicaStreetName[]>

  • searchGeoscapeAddresses(formId: number, queryParams: { addressType?: "physical" | "mailing" | "all"; dataset?: string; excludeAliases?: boolean; maxNumberOfResults?: number; query: string; stateTerritory?: string }, abortSignal?: AbortSignal): Promise<GeoscapeAddressesSearchResult>
  • Search for geoscape addresses based on a partial address.

    Example

    const formId = 1
    const result = await formService.searchGeoscapeAddresses(formId, {
    query: '123 N',
    maxNumberOfResults: 10
    stateTerritory: 'NSW'
    })

    Parameters

    • formId: number
    • queryParams: { addressType?: "physical" | "mailing" | "all"; dataset?: string; excludeAliases?: boolean; maxNumberOfResults?: number; query: string; stateTerritory?: string }
      • Optional addressType?: "physical" | "mailing" | "all"
      • Optional dataset?: string
      • Optional excludeAliases?: boolean
      • Optional maxNumberOfResults?: number
      • query: string
      • Optional stateTerritory?: string
    • Optional abortSignal: AbortSignal

    Returns Promise<GeoscapeAddressesSearchResult>

  • searchPointAddresses(formId: number, queryParams: { address: string; addressType?: "physical" | "mailing" | "all"; dataset?: string; maxNumberOfResults?: number; stateTerritory?: string }, abortSignal?: AbortSignal): Promise<PointAddressesSearchResult>
  • Search for Point addresses based on a partial address.

    Example

    const formId = 1
    const result = await formService.searchPointAddresses(formId, {
    address: '123 N',
    maxNumberOfResults: 10
    stateTerritory: 'NSW'
    })

    Parameters

    • formId: number
    • queryParams: { address: string; addressType?: "physical" | "mailing" | "all"; dataset?: string; maxNumberOfResults?: number; stateTerritory?: string }
      • address: string
      • Optional addressType?: "physical" | "mailing" | "all"
      • Optional dataset?: string
      • Optional maxNumberOfResults?: number
      • Optional stateTerritory?: string
    • Optional abortSignal: AbortSignal

    Returns Promise<PointAddressesSearchResult>