Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@ideal-postcodes/address-finder

Package Overview
Dependencies
4
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

dist/css.d.ts

13

CHANGELOG.md

@@ -0,1 +1,14 @@

# [1.2.0](https://github.com/ideal-postcodes/address-finder/compare/1.1.1...1.2.0) (2021-01-15)
### Bug Fixes
* **JSUtil:** Update to 4.0 ([783d56f](https://github.com/ideal-postcodes/address-finder/commit/783d56fd79595bbea916d944bc752cf3dd0e530d))
* **Scoping:** Narrow address population scope to outputScope ([feb9a23](https://github.com/ideal-postcodes/address-finder/commit/feb9a23a588587ddedb12d3b3e6ff1e286d9a6cc))
### Features
* **CSS:** Add option to inject CSS ([900b866](https://github.com/ideal-postcodes/address-finder/commit/900b8667d7ee4109a931bed645843781dd70f8e5))
## [1.1.1](https://github.com/ideal-postcodes/address-finder/compare/1.1.0...1.1.1) (2021-01-05)

@@ -2,0 +15,0 @@

@@ -68,2 +68,8 @@ import { View } from "./view";

/**
* Binds to DOM and begin DOM mutations
*
* @hidden
*/
load(): void;
/**
* Creates a new instance of `Autocomplete.View` and attaches it to the DOM.

@@ -70,0 +76,0 @@ */

20

dist/controller.js

@@ -11,2 +11,3 @@ "use strict";

const cache_1 = require("./cache");
const css_1 = require("./css");
const core_axios_1 = require("@ideal-postcodes/core-axios");

@@ -33,2 +34,3 @@ const jsutil_1 = require("@ideal-postcodes/jsutil");

removeOrganisation: false,
injectStyle: false,
inputField: "",

@@ -109,2 +111,12 @@ // Callbacks

/**
* Binds to DOM and begin DOM mutations
*
* @hidden
*/
load() {
this.view.attach();
css_1.addStyle(this);
this.options.onLoaded.call(this);
}
/**
* Creates a new instance of `Autocomplete.View` and attaches it to the DOM.

@@ -115,4 +127,3 @@ */

if (!this.options.checkKey) {
this.options.onLoaded.call(this);
this.view.attach();
this.load();
resolve();

@@ -126,4 +137,3 @@ return;

throw new Error("Key currently not usable");
this.view.attach();
this.options.onLoaded.call(this);
this.load();
resolve();

@@ -191,3 +201,3 @@ })

address,
config: { ...this.options, scope: this.scope },
config: { ...this.options, scope: this.outputScope },
outputFields: this.options.outputFields,

@@ -194,0 +204,0 @@ });

@@ -82,2 +82,11 @@ import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";

/**
* Inject stylesheet into DOM to style Address Finder with default theme. Default is `false`
*
* Styling of the Address Finder can be achieved using a CSS file. Set this to `false` if you wish to do this
*
* - `true` Injects the default styles into the DOM
* - `string` e.g. `https://cdn.jsdelivr.net/npm/@ideal-postcodes/address-finder@1.1.1/css/address-finder.min.css` will include a CSS Stylesheet in the DOM with the src set as the string
*/
injectStyle?: boolean | string;
/**
* Invoked when Address Finder has been successfully attached to the input element.

@@ -84,0 +93,0 @@ */

@@ -68,2 +68,8 @@ import { View } from "./view";

/**
* Binds to DOM and begin DOM mutations
*
* @hidden
*/
load(): void;
/**
* Creates a new instance of `Autocomplete.View` and attaches it to the DOM.

@@ -70,0 +76,0 @@ */

@@ -5,2 +5,3 @@ /* eslint-disable no-invalid-this */

import { ApiCache } from "./cache";
import { addStyle } from "./css";
import { Client } from "@ideal-postcodes/core-axios";

@@ -27,2 +28,3 @@ import { getScope, getDocument, populateAddress, isString, } from "@ideal-postcodes/jsutil";

removeOrganisation: false,
injectStyle: false,
inputField: "",

@@ -103,2 +105,12 @@ // Callbacks

/**
* Binds to DOM and begin DOM mutations
*
* @hidden
*/
load() {
this.view.attach();
addStyle(this);
this.options.onLoaded.call(this);
}
/**
* Creates a new instance of `Autocomplete.View` and attaches it to the DOM.

@@ -109,4 +121,3 @@ */

if (!this.options.checkKey) {
this.options.onLoaded.call(this);
this.view.attach();
this.load();
resolve();

@@ -120,4 +131,3 @@ return;

throw new Error("Key currently not usable");
this.view.attach();
this.options.onLoaded.call(this);
this.load();
resolve();

@@ -185,3 +195,3 @@ })

address,
config: { ...this.options, scope: this.scope },
config: { ...this.options, scope: this.outputScope },
outputFields: this.options.outputFields,

@@ -188,0 +198,0 @@ });

@@ -82,2 +82,11 @@ import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";

/**
* Inject stylesheet into DOM to style Address Finder with default theme. Default is `false`
*
* Styling of the Address Finder can be achieved using a CSS file. Set this to `false` if you wish to do this
*
* - `true` Injects the default styles into the DOM
* - `string` e.g. `https://cdn.jsdelivr.net/npm/@ideal-postcodes/address-finder@1.1.1/css/address-finder.min.css` will include a CSS Stylesheet in the DOM with the src set as the string
*/
injectStyle?: boolean | string;
/**
* Invoked when Address Finder has been successfully attached to the input element.

@@ -84,0 +93,0 @@ */

{
"name": "@ideal-postcodes/address-finder",
"version": "1.1.1",
"version": "1.2.0",
"description": "Address Finder JS library backed by the Ideal Postcodes UK address search API",

@@ -95,4 +95,4 @@ "main": "dist/index.js",

"dependencies": {
"@ideal-postcodes/core-axios": "~2.2.3",
"@ideal-postcodes/jsutil": "~3.1.0",
"@ideal-postcodes/core-axios": "~2.2.4",
"@ideal-postcodes/jsutil": "~4.0.0",
"@xstate/fsm": "~1.5.2",

@@ -117,3 +117,3 @@ "lodash-es": "~4.17.20"

"@types/puppeteer": "~5.4.2",
"@typescript-eslint/eslint-plugin": "~4.11.0",
"@typescript-eslint/eslint-plugin": "~4.13.0",
"@wessberg/rollup-plugin-ts": "1.3.5",

@@ -125,3 +125,3 @@ "chai": "~4.2.0",

"dotenv": "~8.2.0",
"eslint": "~7.16.0",
"eslint": "~7.17.0",
"karma": "~5.2.3",

@@ -137,3 +137,3 @@ "karma-chrome-launcher": "~3.1.0",

"puppeteer": "~5.5.0",
"rollup": "~2.35.1",
"rollup": "~2.36.1",
"semantic-release": "~17.3.1",

@@ -143,5 +143,4 @@ "sinon": "~9.2.2",

"typedoc": "~0.19.2",
"typescript": "~4.1.3",
"xstate": "~4.15.2"
"typescript": "~4.1.3"
}
}

@@ -17,3 +17,3 @@ <h1 align="center">

`@ideal-postcodes/address-finder` is a Javascript library that delivers address autocomplete (or adress typeahead) search functionality on a webpage.
`@ideal-postcodes/address-finder` is a JavaScript library that delivers address autocomplete (or adress typeahead) search functionality on a webpage.

@@ -149,3 +149,3 @@ This package should be consumed by a bundler or transpiler (e.g. webpack, parcel, rollup) for minification, module resolution and specific browser support.

[`AddressFinder.setup()`](https://address-finder.ideal-postcodes.dev/globals.html#setup) accepts a single configuration object and returns the [Address Finder controller instance](https://address-finder.ideal-postcodes.dev/classes/controller.html)
[`AddressFinder.setup()`](https://address-finder.ideal-postcodes.dev/globals.html#setup) accepts a single configuration object and returns the [Address Finder controller instance](https://address-finder.ideal-postcodes.dev/classes/controller.html).

@@ -156,2 +156,4 @@ Below is the list of parameters you can use to modify Address Finder.

### Required Config
#### [`inputField`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#inputfield)

@@ -161,2 +163,28 @@

#### [`apiKey`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#apiKey)
API Key from your Ideal Postcodes account. Typically begins `ak_`
#### [`outputFields`](https://postcode-lookup.ideal-postcodes.dev/interfaces/controllerconfig.html#outputfields)
Specify where to send address data given a selected address. A object which maps an address attribute to the CSS selector of an input field or `HTMLElement` like `HTMLInputElement` or `HTMLTextAreaElement`.
```javascript
{
line_1: "#line_1",
line_2: "#line_2",
line_3: "input[name='line_3']",
post_town: document.getElementById("post_town"),
postcode: document.getElementById("postcode")
}
```
The configuration attributes for `outputFields` matches the Address response object. E.g. street name can be populated can be populated using the [`thoroughfare`](https://api-typings.ideal-postcodes.dev/interfaces/address.html#thoroughfare) attribute. A list of address attributes provided by the API can be found at [@ideal-postcodes/api-typings](https://api-typings.ideal-postcodes.dev/interfaces/address.html).
More complex, dynamic assignment can be performed using the [`onAddressRetrieved`](#onaddressretrieved) callback.
Output fields assigned with a query selector are evaluated lazily (i.e. when an address attribute needs to be piped to a field).
### Configure Behaviour
#### [`checkKey`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#checkkey)

@@ -179,8 +207,12 @@

#### [`apiKey`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#apiKey)
#### [`removeOrganisation`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#removeorganisation)
API Key from your Ideal Postcodes account. Typically begins `ak_`
If set to `true`, organisation name will be removed from the address.
#### Lifecycle Callbacks
Note that addresses which are exclusively an organisation name will not result in the organisation name being removed as this will result in no premise identifier.
Defaults to `false`.
### Lifecycle Callbacks
Address Finder also provides callbacks which let you hook into specific events in the controller lifecyle.

@@ -240,4 +272,4 @@

## License
## Licence
GNU Affero General Public License v3.0
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc