New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

opentable-widget

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentable-widget

This package dynamically generates a OpenTable reservation widget link and an OpenTable restaurant ID's (`rid`) using a restaurant's name and location.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

OpenTable Widget

This package dynamically generates a OpenTable reservation widget link and an OpenTable restaurant ID's (rid) using a restaurant's name and location.

OpenTable provides a to generate OpenTable widgets. Unfortunately there is no official API to dynamically generate widgets. OpenTable does not have any public API's.

Usage

npm install opentable-widget
const getWidget = require('opentable-widget');

const restaurantName = 'terroni'
const location = {
  city: 'toronto',
  state: 'ontario',
  zip: 'M6J 1E8',
}
const options = {
  theme: 'button',
  language: 'en-CA',
}

getWidget(restaurantName, location, options).then(widget => {
  const scriptElement = document.getElementById('some-script-element');
  scriptElement.type = 'text/javascript'
  scriptElement.src = widget.source;

  console.log(widget.source);
});

// '//www.opentable.ca/widget/reservation/loader?rid=112426&type=multi&theme=standard&iframe=true&domain=ca&lang=en-CA&newtab=false&ot_source=Restaurant%20website'

Widget Source

The widget source, as OpenTable intends, should be set as the src property of a script tag in order to be rendered.

Location

Since this package scrapes raw HTML from multiple sources to find rid's and widgets, there is a chance for incorrect data to be returned if not all search parameters are given.

The package needs the restaurant name at a minimum. Providing additional location data of the restaurant such as city, state, country and zip codes will improve the accuracy of the widget returned.

If all location parameters city, state, country and zip are provided, it is guaranteed that the widget returned is correct.

Options

An optional options parameter can be passed to getWidget to alter the type of widget returned.

Possible options: theme, language, iframe, newtab Defaults: 'standard', 'en-US', true, false

Check the OpenTable widget website for the values available for each of these options.

FAQs

Package last updated on 19 Nov 2021

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