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

jetsetgo-departure-selection-addon

v1.0.0

Published

A React component library for handling departure selection and add-ons in travel booking applications.

Readme

Jetsetgo Departure Selection App

A React component library for handling departure selection and add-ons in travel booking applications.

Installation

npm install jetsetgo-departure-selection-addon

Requirements

This package has the following peer dependencies:

{
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "react-router-dom": "^6.22.1"
}

Make sure these are installed in your project.

Usage

  1. Import the necessary components and styles:
import { App, setDepartureData } from 'jetsetgo-departure-selection-addon';
import 'jetsetgo-departure-selection-addon/style.css';
  1. Set the departure data before rendering the component:
// Example data structure for outbound and return data
const outboundData = {
  status: 'ok',
  data: [
    {
      service_id: 'service1',
      can_accept: true,
      resource_name: 'Ferry 1',
      route_name: 'Route A',
      departing_from: 'Port A',
      travelling_to: 'Port B',
      departure_time: '09:00',
      arrival_time: '11:00',
      departure_date: '2024-03-01',
      total_cost: 100,
      pats: [],
      flags: [],
      options: {
        // Options data for add-ons
        variations: [
          {
            id: 1,
            variation_name: 'Basic',
            // ... other variation properties
          }
        ]
      }
    }
  ]
};

const returnData = {
  status: 'ok',
  data: [
    // Similar structure to outboundData
  ]
};

// Set the data
setDepartureData(outboundData, returnData);
  1. Use the component in your application:
function YourApp() {
  return (
    <Router> {/* Required for React Router */}
      <App />
    </Router>
  );
}

Data Structure

Outbound and Return Data

Both outbound and return data should follow this structure:

interface DepartureData {
  status: 'ok';
  data: Array<{
    service_id: string;
    can_accept: boolean;
    resource_name: string;
    route_name: string;
    departing_from: string;
    travelling_to: string;
    departure_time: string;
    arrival_time: string;
    departure_date: string;
    total_cost: number;
    pats: Array<any>;
    flags: Array<{
      flag_name?: string;
      flag_url?: string;
    }>;
    options: {
      variations: Array<{
        id: number;
        cancellation_policy_id: number;
        sort_key: number;
        default_variation: boolean;
        variation_name: string;
        variation_description: string;
        cancellation_policy_name: string;
        cancellation_policy_description: string;
        icon: string;
        icon_color: string;
        behaviour_id: number;
        total_price: number;
        price_before_addons: number;
        can_accept: boolean;
        passengers: Array<PassengerData>;
        addons: Array<AddonData>;
      }>;
    };
  }>;
}

Development Mode

When developing locally or using the package in standalone mode, it will use the data from globalOutbound.json and globalReturn.json files. When using the package in a parent application, use setDepartureData to provide the data dynamically.

API Reference

Components

App

The main component that renders the departure selection interface.

Functions

setDepartureData(outboundData, returnData)

Sets the departure data for the application.

  • outboundData: Object containing outbound journey data
  • returnData: Object containing return journey data

getOutboundDepartures()

Returns the current outbound departures data.

getReturnDepartures()

Returns the current return departures data.

License

MIT