npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wix/headless-restaurants-table-reservations

v0.0.15

Published

Headless components for restaurant table reservations using the Wix table reservations API.

Readme

@wix/headless-restaurants-table-reservations

Headless components for restaurant table reservations using the Wix table reservations API.

Installation

npm install @wix/headless-restaurants-table-reservations @wix/table-reservations

Note: This package requires the @wix/table-reservations package to be installed as it provides the underlying API functionality.

Components

Filters

The Filters component provides filtering functionality for location, party size, date, and time selection.

import { Filters } from '@wix/headless-restaurants-table-reservations/react';

<Filters.Root
  initialFilters={{ partySize: 2 }}
  filterOptions={{
    locations: [
      { _id: '1', name: 'Downtown Restaurant', address: '123 Main St' },
      { _id: '2', name: 'Uptown Bistro', address: '456 Oak Ave' },
    ],
    partySizes: [
      { key: '1', label: '1 Person', value: 1 },
      { key: '2', label: '2 People', value: 2 },
    ],
    availableDates: [{ key: '1', label: 'Today', value: new Date() }],
    availableTimes: [],
  }}
  onFiltersChange={(filters) => console.log(filters)}
>
  <Filters.Location />
  <Filters.PartySize />
  <Filters.Date />
  <Filters.Clear />
</Filters.Root>;

TimeSlots

The TimeSlots component displays available time slots in a grid format with different states.

import { TimeSlots } from '@wix/headless-restaurants-table-reservations/react';

<TimeSlots.Root
  timeSlots={[
    { _id: '1', startTime: '19:00', endTime: '20:00', available: true },
    { _id: '2', startTime: '19:30', endTime: '20:30', available: false },
  ]}
  selectedTimeSlotId="1"
  onTimeSlotSelect={(id) => console.log('Selected:', id)}
>
  <TimeSlots.Label>Available Times</TimeSlots.Label>
  <TimeSlots.Grid columns={4} />
</TimeSlots.Root>;

ReserveNow

The ReserveNow component handles reservation submission with form validation and error handling.

import { ReserveNow } from '@wix/headless-restaurants-table-reservations/react';

<ReserveNow.Root
  onReservationSuccess={(id) => console.log('Reservation created:', id)}
  onReservationError={(error) => console.error('Error:', error)}
  createReservation={async (params) => {
    // Call Wix table reservations API
    const reservation = await reservations.createReservation(params);
    return reservation._id;
  }}
>
  <ReserveNow.Form>
    <input name="firstName" placeholder="First Name" required />
    <input name="lastName" placeholder="Last Name" required />
    <input name="email" type="email" placeholder="Email" required />
    <input name="phone" type="tel" placeholder="Phone" />
    <textarea name="specialRequests" placeholder="Special Requests" />
    <ReserveNow.Button>Reserve Now</ReserveNow.Button>
  </ReserveNow.Form>
</ReserveNow.Root>;

Complete Example

For a complete working example, use the ReservationForm component:

import { ReservationForm } from '@wix/headless-restaurants-table-reservations/react';

<ReservationForm
  onReservationSuccess={(id) => console.log('Reservation created:', id)}
  onError={(error) => console.error('Error:', error)}
  className="max-w-2xl mx-auto p-6"
/>;

Services

The package includes service classes for interacting with the Wix table reservations API:

import {
  reservationLocationsService,
  timeSlotsService,
  reservationsService,
} from '@wix/headless-restaurants-table-reservations/services';

// Get available locations
const locations = await reservationLocationsService.getLocations();

// Get time slots for a specific query
const timeSlots = await timeSlotsService.getTimeSlots({
  locationId: 'location-id',
  partySize: 2,
  date: new Date(),
});

// Create a reservation
const reservation = await reservationsService.createReservation({
  locationId: 'location-id',
  partySize: 2,
  date: new Date(),
  timeSlotId: 'time-slot-id',
  customerInfo: {
    firstName: 'John',
    lastName: 'Doe',
    email: '[email protected]',
  },
});

Styling

All components use semantic CSS classes that follow the design system:

  • bg-background - Background colors
  • text-foreground - Text colors
  • bg-primary - Primary button colors
  • text-primary-foreground - Primary button text
  • bg-secondary - Secondary colors
  • text-secondary-foreground - Secondary text
  • text-destructive - Error colors
  • font-heading - Heading fonts
  • font-paragraph - Paragraph fonts

API Integration

The components are designed to work with the @wix/table-reservations package. The service classes automatically use the Wix table reservations API:

  • ReservationLocationsService: Uses reservationLocations.queryReservationLocations() and reservationLocations.getReservationLocation()
  • TimeSlotsService: Uses timeSlots.getTimeSlots() and timeSlots.checkAvailability()
  • ReservationsService: Uses reservations.createReservation(), reservations.getReservation(), reservations.updateReservation(), and reservations.cancelReservation()

Make sure to:

  1. Install the Wix table reservations package
  2. Configure your Wix app with the table reservations module
  3. Set up authentication and permissions as required by your Wix app
  4. The service classes handle all API calls automatically

TypeScript Support

The package includes full TypeScript support with exported types:

import type {
  ReservationFilters,
  TimeSlot,
  Location,
  ReservationFormData,
} from '@wix/headless-restaurants-table-reservations/react';