@oneblink/apps-react
    Preparing search index...
    • Submit a FormSubmission. Offline submissions will be added to a pending queue and be processed using the processPendingQueue() function. FormSubmissions with payment submission events will return the FormSubmissionResult with a payment property set, this should be used to redirect the user to the payment URL. Will also handle cleaning up auto save data (if the autoSaveKey property is passed), locally stored drafts and prefill data.

      const formSubmission = {
      formsAppId: 1,
      submission: {
      form: 'data',
      goes: 'here',
      },
      definition: OneBlinkForm,
      captchaTokens: [],
      formSubmissionDraftId: '2974602c-2c5b-4b46-b086-87ee9b2aa233',
      jobId: 'bb37d1da-9cda-4950-a36a-22f58b25de3a',
      preFillFormDataId: '7763f828-4aaf-49dc-9c1b-e2eeea8fa990',
      externalId: 'external-id-set-by-developer',
      }

      // Pass paymentReceiptUrl if submission may require a payment
      const paymentReceiptUrl = `${window.location.origin}/payment-receipt`

      // Pass schedulingBookingUrlConfiguration if submission utilise scheduling
      const schedulingBookingUrlConfiguration = {
      schedulingBookingUrl: 'https://my-website.com/booking',
      schedulingRescheduleUrl: 'https://my-website.com/reschedule',
      schedulingCancelUrl: 'https://my-website.com/cancel',
      }
      const submissionResult = await submissionService.submit({
      formSubmission,
      paymentReceiptUrl,
      schedulingBookingUrlConfiguration,
      })

      if (submissionResult.scheduling) {
      // Redirect user to booking form
      window.location.href = submissionResult.scheduling.bookingUrl
      return
      }

      if (submissionResult.payment) {
      // Redirect user to payment form
      window.location.href = submissionResult.payment.hostedFormUrl
      return
      }

      if (submissionResult.isOffline) {
      if (submissionResult.isInPendingQueue) {
      // Display message to user that the submission
      // has been added to the pending queue
      } else {
      // Display message to user that this submission can
      // not be processed while offline (most likely because it requires a payment)
      }
      return
      }

      // submissionResult.submissionId and submissionResult.submissionTimestamp
      // will be set if the submission was successful

      Parameters

      Returns Promise<FormSubmissionResult>