Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace schedulingService

Helper functions for scheduling booking handling

import { schedulingService } from '@oneblink/apps'

Index

Type aliases

SchedulingBooking: { endTime: Date; isReschedule: boolean; location: string | undefined; startTime: Date; submissionId: string }

Type declaration

  • endTime: Date

    Date and time the booking ends

  • isReschedule: boolean

    true if the booking has been rescheduled, otherwise false

  • location: string | undefined

    Location of booking

  • startTime: Date

    Date and time the booking starts

  • submissionId: string

    The unique identifier for the submission associated with the booking

Functions

  • createNylasExistingBookingSession(submissionId: string, abortSignal: AbortSignal): Promise<{ bookingRef: string | undefined; configurationId: string; email: string | undefined; name: string | undefined; sessionId: string }>
  • Create a Nylas Session

    Example

    const { sessionId, configurationId, bookingRef, name, email } =
    await schedulingService.createNylasExistingBookingSession(
    '89c6e98e-f56f-45fc-84fe-c4fc62331d34',
    )
    // use sessionId and configurationId/bookingRef to create or modify nylas bookings

    Parameters

    • submissionId: string
    • abortSignal: AbortSignal

    Returns Promise<{ bookingRef: string | undefined; configurationId: string; email: string | undefined; name: string | undefined; sessionId: string }>

  • createNylasNewBookingSession(submissionId: string, abortSignal: AbortSignal): Promise<Awaited<ReturnType<typeof createNylasExistingBookingSession>> & { onBookingConfirmed: any }>
  • Create a Nylas Session

    Example

    const {
    sessionId,
    configurationId,
    bookingRef,
    name,
    email,
    formSubmissionResult,
    } = await schedulingService.createNylasNewBookingSession(
    '89c6e98e-f56f-45fc-84fe-c4fc62331d34',
    )
    // use sessionId and configurationId/bookingRef to create or modify nylas bookings
    // use formSubmissionResult to execute post submission action for form

    Parameters

    • submissionId: string
    • abortSignal: AbortSignal

    Returns Promise<Awaited<ReturnType<typeof createNylasExistingBookingSession>> & { onBookingConfirmed: any }>

  • handleCancelSchedulingBookingQuerystring(options: Record<string, unknown>): { cancellationPolicy?: string; endTime: Date; eventName: string; location: string; nylasEditHash: string; startTime: Date; submissionId: string; timezone: string }
  • Pass in query string parameters after navigation to your app via a valid cancellation link.

    Example

    import queryString from 'query-string'

    const query = queryString.parse(window.location.search)

    const bookingToCancel =
    await schedulingService.handleCancelSchedulingBookingQuerystring(query)

    Parameters

    • options: Record<string, unknown>

    Returns { cancellationPolicy?: string; endTime: Date; eventName: string; location: string; nylasEditHash: string; startTime: Date; submissionId: string; timezone: string }

    • Optional cancellationPolicy?: string

      The policy to display to users when asked why they are cancelling the booking

    • endTime: Date

      The end time of the booking

    • eventName: string

      The event name

    • location: string

      The location of the event

    • nylasEditHash: string

      The nylas edit hash associated with the booking

    • startTime: Date

      The start time of the booking

    • submissionId: string

      The unique identifier for the submission associated with the booking

    • timezone: string

      The timezone the booking was booked in

  • Pass in query string parameters after a redirect back to your app after a booking is processed. Will return a SchedulingBooking and the submission result from the original submission before redirecting to scheduling.bookingUrl. If the booking has been rescheduled, the submission result will not be returned.

    Example

    import queryString from 'query-string'

    const query = queryString.parse(window.location.search)

    const { booking, formSubmissionResult } =
    await schedulingService.handleSchedulingQuerystring(query)

    Parameters

    • options: Record<string, unknown>

    Returns Promise<{ booking: schedulingService.SchedulingBooking; formSubmissionResult?: FormSubmissionResult }>