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
9
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.4 to 2.0.0

dist/watch.d.ts

26

CHANGELOG.md

@@ -0,1 +1,27 @@

# [2.0.0](https://github.com/ideal-postcodes/address-finder/compare/1.8.4...2.0.0) (2021-06-10)
### Bug Fixes
* **Suppress:** Add flags to suppress county and org name ([23f94f7](https://github.com/ideal-postcodes/address-finder/commit/23f94f75298f3612f52dd8af7f7a2c7365579e0b))
### Features
* **Go:** Wraps setup in DOMContentLoaded callback ([9bc1f51](https://github.com/ideal-postcodes/address-finder/commit/9bc1f513c301855d0a0b881ecb129ffd69811a19))
* **Input Field:** Default inputField to outputFields.line_1 if not ([bdde3f2](https://github.com/ideal-postcodes/address-finder/commit/bdde3f2a4ffeb5870371b3d57690b1cc27f90a80))
* **Styles:** Inject CSS by default ([14e1dd1](https://github.com/ideal-postcodes/address-finder/commit/14e1dd159e2ff2d7d1aee7b1629363288c301f42))
* **Watch:** Dynamically watch pages for AF attachment ([6b901c6](https://github.com/ideal-postcodes/address-finder/commit/6b901c6e6a5bfa0167b8b4e623808855f7359f25))
### Performance Improvements
* **Core-Axios:** Upgrade to v3 ([ce9a08b](https://github.com/ideal-postcodes/address-finder/commit/ce9a08b2ec27642680bf63afa0379efeb4471b8a))
### BREAKING CHANGES
* **Styles:** Stylsheet will be injected to the page by default. To
disable set `injectStyle: false`
## [1.8.4](https://github.com/ideal-postcodes/address-finder/compare/1.8.3...1.8.4) (2021-05-09)

@@ -2,0 +28,0 @@

11

dist/cache.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiCache = void 0;
const core_axios_1 = require("@ideal-postcodes/core-axios");
/**

@@ -35,4 +36,6 @@ * @hidden

return Promise.resolve(cachedValue);
const p = this.client.autocomplete
.list({ query: { query, api_key: this.client.api_key } })
const p = core_axios_1.autocomplete
.list(this.client, {
query: { query, api_key: this.client.config.api_key },
})
.then((response) => {

@@ -49,6 +52,6 @@ const suggestions = response.body.result.hits;

if (umprn !== undefined)
return this.client.lookupUmprn({ umprn });
return this.client.lookupUdprn({ udprn });
return core_axios_1.lookupUmprn({ client: this.client, umprn });
return core_axios_1.lookupUdprn({ client: this.client, udprn });
}
}
exports.ApiCache = ApiCache;

@@ -0,1 +1,4 @@

/**
* @module Controller
*/
import { View } from "./view";

@@ -10,2 +13,6 @@ import { ApiCache } from "./cache";

*/
export declare const NOOP: () => void;
/**
* @hidden
*/
export interface StoredOptions extends Required<Omit<ControllerOptions, keyof Config>>, Omit<Config, "api_key"> {

@@ -29,3 +36,3 @@ }

* - A user interface instance `View`
* - An instance of the [Ideal Postcodes browser client](https://github.com/ideal-postcodes/ideal-postcodes-core)
* - An instance of the [Ideal Postcodes Browser Client](https://github.com/ideal-postcodes/core-axios)
*

@@ -61,2 +68,5 @@ * The role of the controller is to bind to events produced by the user

options: StoredOptions;
/**
* View instance
*/
view: View;

@@ -63,0 +73,0 @@ constructor(options: ControllerOptions);

"use strict";
/**
* @module Controller
*/
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,3 +9,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.Controller = exports.defaults = void 0;
exports.Controller = exports.defaults = exports.NOOP = void 0;
/* eslint-disable no-invalid-this */

@@ -19,2 +22,3 @@ const view_1 = require("./view");

const NOOP = () => { };
exports.NOOP = NOOP;
/**

@@ -35,5 +39,7 @@ * Default options assigned to controller instances

removeOrganisation: false,
injectStyle: false,
injectStyle: true,
inputField: "",
autocomplete: "none",
populateCounty: true,
populateOrganisation: true,
// Messages

@@ -58,21 +64,21 @@ msgFallback: "Please enter your address manually",

// Callbacks
onOpen: NOOP,
onSelect: NOOP,
onBlur: NOOP,
onClose: NOOP,
onFocus: NOOP,
onInput: NOOP,
onLoaded: NOOP,
onSearchError: NOOP,
onSuggestionError: NOOP,
onMounted: NOOP,
onRemove: NOOP,
onSuggestionsRetrieved: NOOP,
onAddressSelected: NOOP,
onAddressRetrieved: NOOP,
onAddressPopulated: NOOP,
onFailedCheck: NOOP,
onMouseDown: NOOP,
onKeyDown: NOOP,
onUnhide: NOOP,
onOpen: exports.NOOP,
onSelect: exports.NOOP,
onBlur: exports.NOOP,
onClose: exports.NOOP,
onFocus: exports.NOOP,
onInput: exports.NOOP,
onLoaded: exports.NOOP,
onSearchError: exports.NOOP,
onSuggestionError: exports.NOOP,
onMounted: exports.NOOP,
onRemove: exports.NOOP,
onSuggestionsRetrieved: exports.NOOP,
onAddressSelected: exports.NOOP,
onAddressRetrieved: exports.NOOP,
onAddressPopulated: exports.NOOP,
onFailedCheck: exports.NOOP,
onMouseDown: exports.NOOP,
onKeyDown: exports.NOOP,
onUnhide: exports.NOOP,
};

@@ -91,3 +97,3 @@ /**

* - A user interface instance `View`
* - An instance of the [Ideal Postcodes browser client](https://github.com/ideal-postcodes/ideal-postcodes-core)
* - An instance of the [Ideal Postcodes Browser Client](https://github.com/ideal-postcodes/core-axios)
*

@@ -105,2 +111,5 @@ * The role of the controller is to bind to events produced by the user

};
// Default inputField to line_1 if `inputField` not specified
if (!options.inputField)
this.options.inputField = this.options.outputFields.line_1 || "";
// Scope the operations of this controller to a document or DOM subtree

@@ -149,4 +158,3 @@ this.scope = jsutil_1.getScope(this.options.scope);

}
this.client
.checkKeyUsability({ api_key: this.options.apiKey })
core_axios_1.checkKeyUsability({ client: this.client, api_key: this.options.apiKey })
.then((response) => {

@@ -153,0 +161,0 @@ if (!response.available)

@@ -0,4 +1,8 @@

/**
* @module Address-Finder Exports
*/
import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";
import { watch } from "./watch";
import { Config } from "@ideal-postcodes/core-axios/dist/client";
import { Controller } from "./controller";
import { Controller, defaults } from "./controller";
import { SelectorNode, OutputFields } from "@ideal-postcodes/jsutil";

@@ -44,3 +48,3 @@ import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect, OnUnhide } from "./view";

*/
inputField: SelectorNode;
inputField?: SelectorNode;
/**

@@ -257,2 +261,14 @@ * API Key from your Ideal Postcodes account. Typically begins `ak_`

onUnhide?: OnUnhide;
/**
* Suppresses `county` from being populated if set to `false`
*
* @default true
*/
populateCounty?: boolean;
/**
* Suppresses `organisation_name` from being populated if set to `false`
*
* @default true
*/
populateOrganisation?: boolean;
}

@@ -266,2 +282,8 @@ /**

/**
* Configure and launch an instance of the Address Finder
*
* This is equivalent to invoking `setup` except inside a DOMContentLoaded event callback
*/
export declare const go: (config: ControllerOptions, d?: Document | undefined) => Promise<Controller | null>;
/**
* Cache of Address Finder controllers

@@ -278,3 +300,16 @@ */

defaults: Omit<import("./controller").StoredOptions, "document" | "scope">;
watch: import("./watch").Watch;
};
export { ViewOptions, Controller };
/**
* Configure Address Finder to watch for available address fields to bind
*/
export { watch };
/**
* Default Address Finder Controller configuration
*/
export { defaults };
export { ViewOptions };
/**
* Controller Export
*/
export { Controller };
"use strict";
/**
* @module Address-Finder Exports
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Controller = exports.AddressFinder = exports.controllers = exports.setup = void 0;
exports.Controller = exports.defaults = exports.watch = exports.AddressFinder = exports.controllers = exports.go = exports.setup = void 0;
const watch_1 = require("./watch");
Object.defineProperty(exports, "watch", { enumerable: true, get: function () { return watch_1.watch; } });
const controller_1 = require("./controller");
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return controller_1.Controller; } });
Object.defineProperty(exports, "defaults", { enumerable: true, get: function () { return controller_1.defaults; } });
/**

@@ -18,2 +24,14 @@ * Configure and launch an instance of the Address Finder

/**
* Configure and launch an instance of the Address Finder
*
* This is equivalent to invoking `setup` except inside a DOMContentLoaded event callback
*/
const go = (config, d) => new Promise((resolve, _) => {
(d || document).addEventListener("DOMContentLoaded", (_) => {
const c = exports.setup(config);
return resolve(c);
});
}).catch((_) => null);
exports.go = go;
/**
* Cache of Address Finder controllers

@@ -25,2 +43,8 @@ */

*/
exports.AddressFinder = { setup: exports.setup, controllers: exports.controllers, Controller: controller_1.Controller, defaults: controller_1.defaults };
exports.AddressFinder = {
setup: exports.setup,
controllers: exports.controllers,
Controller: controller_1.Controller,
defaults: controller_1.defaults,
watch: watch_1.watch,
};

@@ -0,1 +1,6 @@

/**
* @module View
*
* @returns {undefined}
*/
import { AddressSuggestion } from "@ideal-postcodes/api-typings";

@@ -2,0 +7,0 @@ import { SelectorNode, IdGen, CSSStyle } from "@ideal-postcodes/jsutil";

"use strict";
/**
* @module View
*
* @returns {undefined}
*/
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +8,0 @@ exports.findOrCreate = exports._onKeyDown = exports.View = void 0;

@@ -0,1 +1,2 @@

import { autocomplete, lookupUdprn, lookupUmprn, } from "@ideal-postcodes/core-axios";
/**

@@ -32,4 +33,6 @@ * @hidden

return Promise.resolve(cachedValue);
const p = this.client.autocomplete
.list({ query: { query, api_key: this.client.api_key } })
const p = autocomplete
.list(this.client, {
query: { query, api_key: this.client.config.api_key },
})
.then((response) => {

@@ -46,5 +49,5 @@ const suggestions = response.body.result.hits;

if (umprn !== undefined)
return this.client.lookupUmprn({ umprn });
return this.client.lookupUdprn({ udprn });
return lookupUmprn({ client: this.client, umprn });
return lookupUdprn({ client: this.client, udprn });
}
}

@@ -0,1 +1,4 @@

/**
* @module Controller
*/
import { View } from "./view";

@@ -10,2 +13,6 @@ import { ApiCache } from "./cache";

*/
export declare const NOOP: () => void;
/**
* @hidden
*/
export interface StoredOptions extends Required<Omit<ControllerOptions, keyof Config>>, Omit<Config, "api_key"> {

@@ -29,3 +36,3 @@ }

* - A user interface instance `View`
* - An instance of the [Ideal Postcodes browser client](https://github.com/ideal-postcodes/ideal-postcodes-core)
* - An instance of the [Ideal Postcodes Browser Client](https://github.com/ideal-postcodes/core-axios)
*

@@ -61,2 +68,5 @@ * The role of the controller is to bind to events produced by the user

options: StoredOptions;
/**
* View instance
*/
view: View;

@@ -63,0 +73,0 @@ constructor(options: ControllerOptions);

@@ -0,1 +1,4 @@

/**
* @module Controller
*/
/* eslint-disable no-invalid-this */

@@ -6,3 +9,3 @@ import { View, findOrCreate } from "./view";

import { addStyle } from "./css";
import { Client } from "@ideal-postcodes/core-axios";
import { Client, checkKeyUsability } from "@ideal-postcodes/core-axios";
import { getScope, getDocument, populateAddress, } from "@ideal-postcodes/jsutil";

@@ -12,3 +15,3 @@ /**

*/
const NOOP = () => { };
export const NOOP = () => { };
/**

@@ -29,5 +32,7 @@ * Default options assigned to controller instances

removeOrganisation: false,
injectStyle: false,
injectStyle: true,
inputField: "",
autocomplete: "none",
populateCounty: true,
populateOrganisation: true,
// Messages

@@ -84,3 +89,3 @@ msgFallback: "Please enter your address manually",

* - A user interface instance `View`
* - An instance of the [Ideal Postcodes browser client](https://github.com/ideal-postcodes/ideal-postcodes-core)
* - An instance of the [Ideal Postcodes Browser Client](https://github.com/ideal-postcodes/core-axios)
*

@@ -98,2 +103,5 @@ * The role of the controller is to bind to events produced by the user

};
// Default inputField to line_1 if `inputField` not specified
if (!options.inputField)
this.options.inputField = this.options.outputFields.line_1 || "";
// Scope the operations of this controller to a document or DOM subtree

@@ -142,4 +150,3 @@ this.scope = getScope(this.options.scope);

}
this.client
.checkKeyUsability({ api_key: this.options.apiKey })
checkKeyUsability({ client: this.client, api_key: this.options.apiKey })
.then((response) => {

@@ -146,0 +153,0 @@ if (!response.available)

@@ -0,4 +1,8 @@

/**
* @module Address-Finder Exports
*/
import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";
import { watch } from "./watch";
import { Config } from "@ideal-postcodes/core-axios/dist/client";
import { Controller } from "./controller";
import { Controller, defaults } from "./controller";
import { SelectorNode, OutputFields } from "@ideal-postcodes/jsutil";

@@ -44,3 +48,3 @@ import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect, OnUnhide } from "./view";

*/
inputField: SelectorNode;
inputField?: SelectorNode;
/**

@@ -257,2 +261,14 @@ * API Key from your Ideal Postcodes account. Typically begins `ak_`

onUnhide?: OnUnhide;
/**
* Suppresses `county` from being populated if set to `false`
*
* @default true
*/
populateCounty?: boolean;
/**
* Suppresses `organisation_name` from being populated if set to `false`
*
* @default true
*/
populateOrganisation?: boolean;
}

@@ -266,2 +282,8 @@ /**

/**
* Configure and launch an instance of the Address Finder
*
* This is equivalent to invoking `setup` except inside a DOMContentLoaded event callback
*/
export declare const go: (config: ControllerOptions, d?: Document | undefined) => Promise<Controller | null>;
/**
* Cache of Address Finder controllers

@@ -278,3 +300,16 @@ */

defaults: Omit<import("./controller").StoredOptions, "document" | "scope">;
watch: import("./watch").Watch;
};
export { ViewOptions, Controller };
/**
* Configure Address Finder to watch for available address fields to bind
*/
export { watch };
/**
* Default Address Finder Controller configuration
*/
export { defaults };
export { ViewOptions };
/**
* Controller Export
*/
export { Controller };

@@ -0,1 +1,5 @@

/**
* @module Address-Finder Exports
*/
import { watch } from "./watch";
import { Controller, defaults } from "./controller";

@@ -13,2 +17,13 @@ /**

/**
* Configure and launch an instance of the Address Finder
*
* This is equivalent to invoking `setup` except inside a DOMContentLoaded event callback
*/
export const go = (config, d) => new Promise((resolve, _) => {
(d || document).addEventListener("DOMContentLoaded", (_) => {
const c = setup(config);
return resolve(c);
});
}).catch((_) => null);
/**
* Cache of Address Finder controllers

@@ -20,3 +35,20 @@ */

*/
export const AddressFinder = { setup, controllers, Controller, defaults };
export const AddressFinder = {
setup,
controllers,
Controller,
defaults,
watch,
};
/**
* Configure Address Finder to watch for available address fields to bind
*/
export { watch };
/**
* Default Address Finder Controller configuration
*/
export { defaults };
/**
* Controller Export
*/
export { Controller };

@@ -0,1 +1,6 @@

/**
* @module View
*
* @returns {undefined}
*/
import { AddressSuggestion } from "@ideal-postcodes/api-typings";

@@ -2,0 +7,0 @@ import { SelectorNode, IdGen, CSSStyle } from "@ideal-postcodes/jsutil";

@@ -0,1 +1,6 @@

/**
* @module View
*
* @returns {undefined}
*/
import { isString, toKey, setStyle, restoreStyle, idGen, show, hide, remove, toHtmlElem, } from "@ideal-postcodes/jsutil";

@@ -2,0 +7,0 @@ import { create } from "./state";

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

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

"dependencies": {
"@ideal-postcodes/core-axios": "~2.2.4",
"@ideal-postcodes/jsutil": "~4.3.9",
"@ideal-postcodes/jsutil": "~4.3.12",
"@ideal-postcodes/core-axios": "~3.0.0",
"@xstate/fsm": "~1.6.0",

@@ -109,2 +109,3 @@ "lodash": "~4.17.20"

"@babel/core": "~7.13.13",
"@babel/plugin-proposal-class-properties": "~7.14.5",
"@babel/preset-env": "~7.13.9",

@@ -134,3 +135,3 @@ "@cablanchard/eslint-config": "~2.1.0",

"core-js-pure": "~3.11.0",
"cypress": "~7.1.0",
"cypress": "~7.5.0",
"dotenv": "~8.2.0",

@@ -137,0 +138,0 @@ "eslint": "~7.25.0",

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

1. [Add the library to your project](#install). Your webpage should have pre-existing address input fields as well as an input field to host the finder
2. [Run initialisation code](#instantiate) providing a reference to the Address Finder input and [any other configuration](modules/index.html#setup)
2. [Run initialisation code](#instantiate) providing a reference to the Address Finder input and [any other configuration](modules/address_finder_exports.html#setup)
3. When initialising, Address Finder will perform a key check to determine whether it is usable. If the check fails, initialisation is aborted. Use the `onCheckFailed` callback to update your page for manual address entry.

@@ -79,3 +79,3 @@ 4. When initialised, Address Finder binds to the input field of your choice and renders a dropdown of address suggestion when the user starts typing

Instantiate Address Finder with [`AddressFinder.setup`](modules/index.html#setup).
Instantiate Address Finder with [`AddressFinder.setup`](modules/address_finder_exports.html#setup).

@@ -87,4 +87,5 @@ ```javascript

inputField: "#line_1", // Target <input> to host Address Finder
apiKey: "iddqd", // API Key from your account
outputFields: { // Target address fields
apiKey: "iddqd", // API Key from your account
outputFields: {
// Target address fields
line_1: "#line_1",

@@ -99,3 +100,3 @@ line_2: "#line_2",

[Configuration options](interfaces/index.controlleroptions.html)
[Configuration options](interfaces/address_finder_exports.controlleroptions.html)

@@ -154,7 +155,7 @@ It's also possible to pass `HTMLElements` as `inputField` or `outputFields`.

Default CSS classes can be overridden. For instance, [containerClass](interfaces/index.controlleroptions.html#containerclass), [listClass](interfaces/index.controlleroptions.html#listclass) and [messageClass](interfaces/index.controlleroptions.html#messageclass) are all defined in [defaults](modules/controller.html#defaults).
You can override default CSS classes. For instance, [containerClass](interfaces/address_finder_exports.controlleroptions.html#containerclass), [listClass](interfaces/address_finder_exports.controlleroptions.html#listclass) and [messageClass](interfaces/address_finder_exports.controlleroptions.html#messageclass) are all defined in [defaults](modules/controller.html#defaults).
#### [`injectStyle`](interfaces/index.controlleroptions.html#injectstyle)
#### [`injectStyle`](interfaces/address_finder_exports.controlleroptions.html#injectstyle)
Set `injectStyle: true` to inject default Address Finder style into DOM. Defaults to `false`.
Set `injectStyle: false` to prevent default Address Finder styles from being added to DOM. Defaults to `true`.

@@ -171,28 +172,24 @@ Set to a URL to retrieve a CSS stylesheet. E.g.

Default messages (e.g. "Start typing to find address", "No matches found") can be overridden. See:
Default messages (e.g. `"Start typing to find address"`, `"No matches found"`) can be overridden. See:
- [msgFallback](interfaces/index.controlleroptions.html#msgfallback)
- [msgInitial](interfaces/index.controlleroptions.html#msginitial)
- [msgNoMatch](interfaces/index.controlleroptions.html#msgnomatch)
- [msgUnhide](interfaces/index.controlleroptions.html#msgunhide)
- [msgFallback](interfaces/address_finder_exports.controlleroptions.html#msgfallback)
- [msgInitial](interfaces/address_finder_exports.controlleroptions.html#msginitial)
- [msgNoMatch](interfaces/address_finder_exports.controlleroptions.html#msgnomatch)
- [msgUnhide](interfaces/address_finder_exports.controlleroptions.html#msgunhide)
### Setup Options
[`AddressFinder.setup()`](modules/index.html#setup) accepts a single configuration object and returns the [Address Finder controller instance](classes/controller.controller-1.html).
[`AddressFinder.setup()`](modules/address_finder_exports.html#setup) accepts a single configuration object and returns the [Address Finder controller instance](classes/controller.controller-1.html).
Below is the list of parameters you can use to modify Address Finder.
A complete list of configuration options can be found [in the library documentation](interfaces/index.controlleroptions.html)
A complete list of configuration options can be found [in the library documentation](interfaces/address_finder_exports.controlleroptions.html)
### Required Config
#### [`inputField`](interfaces/index.controlleroptions.html#inputfield)
#### [`apiKey`](interfaces/address_finder_exports.controlleroptions.html#apikey)
CSS selector or HTML Element which specifies the `<input>` field which the Address Finder interface should bind
#### [`apiKey`](interfaces/index.controlleroptions.html#apikey)
API Key from your Ideal Postcodes account. Typically begins `ak_`
#### [`outputFields`](interfaces/index.controlleroptions.html#outputfields)
#### [`outputFields`](interfaces/address_finder_exports.controlleroptions.html#outputfields)

@@ -213,3 +210,3 @@ 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`.

More complex, dynamic assignment can be performed using the [`onAddressRetrieved`](interfaces/index.controlleroptions.html#onaddressretrieved) callback.
More complex, dynamic assignment can be performed using the [`onAddressRetrieved`](interfaces/address_finder_exports.controlleroptions.html#onaddressretrieved) callback.

@@ -220,6 +217,16 @@ Output fields assigned with a query selector are evaluated lazily (i.e. when an address attribute needs to be piped to a field).

#### [`checkKey`](interfaces/index.controlleroptions.html#checkkey)
#### [`inputField`](interfaces/address_finder_exports.controlleroptions.html#inputfield)
Configure `inputField` if you want Address Finder to render on an input field which is not your first address line.
CSS selector or HTML Element which specifies the `<input>` field which the Address Finder interface should bind.
Defaults to `outputFields.line_1` (the first address line).
#### [`checkKey`](interfaces/address_finder_exports.controlleroptions.html#checkkey)
If enabled, the plugin will check if the key is in a usable state before initialising itself.
Defaults to `true`.
The check can fail if:

@@ -232,10 +239,12 @@

If the check fails, the plugin will not initialise. You can use the [`onFailedCheck`](interfaces/index.controlleroptions.html#onfailedcheck) callback to customise your response to a failed check.
If the check fails, the plugin will not initialise. You can use the [`onFailedCheck`](interfaces/address_finder_exports.controlleroptions.html#onfailedcheck) callback to customise your response to a failed check.
#### [`titleizePostTown`](interfaces/index.controlleroptions.html#titleizeposttown)
#### [`titleizePostTown`](interfaces/address_finder_exports.controlleroptions.html#titleizeposttown)
An optional field to convert the case of the Post Town from upper case into title case. E.g. `"LONDON"` becomes `"London".` Default is `true`
An optional field to convert the case of the Post Town from upper case into title case. E.g. `"LONDON"` becomes `"London".`
#### [`removeOrganisation`](interfaces/index.controlleroptions.html#removeorganisation)
Defaults to `true`.
#### [`removeOrganisation`](interfaces/address_finder_exports.controlleroptions.html#removeorganisation)
If set to `true`, organisation name will be removed from the address.

@@ -245,5 +254,5 @@

#### [`autocomplete`](interfaces/index.controlleroptions.html#autocomplete)
#### [`autocomplete`](interfaces/address_finder_exports.controlleroptions.html#autocomplete)
Sets the `autocomplete=` attribute of the input element. Setting this attribute aims to prevent some browsers (particularly Chrome) from providing a clashing autofill overlay.
Sets the `autocomplete=` attribute of the input element. Setting this attribute aims to prevent some browsers (particularly Chrome) from providing a clashing autofill overlay.

@@ -282,23 +291,23 @@ The best practice for this attribute breaks over time (see [https://stackoverflow.com/questions/15738259/disabling-chrome-autofill](https://stackoverflow.com/questions/15738259/disabling-chrome-autofill)) and is specific to different forms. If you are observing Chrome's autofill clashing on your form, update this attribute to the best practice du jour.

#### [`onLoaded`](interfaces/index.controlleroptions.html#onloaded)
#### [`onLoaded`](interfaces/address_finder_exports.controlleroptions.html#onloaded)
Invoked when Address Finder has been successfully attached to the input element.
#### [`onFailedCheck`](interfaces/index.controlleroptions.html#onfailedcheck)
#### [`onFailedCheck`](interfaces/address_finder_exports.controlleroptions.html#onfailedcheck)
A function invoked if `checkKey` is enabled and the check fails.
#### [`onSuggestionsRetrieved`](interfaces/index.controlleroptions.html#onsuggestionsretrieved)
#### [`onSuggestionsRetrieved`](interfaces/address_finder_exports.controlleroptions.html#onsuggestionsretrieved)
Invoked immediately after address suggestions are retrieved from the API. The first argument is an array of address suggestions.
#### [`onAddressSelected`](interfaces/index.controlleroptions.html#onaddressselected)
#### [`onAddressSelected`](interfaces/address_finder_exports.controlleroptions.html#onaddressselected)
Invoked immediately after the user has selected a suggestion (either by click or keypress). The first argument is an object which represents the suggestion selected.
#### [`onAddressRetrieved`](interfaces/index.controlleroptions.html#onaddressretrieved)
#### [`onAddressRetrieved`](interfaces/address_finder_exports.controlleroptions.html#onaddressretrieved)
Invoked when the Address Finder client has retrieved a full address from the API following a user accepting a suggestion. The first argument is an object representing the address that has been retrieved.
#### [`onSearchError`](interfaces/index.controlleroptions.html#onsearcherror)
#### [`onSearchError`](interfaces/address_finder_exports.controlleroptions.html#onsearcherror)

@@ -311,3 +320,3 @@ Invoked when an error has occurred following an attempt to retrieve a full address. In this scenario the user will also receive a message to manually input their address.

#### [`onSuggestionError`](interfaces/index.controlleroptions.html#onsuggestionerror)
#### [`onSuggestionError`](interfaces/address_finder_exports.controlleroptions.html#onsuggestionerror)

@@ -320,31 +329,31 @@ Invoked when an error has occurred following an attempt to retrieve suggestions for a key press. In this scenario the user will also receive a message to manually input their address.

#### [`onOpen`](interfaces/index.controlleroptions.html#onopen)
#### [`onOpen`](interfaces/address_finder_exports.controlleroptions.html#onopen)
Invoked when Address Finder suggestion box is opened (i.e. presented to the user).
#### [`onBlur`](interfaces/index.controlleroptions.html#onblur)
#### [`onBlur`](interfaces/address_finder_exports.controlleroptions.html#onblur)
Invoked when the user unfocuses from the address input field.
#### [`onClose`](interfaces/index.controlleroptions.html#onclose)
#### [`onClose`](interfaces/address_finder_exports.controlleroptions.html#onclose)
Invoked when Address Finder suggestion box is closed (i.e. hidden from user).
#### [`onFocus`](interfaces/index.controlleroptions.html#onfocus)
#### [`onFocus`](interfaces/address_finder_exports.controlleroptions.html#onfocus)
Invoked when user selects or focuses address input field.
#### [`onInput`](interfaces/index.controlleroptions.html#oninput)
#### [`onInput`](interfaces/address_finder_exports.controlleroptions.html#oninput)
Invoked when user selects or focuses address input field.
#### [`onMounted`](interfaces/index.controlleroptions.html#onmounted)
#### [`onMounted`](interfaces/address_finder_exports.controlleroptions.html#onmounted)
Invoked when controller attaches to the DOM (`controller.view.attach()`).
#### [`onRemove`](interfaces/index.controlleroptions.html#onremove)
#### [`onRemove`](interfaces/address_finder_exports.controlleroptions.html#onremove)
Invoked when controller detaches from the DOM (`controller.view.detach()`).
#### [`onAddressPopulated`](interfaces/index.controlleroptions.html#onaddresspopulated)
#### [`onAddressPopulated`](interfaces/address_finder_exports.controlleroptions.html#onaddresspopulated)

@@ -351,0 +360,0 @@ Invoked after the selected address is applied to input fields.

@@ -44,2 +44,3 @@ import commonjs from "@rollup/plugin-commonjs";

presets: [["@babel/preset-env", { targets }]],
plugins: ["@babel/plugin-proposal-class-properties"],
},

@@ -46,0 +47,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