/kerbside-lookup

The Kerbside Lookup Widget by Recycle Now

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

The Kerbside Lookup Widget

Powered by RecycleNow

Quality Gate Status

Contact the RecycleNow Digital Team for API Access.

Usage

Include the script and CSS (optional) from jsdeliver:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/etchteam/kerbside-lookup/dist/index.css" />
<script src="https://cdn.jsdelivr.net/gh/etchteam/kerbside-lookup/dist/index.min.js" async defer></script>

Add the following div in the location you want the widget to appear:

<div id="wrap-klw"></div>

Options

You can set the following using data-prop attributes on your div tag.

  • token - Your API token (required)
  • materials - An array of material IDs to restrict the widget to (optional)
  • postcode - A postcode to restrict the widget to (optional)
  • locale - cy or en. Defaults to en.
  • button - Button text. Defaults to Submit or Cyflwyno depending on the locale setting.
  • placeholder - Placeholder text. Defaults to Enter a postcode... or Rhowch eich cod post... depending on locale setting.
  • apihost - Used in development to override the api host on pre-built widget code.

For example:

<div id="wrap-klw"
  data-prop-token="MySuperSecureApiToken"
  data-prop-locale="cy"
></div>

Alternatively, you can ue a script tag with a JSON object inside.

<div id="wrap-klw">
  <script type="text/props">
    {
      "token": "MySuperSecureApiToken",
      "locale": "cy"
    }
  </script>
</div>

Support

For API access, full documentation, and a list of material IDs, please contact the RecycleNow Digital Team.

Raise issues on this repository for any bugs you find or feature requests that you have.