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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fly-easy-app/react

v1.5.1

Published

A SDK for utilizing Fly Easy's React components

Downloads

908

Readme

Fly Easy React SDK

Overview

The Fly Easy React SDK is a React framework-specific client for accessing Fly Easy's API.

The SDK lives in our monorepo.

It is published to npm as @fly-easy-app/react.

Installation

Via npm:

npm install @fly-easy-app/react

Via yarn:

yarn add @fly-easy-app/react

Via pnpm:

pnpm add @fly-easy-app/react

Configuration

To use the Fly Easy React SDK, some components may require:

  1. An API key (generated in your admin dashboard).

For components that require an API key, please refer to the @fly-easy-app/api package on how to configure correctly.

Usage

Components

A component that can be placed in your airline's booking flow after a traveller selects their fare class, and desired departure and returning offers. The component requires a flight offer object, which includes:

The component will call the Fly Easy API to save the flight offers information as JSON, and return an ID. The booking button's href is created on the fly once the flight offer objects are not null anymore. The href points to the airline's booking UI, which includes a query parameter with the flight offer ID.

After a traveller clicks on the express checkout button, they will go through the expedited checkout flow to complete their booking.

Example Usage

// import { setConfig } from '@fly-easy-app/api';
import { FlightOfferDataSources, FlightOffers } from '@fly-easy-app/types';
import { ExpressBookingButton } from '@fly-easy-app/react';

function App() {
   const departing = {
    // flight offer object from supported data source
  };
  const returning = {
    // flight offer object from supported data source
  };
  const flightOffers: FlightOffers = {
    originalDepartureOffer: departing,
    originalReturnOffer: returning
  };

  // setConfig({
  //   apiKey: '*****'
  // });

  <ExpressBookingButton
    airlineId='12345'
    dataSource={FlightOfferDataSources.Amadeus}
    flightOffers={flightOffers}
  />
}

Data Sources

Amadeus

If your flight offer comes from the Amadeus API, the format of the flightOffer object should be per the flight offers response.

Example object:

{
  "type": "flight-offer",
  "id": "1",
  "source": "GDS",
  "instantTicketingRequired": false,
  "nonHomogeneous": false,
  "oneWay": false,
  "lastTicketingDate": "2023-11-01",
  "numberOfBookableSeats": 9,
  "itineraries": [
    {
      "duration": "PT9H10M",
      "segments": [
        {
          "departure": {
            "iataCode": "EWR",
            "at": "2023-11-01T21:50:00"
          },
          "arrival": {
            "iataCode": "LHR",
            "at": "2023-11-02T08:45:00"
          },
          "carrierCode": "6X",
          "number": "188",
          "aircraft": {
            "code": "777"
          },
          "operating": {
            "carrierCode": "6X"
          },
          "duration": "PT5H55M",
          "id": "3",
          "numberOfStops": 0,
          "blacklistedInEU": false
        },
        {
          "departure": {
            "iataCode": "LHR",
            "at": "2023-11-02T10:30:00"
          },
          "arrival": {
            "iataCode": "MAD",
            "at": "2023-11-02T13:00:00"
          },
          "carrierCode": "6X",
          "number": "9931",
          "aircraft": {
            "code": "320"
          },
          "operating": {
            "carrierCode": "6X"
          },
          "duration": "PT1H30M",
          "id": "4",
          "numberOfStops": 0,
          "blacklistedInEU": false
        }
      ]
    }
  ],
  "price": {
    "currency": "USD",
    "total": "342.20",
    "base": "294.00",
    "fees": [
      {
        "amount": "0.00",
        "type": "SUPPLIER"
      },
      {
        "amount": "0.00",
        "type": "TICKETING"
      }
    ],
    "grandTotal": "342.20"
  },
  "pricingOptions": {
    "fareType": ["PUBLISHED"],
    "includedCheckedBagsOnly": true
  },
  "validatingAirlineCodes": ["6X"],
  "travelerPricings": [
    {
      "travelerId": "1",
      "fareOption": "STANDARD",
      "travelerType": "ADULT",
      "price": {
        "currency": "USD",
        "total": "342.20",
        "base": "294.00"
      },
      "fareDetailsBySegment": [
        {
          "segmentId": "3",
          "cabin": "BUSINESS",
          "fareBasis": "J6XQSMIX",
          "class": "J",
          "includedCheckedBags": {
            "quantity": 8
          }
        },
        {
          "segmentId": "4",
          "cabin": "BUSINESS",
          "fareBasis": "J6XQSMIX",
          "class": "J",
          "includedCheckedBags": {
            "quantity": 8
          }
        }
      ]
    }
  ]
}