import { FormSubmission, PendingFormSubmission, ProgressListener, ProgressListenerEvent } from '../types/submissions'; export type PendingQueueAction = 'SUBMIT_STARTED' | 'SUBMIT_FAILED' | 'SUBMIT_SUCCEEDED' | 'ADDITION' | 'DELETION' | 'EDIT_STARTED' | 'EDIT_CANCELLED'; export type PendingQueueListener = (results: PendingFormSubmission[], action: PendingQueueAction) => unknown; /** * Register a listener function that will be passed an array of * PendingFormSubmissions when the pending queue is modified. * * ### Example * * ```js * const listener = async (pendingSubmissions) => { * // use pending submissions here... * } * const deregister = * await submissionService.registerPendingQueueListener(listener) * * // When no longer needed, remember to deregister the listener * deregister() * ``` * * @param listener * @returns */ export declare function registerPendingQueueListener(listener: PendingQueueListener): () => void; export declare function addFormSubmissionToPendingQueue(formSubmission: FormSubmission): Promise; export declare function updatePendingQueueSubmission(pendingTimestamp: string, newSubmission: PendingFormSubmission, action: 'SUBMIT_FAILED' | 'SUBMIT_STARTED' | 'EDIT_STARTED' | 'EDIT_CANCELLED', skipSentry?: boolean): Promise; /** * Cancel editing a PendingFormSubmission based on the `pendingTimestamp` * property. The function marks the submission as ready for processing by the * pending queue * * ### Example * * ```js * const pendingTimestamp = '2020-07-29T01:03:26.573Z' * * await submissionService.cancelEditingPendingQueueSubmission( * pendingTimestamp, * ) * ``` * * @param pendingTimestamp */ export declare function cancelEditingPendingQueueSubmission(pendingTimestamp: string): Promise; /** * Get an array of PendingFormSubmission * * ### Example * * ```js * const pendingSubmission = * await submissionService.getPendingQueueSubmissions() * // Display pending submissions to user... * ``` * * @returns */ export declare function getPendingQueueSubmissions(): Promise; /** * Delete a PendingFormSubmission before it is processed based on the * `pendingTimestamp` property. * * ### Example * * ```js * const pendingTimestamp = '2020-07-29T01:03:26.573Z' * await submissionService.deletePendingQueueSubmission(pendingTimestamp) * ``` * * @param pendingTimestamp */ export declare function deletePendingQueueSubmission(pendingTimestamp: string): Promise; /** * Edit a PendingFormSubmission before it is processed based on the * `pendingTimestamp` property. The function places the submission in an editing * state preventing it from being processed by the pending queue and returns a * prefill id and form id * * ### Example * * ```js * const pendingTimestamp = '2020-07-29T01:03:26.573Z' * const { preFillFormDataId, formId } = * await submissionService.editPendingQueueSubmission(pendingTimestamp) * window.location.href = `https://mycoolforms.apps.oneblink.io/forms/${formId}?preFillFormDataId=${preFillFormDataId}` * ``` * * @param pendingTimestamp */ export declare function editPendingQueueSubmission(pendingTimestamp: string): Promise<{ preFillFormDataId: string; formId: number; }>; export declare function removePendingQueueSubmission(pendingTimestamp: string, action: 'SUBMIT_SUCCEEDED' | 'DELETION'): Promise; /** * Register a listener function that will be passed a progress event when an * attachment for an item in the pending queue is being processed. * * ### Example * * ```js * const listener = async ({ progress }) => { * // update the UI to reflect the progress here... * } * const deregister = * await submissionService.registerPendingQueueAttachmentProgressListener( * attachment.id, * listener, * ) * * // When no longer needed, remember to deregister the listener * deregister() * ``` * * @param attachmentId * @param listener * @returns */ export declare function registerPendingQueueAttachmentProgressListener(attachmentId: string, listener: ProgressListener): () => void; export declare function executePendingQueueAttachmentProgressListeners(event: ProgressListenerEvent & { attachmentId: string; }): void; /** * Register a listener function that will be passed a progress event when an * item in the pending queue is being processed. * * ### Example * * ```js * const listener = async ({ progress }) => { * // update the UI to reflect the progress here... * } * const deregister = * await submissionService.registerPendingQueueProgressListener( * pendingQueueItem.pendingTimestamp, * listener, * ) * * // When no longer needed, remember to deregister the listener * deregister() * ``` * * @param pendingTimestamp * @param listener * @returns */ export declare function registerPendingQueueProgressListener(pendingTimestamp: string, listener: ProgressListener): () => void; export declare function executePendingQueueProgressListeners(event: ProgressListenerEvent & { pendingTimestamp: string; }): void;