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

@guruhotel/external-checkout

v1.20.4

Published

Library to consume GuruHotel checkout in a secure way

Downloads

11

Readme

external-checkout by guruhotel

Options

| Parameter | Value | Description | | --------------- | ------------------------------------------- | --------------------------------------------------------------------- | | apiKey | pk_123 | the private key generated in the hotel dashbaord | | sandbox | true or false (false by default) | this will allow you to test the iframe calls in a sandbox environment | | render | true or false (true by default) | this value determine if lib initialization display or not the iframe | | containerName | html element id | the lib will take this param to build the iframe | | styles.width | size in % or px | this value will be the width of the container max is 100% | | styles.height | size in % or px | this value will be the height of the container max is 100% | | styles.overflow | hidden or visible or scroll or auto | this value specifies whether to clip the content or to add scrollbars |

Using via cdn

  1. import script
<script src="https://external-checkout.guruhotel.com/v1/index.min.js"></script>

using es6

npm install @guruhotel/external-checkout
import GuruCheckout from "@guruhotel/external-checkout";

usage

standalone example

<div id="gh-checkout"></div>
const params = {
  apiKey: "<YOUR-PRIVATE-KEY>",
  sandbox: true,
  containerName: "gh-checkout",
  styles: {
    width: "100%",
    height: "100%",
    left: "0",
    overflow: "hidden",
    position: "fixed",
    top: "0"
  },
};

const checkout = new GuruCheckout(params);

Passing query params

<!-- index.html -->
<form id="gh-form" onsubmit="javascript:handleSubmit">
  <input name="arrival" type="date" />
  <input name="departure" type="date" />
  <select name="currency" required>
    <option value="MXN">MXN</option>
    <option value="USD">USD</option>
  </select>
  <button id="gh-form-submit" type="submit">Open checkout</button>
</form>
<div id="gh-checkout"></div>
// index.js
const params = {
  apiKey: "<YOUR-PRIVATE-KEY>",
  render: false, // wait render until user triggers search method
  sandbox: true,
  containerName: "gh-checkout",
  styles: {
    width: "100%",
    height: "100%",
    left: "0",
    overflow: "hidden",
    position: "fixed",
    top: "0"
  },
};
const checkout = new GuruCheckout(params);

const form = document.getElementById("gh-form");
form.onsubmit = handleSubmit;

function handleSubmit(e) {
  e.preventDefault();
  const arrival = e.target[0].value;
  const departure = e.target[1].value;
  const currency = e.target[2].value;

  // use search function to pass form values to iframe
  checkout.search({
    arrival,
    departure,
    currency,
  });
}

Payment link

<div id="gh-checkout"></div>
const params = {
  apiKey: "<YOUR-PRIVATE-KEY>",
  sandbox: true,
  containerName: "gh-checkout",
  styles: {
    width: "100%",
    height: "100%",
    left: "0",
    overflow: "hidden",
    position: "fixed",
    top: "0"
  },
};
const checkout = new GuruCheckout(params);

// this will enable the functionality of listen for payment links
checkout.paymentLinkListener();

Close checkout

const params = {
  apiKey: "pk_xxxxxxxxx",
  sandbox: true, // default false
  containerName: "gh-checkout",
  styles: {
    width: "100%",
    height: "100%",
    left: "0",
    overflow: "hidden",
    position: "fixed",
    top: "0"
  },
};
const checkout = new GuruCheckout(params);

// trigger this whenever you want to set containers visibility to 'visible'
checkout.makeVisible();