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

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.4 to 1.6.0

7

CHANGELOG.md

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

# [1.6.0](https://github.com/ideal-postcodes/address-finder/compare/1.5.4...1.6.0) (2021-03-01)
### Features
* **Callbacks:** Add more callbacks ([17624f5](https://github.com/ideal-postcodes/address-finder/commit/17624f5110397d7090cba42e840262fbcd51d549))
## [1.5.4](https://github.com/ideal-postcodes/address-finder/compare/1.5.3...1.5.4) (2021-02-11)

@@ -2,0 +9,0 @@

15

dist/controller.js

@@ -60,6 +60,9 @@ "use strict";

onSuggestionError: NOOP,
onFailedCheck: NOOP,
onMounted: NOOP,
onRemove: NOOP,
onSuggestionsRetrieved: NOOP,
onAddressSelected: NOOP,
onAddressRetrieved: NOOP,
onSuggestionsRetrieved: NOOP,
onAddressPopulated: NOOP,
onFailedCheck: NOOP,
onMouseDown: NOOP,

@@ -176,3 +179,6 @@ onKeyDown: NOOP,

.query(query)
.then((suggestions) => this.setSuggestions(suggestions, query))
.then((suggestions) => {
self.options.onSuggestionsRetrieved.call(self, suggestions);
return this.setSuggestions(suggestions, query);
})
.catch((error) => {

@@ -182,3 +188,3 @@ if (this.query() === query)

self.options.onSuggestionError.call(self, error);
return this;
return self.view;
});

@@ -224,4 +230,5 @@ };

});
this.options.onAddressPopulated.call(this, address);
}
}
exports.Controller = Controller;

@@ -5,3 +5,3 @@ import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";

import { SelectorNode, OutputFields } from "@ideal-postcodes/jsutil";
import { ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect } from "./view";
import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect } from "./view";
export interface OnLoaded {

@@ -14,7 +14,4 @@ (this: Controller): void;

export interface OnSuggestionsRetrieved {
(this: Controller, suggestions: AddressSuggestion[]): void;
(this: Controller, suggestion: AddressSuggestion[]): void;
}
export interface OnAddressSelected {
(this: Controller, suggestion: AddressSuggestion): void;
}
export interface OnAddressRetrieved {

@@ -29,2 +26,14 @@ (this: Controller, address: Address): void;

}
export interface OnMounted {
(this: View): void;
}
export interface OnRemove {
(this: View): void;
}
export interface OnAddressSelected {
(this: Controller, suggestion: AddressSuggestion): void;
}
export interface OnAddressPopulated {
(this: Controller, address: Address): void;
}
export interface ControllerOptions extends Partial<Omit<Config, "api_key">>, Partial<Omit<ViewOptions, "scope" | "document">> {

@@ -170,2 +179,16 @@ /**

/**
* 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.
*/
onAddressRetrieved?: OnAddressRetrieved;
/**
* Invoked when view is attached to the DOM
*/
onMounted?: OnMounted;
/**
* Invoked when view is detached from the DOM
*/
onRemove?: OnRemove;
/**
* Invoked immediately after the user has selected a suggestion (either by

@@ -177,7 +200,6 @@ * click or keypress). The first argument is an object which represents the

/**
* 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.
* Invoked when selected address is populated into address fields of user
* address form
*/
onAddressRetrieved?: OnAddressRetrieved;
onAddressPopulated?: OnAddressPopulated;
/**

@@ -184,0 +206,0 @@ * Invoked when an error has occurred following an attempt to retrieve a full

@@ -6,2 +6,3 @@ import { AddressSuggestion } from "@ideal-postcodes/api-typings";

import { Announce } from "./announcer";
import { OnMounted, OnRemove } from "./index";
/**

@@ -167,2 +168,10 @@ * @hidden

/**
* Invoked when controller is attached to DOM
*/
onMounted: OnMounted;
/**
* Invoked when controller is detached from DOM
*/
onRemove: OnRemove;
/**
* Applies additional styling to the input field. Ideal for quick tweaks. Accepts CSSStyleDeclaration object

@@ -169,0 +178,0 @@ * Input styles are restored to original when controller is detached from DOM

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

this.fsm.start();
this.options.onMounted.call(this);
return this;

@@ -136,2 +137,3 @@ }

jsutil_1.restoreStyle(this.input, this.inputStyle);
this.options.onRemove.call(this);
return this;

@@ -138,0 +140,0 @@ }

@@ -54,6 +54,9 @@ /* eslint-disable no-invalid-this */

onSuggestionError: NOOP,
onFailedCheck: NOOP,
onMounted: NOOP,
onRemove: NOOP,
onSuggestionsRetrieved: NOOP,
onAddressSelected: NOOP,
onAddressRetrieved: NOOP,
onSuggestionsRetrieved: NOOP,
onAddressPopulated: NOOP,
onFailedCheck: NOOP,
onMouseDown: NOOP,

@@ -170,3 +173,6 @@ onKeyDown: NOOP,

.query(query)
.then((suggestions) => this.setSuggestions(suggestions, query))
.then((suggestions) => {
self.options.onSuggestionsRetrieved.call(self, suggestions);
return this.setSuggestions(suggestions, query);
})
.catch((error) => {

@@ -176,3 +182,3 @@ if (this.query() === query)

self.options.onSuggestionError.call(self, error);
return this;
return self.view;
});

@@ -218,3 +224,4 @@ };

});
this.options.onAddressPopulated.call(this, address);
}
}

@@ -5,3 +5,3 @@ import { Address, AddressSuggestion } from "@ideal-postcodes/api-typings";

import { SelectorNode, OutputFields } from "@ideal-postcodes/jsutil";
import { ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect } from "./view";
import { View, ViewOptions, OnOpen, OnBlur, OnClose, OnFocus, OnInput, OnSelect } from "./view";
export interface OnLoaded {

@@ -14,7 +14,4 @@ (this: Controller): void;

export interface OnSuggestionsRetrieved {
(this: Controller, suggestions: AddressSuggestion[]): void;
(this: Controller, suggestion: AddressSuggestion[]): void;
}
export interface OnAddressSelected {
(this: Controller, suggestion: AddressSuggestion): void;
}
export interface OnAddressRetrieved {

@@ -29,2 +26,14 @@ (this: Controller, address: Address): void;

}
export interface OnMounted {
(this: View): void;
}
export interface OnRemove {
(this: View): void;
}
export interface OnAddressSelected {
(this: Controller, suggestion: AddressSuggestion): void;
}
export interface OnAddressPopulated {
(this: Controller, address: Address): void;
}
export interface ControllerOptions extends Partial<Omit<Config, "api_key">>, Partial<Omit<ViewOptions, "scope" | "document">> {

@@ -170,2 +179,16 @@ /**

/**
* 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.
*/
onAddressRetrieved?: OnAddressRetrieved;
/**
* Invoked when view is attached to the DOM
*/
onMounted?: OnMounted;
/**
* Invoked when view is detached from the DOM
*/
onRemove?: OnRemove;
/**
* Invoked immediately after the user has selected a suggestion (either by

@@ -177,7 +200,6 @@ * click or keypress). The first argument is an object which represents the

/**
* 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.
* Invoked when selected address is populated into address fields of user
* address form
*/
onAddressRetrieved?: OnAddressRetrieved;
onAddressPopulated?: OnAddressPopulated;
/**

@@ -184,0 +206,0 @@ * Invoked when an error has occurred following an attempt to retrieve a full

@@ -6,2 +6,3 @@ import { AddressSuggestion } from "@ideal-postcodes/api-typings";

import { Announce } from "./announcer";
import { OnMounted, OnRemove } from "./index";
/**

@@ -167,2 +168,10 @@ * @hidden

/**
* Invoked when controller is attached to DOM
*/
onMounted: OnMounted;
/**
* Invoked when controller is detached from DOM
*/
onRemove: OnRemove;
/**
* Applies additional styling to the input field. Ideal for quick tweaks. Accepts CSSStyleDeclaration object

@@ -169,0 +178,0 @@ * Input styles are restored to original when controller is detached from DOM

@@ -105,2 +105,3 @@ import { isString, toKey, setStyle, restoreStyle, } from "@ideal-postcodes/jsutil";

this.fsm.start();
this.options.onMounted.call(this);
return this;

@@ -133,2 +134,3 @@ }

restoreStyle(this.input, this.inputStyle);
this.options.onRemove.call(this);
return this;

@@ -135,0 +137,0 @@ }

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

@@ -118,3 +118,3 @@ "main": "dist/index.js",

"@rollup/plugin-inject": "~4.0.2",
"@rollup/plugin-node-resolve": "~11.1.0",
"@rollup/plugin-node-resolve": "~11.2.0",
"@types/chai": "~4.2.14",

@@ -126,5 +126,4 @@ "@types/dotenv": "~8.2.0",

"@types/node": "~14.14.16",
"@types/puppeteer": "~5.4.2",
"@types/sinon": "~9.0.10",
"@typescript-eslint/eslint-plugin": "~4.14.0",
"@typescript-eslint/eslint-plugin": "~4.15.1",
"@wessberg/rollup-plugin-ts": "~1.3.8",

@@ -137,3 +136,3 @@ "chai": "~4.3.0",

"dotenv": "~8.2.0",
"eslint": "~7.19.0",
"eslint": "~7.20.0",
"eslint-plugin-compat": "~3.9.0",

@@ -146,9 +145,9 @@ "karma": "~5.2.3",

"karma-sauce-launcher": "~4.3.4",
"karma-typescript": "~5.2.0",
"karma-typescript": "~5.4.0",
"karma-typescript-es6-transform": "~5.2.0",
"minify": "~7.0.0",
"mocha": "~8.2.1",
"mocha": "~8.3.0",
"prettier": "~2.2.1",
"promise-polyfill": "~8.2.0",
"puppeteer": "~7.0.0",
"puppeteer": "~7.1.0",
"rollup": "~2.38.0",

@@ -155,0 +154,0 @@ "semantic-release": "~17.3.1",

@@ -299,8 +299,16 @@ <h1 align="center">

#### [`onSelect`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#onselect)
#### [`onMount`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#onmount)
Invoked when an address suggestion in suggestion box is selected.
Invoked when controller attaches to the DOM (`controller.view.attach()`).
#### [`onRemove`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#onremove)
Invoked when controller detaches from the DOM (`controller.view.detach()`).
#### [`onAddressPopulated`](https://address-finder.ideal-postcodes.dev/interfaces/controlleroptions.html#onaddresspopulated)
Invoked after the selected address is applied to input fields.
## 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