import * as React from 'react'; import { submissionService, attachmentsService } from './apps'; import { EnvironmentTypes, FormTypes, FormsAppsTypes, ScheduledTasksTypes, SubmissionTypes } from '@oneblink/types'; import { ReplaceInjectablesOverrides } from './hooks/useReplaceInjectablesOverrides'; import { CaptchaType, ExecutedLookups, SetFormSubmission, SectionState } from './types/form'; export type OneBlinkReadOnlyFormProps = { /** * A [Google Maps API * Key](https://developers.google.com/maps/documentation/javascript/get-api-key). * Required if the form contains a `location` form element. */ googleMapsApiKey?: string; /** Hex colour value for certain inputs (defaults to `#4c8da7`). */ primaryColour?: string; /** * Pass a task if the user was attempting to complete a scheduled task via a * form submission */ task?: ScheduledTasksTypes.Task; /** * Pass a task group if the user was attempting to complete a scheduled task * associated with a group via a form submission */ taskGroup?: ScheduledTasksTypes.TaskGroup; /** * Pass a task group instance if the user was attempting to complete a * scheduled task associated with a group via a form submission */ taskGroupInstance?: ScheduledTasksTypes.TaskGroupInstance; /** * Override the default behaviour when injecting values, such as in an info * element or a default value. */ replaceInjectablesOverrides?: ReplaceInjectablesOverrides; }; export type OneBlinkFormBaseProps = OneBlinkReadOnlyFormProps & { /** The function to call when the user cancels the form */ onCancel: () => unknown; /** * The function to call when the user submits the form with valid submission * data. See * [NewFormSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewFormSubmission) * for the structure of the argument. */ onSubmit: (newFormSubmission: submissionService.NewFormSubmission) => unknown; /** Whether the form is currently able to be submitted. False by default. */ disabled?: boolean; /** Whether the form is in preview mode. False by default. */ isPreview?: boolean; /** * An [ABN Lookup Authentication * Guid](https://abr.business.gov.au/Tools/WebServices). Required if the form * contains a `abn` form element. */ abnLookupAuthenticationGuid?: string; /** * A [reCAPTCHA Site Key](https://developers.google.com/recaptcha/intro). * Required if the form contains a `captcha` form element. */ captchaSiteKey?: string; /** Change properties for certain buttons on the form. */ buttons?: FormsAppsTypes.FormsListStyles['buttons']; /** Set a custom validation icon and accessible label. */ validationIcon?: EnvironmentTypes.FormsAppEnvironmentStyles['validationIcon']; /** Number of days attachments are retained for. */ attachmentRetentionInDays?: number; /** * If set to `false`, submission will be prevented while offline. If set to * `true`, the user will be prompted to allow them to continue with * attachments uploading in the background later. */ isPendingQueueEnabled: boolean; /** * The function to call when the user wishes to save their submission data as * a draft submission. If not specified, drafts cannot be saved. See * [NewDraftSubmission](https://oneblink.github.io/apps/modules/submissionService.html#NewDraftSubmission) * for the structure of the argument. */ onSaveDraft?: (newDraftSubmission: submissionService.NewDraftSubmission) => unknown; /** * The function to call when the user needs to navigate away from the form. * e.g. `history.push` */ handleNavigateAway?: () => unknown; /** * Determines whether the form is submittable or not. Info page type forms * show a "Done" button instead of a "Submit" button. Defaults to * "CALCULATED" */ isInfoPage?: 'YES' | 'NO' | 'CALCULATED'; /** * The function to call when a user uploads an attachment through an element * that allows attachment upload. See * [uploadAttachment](https://oneblink.github.io/apps/modules/attachmentsService.html#uploadAttachment) * for the structure of the argument and a sample function to be used. */ onUploadAttachment?: typeof attachmentsService.uploadAttachment; /** * Determines whether to use checkboxes or invisible recaptcha v2 for captcha * elements. Defaults to "CHECKBOX" */ captchaType?: CaptchaType; /** * Whether the form should use a navigable validation errors notification, or * a simple validation errors notification * * @default true */ shouldUseNavigableValidationErrorsNotification?: boolean; /** Various settings for the navigable validation errors notification */ navigableValidationErrorsNotificationSettings?: { /** * A pixel offset for validation error navigation markers. Use this to * account for any headers your page might have. If not set, we will attempt * to calculate the offset for you. Please note: Calculating this value is * not supported when passing in a `scrollableContainerId`. */ navigationTopOffset?: number; /** * The HTML Element ID of the scrollable container your form resides in. If * not set, will scroll on the window. */ scrollableContainerId?: string; }; /** * Whether to scroll to the top of the page when the user navigates to a new * page. If false the window will scroll to the top of the page stepper. * Defaults to false. */ scrollToTopOfPage?: boolean; /** The function to call when determining the current submission duration. */ getCurrentSubmissionDuration?: () => number; /** The function to call when the window.beforeunload event occurs. */ onBeforeUnload?: (props: { submission: SubmissionTypes.S3SubmissionData['submission']; definition: FormTypes.Form; lastElementUpdated: FormTypes.FormElement | undefined; submissionDuration: number | undefined; }) => void; }; export type OneBlinkFormUncontrolledProps = { /** The OneBlink Form to render */ form: FormTypes.Form; /** The initial submission data */ initialSubmission?: SubmissionTypes.S3SubmissionData['submission']; }; export type OneBlinkFormControlledProps = { definition: FormTypes.Form; submission: SubmissionTypes.S3SubmissionData['submission']; setFormSubmission: SetFormSubmission; lastElementUpdated?: FormTypes.FormElement; executedLookups: ExecutedLookups; sectionState?: SectionState; }; type Props = OneBlinkFormBaseProps & OneBlinkFormControlledProps & { isReadOnly: boolean; }; declare function OneBlinkFormBase({ googleMapsApiKey, abnLookupAuthenticationGuid, captchaSiteKey, definition, disabled, isPreview, submission, isReadOnly, onCancel, onSubmit, onSaveDraft, setFormSubmission, buttons, validationIcon, primaryColour, attachmentRetentionInDays, isPendingQueueEnabled, handleNavigateAway, isInfoPage: isInfoPageProp, lastElementUpdated, executedLookups, task, taskGroup, taskGroupInstance, onUploadAttachment, captchaType, shouldUseNavigableValidationErrorsNotification, navigableValidationErrorsNotificationSettings, replaceInjectablesOverrides, sectionState, scrollToTopOfPage, getCurrentSubmissionDuration, onBeforeUnload, }: Props): import("react/jsx-runtime").JSX.Element; declare const _default: React.MemoExoticComponent; export default _default;