Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nylas/components-availability

Package Overview
Dependencies
Maintainers
9
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nylas/components-availability

Nylas Availability (`<nylas-availability>`) is part of the Nylas Components library that lets you build event/calendar applications in minutes. Use Nylas Availability with your Nylas account or by passing in your own JSON data.

  • 1.1.5-canary.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-87.04%
Maintainers
9
Weekly downloads
 
Created
Source

Nylas Availability -- In Development

Nylas Availability (<nylas-availability>) is part of the Nylas Components library that lets you build event/calendar applications in minutes. Use Nylas Availability with your Nylas account or by passing in your own JSON data.

Nylas Availability is currently in active development. Want to contribute? Find out how!

Getting Started

Documentation

Installation

First, install the Nylas Availability Component with npm

npm install @nylas/components-availability

or with yarn

yarn add @nylas/components-availability

or using the CDN by adding this script tag

<script src="https://unpkg.com/@nylas/components-availability"></script>

Usage

If you've installed Nylas Availability using the CDN, then <nylas-availability></nylas-availability> is ready to use.

Otherwise, import the Nylas Availability component into your application.

import "@nylas/components-availability";

Using Nylas Provider

Setup

If you haven't registered for a Nylas account yet, you can do so at dashboard.nylas.com. Once there, head to the Components tab and create a new Availability component.

Allowed domains

During the setup process, you'll be prompted to provide a list of allowed domains. Be sure to add any domains you'll be testing your app on, including localhost, and any staging and production URLs you might use.

Bring your own data

Nylas Availability can be used as a UI for any calendar data you provide.

Properties you can pass to Nylas Availability are calendars, opening_hours

Reference

Properties

NameTypeDescriptionRequiredDefault Value
idstringThe id of the Availability componenttrue
access_tokenstringAuthorization for calendar queriesfalse
view_asAvailabilityViewDisplay availability as list or calendar.false"schedule"
show_headerbooleanToggles legend display.falsetrue
date_formatDateFormatSet the format of the date in the legend to show full date, day of the month, or day of the week.false"full"
busy_colorstringCustomize the color of busy time slots in the legend and ticks in schedule view.false"#EE3248cc"
closed_colorstringCustomize the color of closed time slots in the legend and ticks in schedule view.false"#EE3248cc"
free_colorstringCustomize the color of available time slots in the legend and ticks in schedule view.false"#078351cc"
partial_colorstringCustomize the color of partially available time slots in the legend and ticks in schedule view.false"#FECA7Ccc"
selected_colorstringCustomize the color of busy time slots in the legend and ticks in schedule view.false"#002db4"
show_as_weekbooleanDisplay component fixed length week.falsefalse
show_weekendsbooleanControls whether or not to include weekends when using show_as_week.falsetrue
show_ticksbooleanDisplay time of day.falsetrue
dates_to_shownumberControls how many days to show. The actual number of days show may be less as the application will display the number of days that fit comfortably on the screen up to dates_to_show. When show_as_week is enabled, dates_to_show is not considered.false1
show_hostsHostViewToggles hosts display.false"show"
allow_date_changebooleanControls if the date can be changed. When set to true, the user can not change the day. When set to false, the Availability component is fixed to today's date or start_date if passed.falsetrue
attendees_to_shownumberTruncates the number of attendees shownfalse5
start_dateDateStart availability component on a specific date. Used in combination with dates_to_show = 1 to display availability for one day only.falsenew Date()
start_hournumberControls the start time of each day.false0
end_hournumberControls the end time for each day.false24
slot_sizenumberSet the size of each time block in minutes.false15
open_hoursAvailabilityRule[]Set a schedule through out the week that show as available or busy regardless of calendar availability.false[]
eventsEventDefinition[]TODOfalse[]
availabilityAvailability[]Sets the availability data to be used by the component, instead of using the Nylas API.false[]
booking_optionsConsecutiveEvent[]Sets the data used for displaying booking options to be used by the component, instead of using the Nylas API.false[]
required_participantsstring[]Set the participants who must be available for each time slot.false[]
timezonestringConfigure the viewing timezone for ticks and slot sizes.false""
event_buffernumberTODO: Time in minutes to add before and after each time slot.false0
capacitynumberTODO: Group events? Unusedfalse?
allow_bookingbooleanControls if time slots are bookable when used with the Nylas Booking component.falsefalse
booking_user_emailstringTODO?falsefalse
booking_user_tokenstringTODO?falsefalse
mandate_top_of_hourbooleanSets selected slots to the start of the hour. When false, slots can be selected at 15 minute intervals.falsefalse
max_book_ahead_daysnumberThe maximum number of days in the future an event can be selected.false30
min_book_ahead_daysnumberThe minimum number of days in the future an event can be selected. Or the number days in advance required for an event to be selected.false0
overbooked_thresholdnumberTODOfalse100
partial_bookable_rationumberTODOfalse0.01

Events

You can listen to certain events from your application by adding an event listener to the component.

onError Listen to error events.

document
  .querySelector("nylas-availability")
  .addEventListener("onError", (event) => {
    let { detail } = event;
    console.log("onError: ", detail);
  });

timeSlotChosen Listen to timeSlotChosen event. Responds with an list of SelectableSlots.

document
  .querySelector("nylas-availability")
  .addEventListener("timeSlotChosen", (event) => {
    let { detail } = event;
    console.log("timeSlotChosen: ", detail.timeSlots);
  });

eventOptionsReady

document
  .querySelector("nylas-availability")
  .addEventListener("eventOptionsReady", (event) => {
    let { detail } = event;
    console.log("eventOptionsReady: ", detail.slots);
  });

Types

type DateFormat: "full" | "date"| "weekday" | "none";

type AvailabilityView: "schedule"| "list";

type HostView: "show" | "hide";

interface TimeSlot {
  start_time: Date;
  end_time: Date;
  available_calendars: string[];
  calendar_id?: string;
  expirySelection?: string;
  recurrence_cadence?: string;
  recurrence_expiry?: Date | string;
  isBookable: boolean;
}

interface SelectableSlot extends TimeSlot {
  selectionStatus: SelectionStatus;
  availability: AvailabilityStatus;
  selectionPending?: boolean;
  hovering?: boolean;
  timezone?: string;
}

FAQs

Package last updated on 17 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc