@ideal-postcodes/jsutil
Advanced tools
Comparing version 6.3.0 to 6.4.0
@@ -0,1 +1,9 @@ | ||
# [6.4.0](https://github.com/ideal-postcodes/jsutil/compare/6.3.0...6.4.0) (2023-10-27) | ||
### Features | ||
* **Country:** Improved Country inputs ([44f0d77](https://github.com/ideal-postcodes/jsutil/commit/44f0d77924a4ac40b36ae3786322a8c0f48056fb)) | ||
* **toCountry:** Change how we update country ([a790b5f](https://github.com/ideal-postcodes/jsutil/commit/a790b5f911fab7280c44a6f530e2dbeacb7f65b8)) | ||
# [6.3.0](https://github.com/ideal-postcodes/jsutil/compare/6.2.0...6.3.0) (2023-08-30) | ||
@@ -2,0 +10,0 @@ |
@@ -10,7 +10,7 @@ import { AnyAddress, GbrAddress } from "./types"; | ||
export declare const toMaxLengthLines: (l: string[], options: MaxLengthOptions) => [string, string, string]; | ||
export declare type MaxLengths = [number?, number?, number?]; | ||
export type MaxLengths = [number?, number?, number?]; | ||
interface MaxLengthOptions { | ||
} | ||
export declare const toAddressLines: (lineCount: LineCount, address: AnyAddress, options: MaxLineConfig) => [string, string, string]; | ||
declare type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
export declare const extract: (a: AnyAddress, attr: KeysOfUnion<AnyAddress>) => string; | ||
@@ -17,0 +17,0 @@ export declare const getFields: (o: PopulateAddressOptions) => OutputFields; |
@@ -200,2 +200,19 @@ "use strict"; | ||
delete address.country; | ||
const iso2Elem = (0, dom_1.toElem)(fields.country_iso_2 || null, scope); | ||
if ((0, input_1.isSelect)(iso2Elem)) { | ||
if ((0, input_1.hasValue)(iso2Elem, address.country_iso_2)) | ||
(0, input_1.change)({ e: iso2Elem, value: address.country_iso_2 }); | ||
} | ||
if ((0, input_1.isInput)(iso2Elem)) { | ||
(0, input_1.update)(iso2Elem, address.country_iso_2 || ""); | ||
} | ||
delete address.country_iso_2; | ||
const iso3Elem = (0, dom_1.toElem)(fields.country_iso || null, scope); | ||
if ((0, input_1.isSelect)(iso3Elem)) { | ||
if ((0, input_1.hasValue)(iso3Elem, address.country_iso)) | ||
(0, input_1.change)({ e: iso3Elem, value: address.country_iso_2 }); | ||
} | ||
if ((0, input_1.isInput)(iso3Elem)) | ||
(0, input_1.update)(iso3Elem, address.country_iso || ""); | ||
delete address.country_iso; | ||
let e; | ||
@@ -202,0 +219,0 @@ for (e in fields) { |
@@ -8,3 +8,3 @@ declare global { | ||
import { LoadState, Config } from "./types"; | ||
export declare const downloadAutocompleteStyle: (d?: Document | undefined) => HTMLStyleElement; | ||
export declare const downloadAutocompleteStyle: (d?: Document) => HTMLStyleElement; | ||
export declare const autocompletePresent: (w: Window) => boolean; | ||
@@ -11,0 +11,0 @@ export declare const loadAutocomplete: (config: Config) => LoadState; |
@@ -1,6 +0,3 @@ | ||
import { Country, ChannelIslandIso, CountryIso } from "./types"; | ||
import { GbrAddress, AnyAddress } from "./types"; | ||
export declare const toCiIso: (address: GbrAddress) => ChannelIslandIso | null; | ||
export declare const toIso: (address: AnyAddress) => CountryIso | null; | ||
export declare const toCountry: (address: AnyAddress) => Country | null; | ||
import { AnyAddress } from "./types"; | ||
export declare const toCountry: (address: AnyAddress) => string; | ||
export declare const updateCountry: (select: HTMLElement | null, address: AnyAddress) => void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.updateCountry = exports.toCountry = exports.toIso = exports.toCiIso = void 0; | ||
exports.updateCountry = exports.toCountry = void 0; | ||
const types_1 = require("./types"); | ||
const input_1 = require("./input"); | ||
const toCiIso = (address) => { | ||
if (/^GY/.test(address.postcode)) | ||
return "GG"; | ||
if (/^JE/.test(address.postcode)) | ||
return "JE"; | ||
return null; | ||
}; | ||
exports.toCiIso = toCiIso; | ||
const UK = "United Kingdom"; | ||
@@ -21,30 +13,2 @@ const IOM = "Isle of Man"; | ||
const CI = "Channel Islands"; | ||
const US = "United States"; | ||
const PR = "Puerto Rico"; | ||
const GU = "Guam"; | ||
const toIso = (address) => { | ||
const country = address.country; | ||
if (country === EN) | ||
return "GB"; | ||
if (country === SC) | ||
return "GB"; | ||
if (country === WA) | ||
return "GB"; | ||
if (country === NI) | ||
return "GB"; | ||
if (country === IOM) | ||
return "IM"; | ||
if (country === US) | ||
return "US"; | ||
if (country === PR) | ||
return "PR"; | ||
if (country === GU) | ||
return "GU"; | ||
if ((0, types_1.isGbrAddress)(address)) { | ||
if (country === CI) | ||
return (0, exports.toCiIso)(address); | ||
} | ||
return null; | ||
}; | ||
exports.toIso = toIso; | ||
const toCountry = (address) => { | ||
@@ -62,12 +26,11 @@ const country = address.country; | ||
return IOM; | ||
if (country === CI) { | ||
if ((0, types_1.isGbrAddress)(address)) { | ||
const iso = (0, exports.toCiIso)(address); | ||
if (iso === "GG") | ||
if ((0, types_1.isGbrAddress)(address)) { | ||
if (country === CI) { | ||
if (/^GY/.test(address.postcode)) | ||
return "Guernsey"; | ||
if (iso === "JE") | ||
if (/^JE/.test(address.postcode)) | ||
return "Jersey"; | ||
} | ||
} | ||
return address.country || null; | ||
return country; | ||
}; | ||
@@ -79,8 +42,9 @@ exports.toCountry = toCountry; | ||
if ((0, input_1.isSelect)(select)) { | ||
const iso = (0, exports.toIso)(address); | ||
if ((0, input_1.hasValue)(select, iso)) | ||
(0, input_1.change)({ e: select, value: iso }); | ||
const bcc = (0, exports.toCountry)(address); | ||
if ((0, input_1.hasValue)(select, bcc)) | ||
(0, input_1.change)({ e: select, value: bcc }); | ||
if ((0, input_1.hasValue)(select, address.country_iso_2)) | ||
(0, input_1.change)({ e: select, value: address.country_iso_2 }); | ||
if ((0, input_1.hasValue)(select, address.country_iso)) | ||
(0, input_1.change)({ e: select, value: address.country_iso }); | ||
} | ||
@@ -87,0 +51,0 @@ if ((0, input_1.isInput)(select)) { |
@@ -7,3 +7,3 @@ export declare const isObject: (value: any) => boolean; | ||
} | ||
export declare const debounce: (func: any, wait: number, options?: Options | undefined) => { | ||
export declare const debounce: (func: any, wait: number, options?: Options) => { | ||
(this: any, ...args: any): any; | ||
@@ -10,0 +10,0 @@ cancel: () => void; |
@@ -7,4 +7,4 @@ import { ParentTest, SelectorNode } from "./types"; | ||
export declare const getParent: (node: HTMLElement, entity: string, test?: ParentTest) => HTMLElement | null; | ||
export declare const toHtmlElem: (parent: HTMLElement, selector?: string | undefined) => HTMLElement | null; | ||
export declare const getAnchors: (selector: string, d?: Document | undefined) => HTMLElement[]; | ||
export declare const toHtmlElem: (parent: HTMLElement, selector?: string) => HTMLElement | null; | ||
export declare const getAnchors: (selector: string, d?: Document) => HTMLElement[]; | ||
interface InsertBeforeOptions { | ||
@@ -21,3 +21,3 @@ elem: HTMLElement; | ||
export declare const getDocument: (scope: HTMLElement | Document) => Document; | ||
export declare type CSSStyle = Partial<Record<keyof CSSStyleDeclaration, string>>; | ||
export type CSSStyle = Partial<Record<keyof CSSStyleDeclaration, string>>; | ||
export declare const setStyle: (element: HTMLElement, style: CSSStyle) => string | null; | ||
@@ -24,0 +24,0 @@ export declare const restoreStyle: (element: HTMLElement, style: string | null) => void; |
@@ -10,4 +10,4 @@ interface EventOptions { | ||
export declare const newEvent: NewEvent; | ||
export declare type Events = "change" | "input" | "select"; | ||
export type Events = "change" | "input" | "select"; | ||
export declare const trigger: (e: HTMLElement, event: Events) => boolean; | ||
export {}; |
@@ -6,3 +6,3 @@ export declare const isSelect: (e: HTMLElement | null) => e is HTMLSelectElement; | ||
export declare const hasValue: (select: HTMLElement, value: string | null) => boolean; | ||
declare type InputElement = HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement; | ||
type InputElement = HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement; | ||
interface SetValue { | ||
@@ -9,0 +9,0 @@ (e: InputElement, value: string): void; |
interface KeyCodeMapping { | ||
[key: number]: SupportedKey; | ||
} | ||
declare type SupportedKey = "Enter" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "Escape" | "Backspace"; | ||
type SupportedKey = "Enter" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "Escape" | "Backspace"; | ||
export declare const keyCodeMapping: KeyCodeMapping; | ||
@@ -6,0 +6,0 @@ export declare const supportedKeys: string[]; |
import { components } from "@ideal-postcodes/openapi"; | ||
export declare type UkSuggestion = components["schemas"]["UkAddressSuggestion"]; | ||
export declare type GlobalAddressSuggestion = components["schemas"]["AddressSuggestion"]; | ||
export declare type AddressSuggestion = GlobalAddressSuggestion | UkSuggestion; | ||
export declare type PafAddress = components["schemas"]["PafAddress"]; | ||
export declare type MrAddress = components["schemas"]["MrAddress"]; | ||
export declare type NybAddress = components["schemas"]["NybAddress"]; | ||
export declare type PafaAddress = components["schemas"]["PafAliasAddress"]; | ||
export declare type WelshPafAddress = components["schemas"]["WelshPafAddress"]; | ||
export declare type GlobalAddress = components["schemas"]["GbrGlobalAddress"]; | ||
export declare type GbrAddress = PafAddress | MrAddress | NybAddress | PafaAddress | WelshPafAddress | GlobalAddress; | ||
export declare type UspsAddress = components["schemas"]["UspsAddress"]; | ||
export declare type UsaGlobalAddress = components["schemas"]["UsaGlobalAddress"]; | ||
export declare type UsaAddress = UspsAddress | UsaGlobalAddress; | ||
export declare type AnyAddress = GbrAddress | UsaAddress; | ||
export type UkSuggestion = components["schemas"]["UkAddressSuggestion"]; | ||
export type GlobalAddressSuggestion = components["schemas"]["AddressSuggestion"]; | ||
export type AddressSuggestion = GlobalAddressSuggestion | UkSuggestion; | ||
export type PafAddress = components["schemas"]["PafAddress"]; | ||
export type MrAddress = components["schemas"]["MrAddress"]; | ||
export type NybAddress = components["schemas"]["NybAddress"]; | ||
export type PafaAddress = components["schemas"]["PafAliasAddress"]; | ||
export type WelshPafAddress = components["schemas"]["WelshPafAddress"]; | ||
export type GlobalAddress = components["schemas"]["GbrGlobalAddress"]; | ||
export type GbrAddress = PafAddress | MrAddress | NybAddress | PafaAddress | WelshPafAddress | GlobalAddress; | ||
export type UspsAddress = components["schemas"]["UspsAddress"]; | ||
export type UsaGlobalAddress = components["schemas"]["UsaGlobalAddress"]; | ||
export type UsaAddress = UspsAddress | UsaGlobalAddress; | ||
export type AnyAddress = GbrAddress | UsaAddress; | ||
export interface Binding { | ||
@@ -64,17 +64,13 @@ pageTest: PageTest; | ||
} | ||
export declare type AutocompleteConfig = any; | ||
export declare type PostcodeLookupConfig = any; | ||
export declare type ChannelIslandIso = "JE" | "GG"; | ||
export declare type UspsIso = "US" | "GU" | "PR"; | ||
export declare type CountryIso = "GB" | "IM" | ChannelIslandIso | UspsIso; | ||
export declare type Country = components["schemas"]["Country"] | "United Kingdom" | "Channel Islands"; | ||
export declare type LineCount = 1 | 2 | 3; | ||
export declare type LoadState = "complete" | "loading"; | ||
export type AutocompleteConfig = any; | ||
export type PostcodeLookupConfig = any; | ||
export type LineCount = 1 | 2 | 3; | ||
export type LoadState = "complete" | "loading"; | ||
export interface ParentTest { | ||
(e: HTMLElement): boolean; | ||
} | ||
export declare type OutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export declare type UsaOutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export declare type NamedFields = Partial<Record<keyof GbrAddress, string>>; | ||
export declare type SelectorNode = string | HTMLInputElement | HTMLTextAreaElement; | ||
export type OutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export type UsaOutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export type NamedFields = Partial<Record<keyof GbrAddress, string>>; | ||
export type SelectorNode = string | HTMLInputElement | HTMLTextAreaElement; | ||
export declare const isGbrAddress: (address: AnyAddress) => address is GbrAddress; |
@@ -10,7 +10,7 @@ import { AnyAddress, GbrAddress } from "./types"; | ||
export declare const toMaxLengthLines: (l: string[], options: MaxLengthOptions) => [string, string, string]; | ||
export declare type MaxLengths = [number?, number?, number?]; | ||
export type MaxLengths = [number?, number?, number?]; | ||
interface MaxLengthOptions { | ||
} | ||
export declare const toAddressLines: (lineCount: LineCount, address: AnyAddress, options: MaxLineConfig) => [string, string, string]; | ||
declare type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
export declare const extract: (a: AnyAddress, attr: KeysOfUnion<AnyAddress>) => string; | ||
@@ -17,0 +17,0 @@ export declare const getFields: (o: PopulateAddressOptions) => OutputFields; |
import { capitalisePostTown } from "capitalise-post-town"; | ||
import { update } from "./input"; | ||
import { update, change, isSelect, isInput, hasValue } from "./input"; | ||
import { toElem, contains } from "./dom"; | ||
@@ -188,2 +188,19 @@ import { updateCountry } from "./country"; | ||
delete address.country; | ||
const iso2Elem = toElem(fields.country_iso_2 || null, scope); | ||
if (isSelect(iso2Elem)) { | ||
if (hasValue(iso2Elem, address.country_iso_2)) | ||
change({ e: iso2Elem, value: address.country_iso_2 }); | ||
} | ||
if (isInput(iso2Elem)) { | ||
update(iso2Elem, address.country_iso_2 || ""); | ||
} | ||
delete address.country_iso_2; | ||
const iso3Elem = toElem(fields.country_iso || null, scope); | ||
if (isSelect(iso3Elem)) { | ||
if (hasValue(iso3Elem, address.country_iso)) | ||
change({ e: iso3Elem, value: address.country_iso_2 }); | ||
} | ||
if (isInput(iso3Elem)) | ||
update(iso3Elem, address.country_iso || ""); | ||
delete address.country_iso; | ||
let e; | ||
@@ -190,0 +207,0 @@ for (e in fields) { |
@@ -8,3 +8,3 @@ declare global { | ||
import { LoadState, Config } from "./types"; | ||
export declare const downloadAutocompleteStyle: (d?: Document | undefined) => HTMLStyleElement; | ||
export declare const downloadAutocompleteStyle: (d?: Document) => HTMLStyleElement; | ||
export declare const autocompletePresent: (w: Window) => boolean; | ||
@@ -11,0 +11,0 @@ export declare const loadAutocomplete: (config: Config) => LoadState; |
@@ -1,6 +0,3 @@ | ||
import { Country, ChannelIslandIso, CountryIso } from "./types"; | ||
import { GbrAddress, AnyAddress } from "./types"; | ||
export declare const toCiIso: (address: GbrAddress) => ChannelIslandIso | null; | ||
export declare const toIso: (address: AnyAddress) => CountryIso | null; | ||
export declare const toCountry: (address: AnyAddress) => Country | null; | ||
import { AnyAddress } from "./types"; | ||
export declare const toCountry: (address: AnyAddress) => string; | ||
export declare const updateCountry: (select: HTMLElement | null, address: AnyAddress) => void; |
import { isGbrAddress } from "./types"; | ||
import { isSelect, isInput, hasValue, change } from "./input"; | ||
export const toCiIso = (address) => { | ||
if (/^GY/.test(address.postcode)) | ||
return "GG"; | ||
if (/^JE/.test(address.postcode)) | ||
return "JE"; | ||
return null; | ||
}; | ||
const UK = "United Kingdom"; | ||
@@ -17,29 +10,2 @@ const IOM = "Isle of Man"; | ||
const CI = "Channel Islands"; | ||
const US = "United States"; | ||
const PR = "Puerto Rico"; | ||
const GU = "Guam"; | ||
export const toIso = (address) => { | ||
const country = address.country; | ||
if (country === EN) | ||
return "GB"; | ||
if (country === SC) | ||
return "GB"; | ||
if (country === WA) | ||
return "GB"; | ||
if (country === NI) | ||
return "GB"; | ||
if (country === IOM) | ||
return "IM"; | ||
if (country === US) | ||
return "US"; | ||
if (country === PR) | ||
return "PR"; | ||
if (country === GU) | ||
return "GU"; | ||
if (isGbrAddress(address)) { | ||
if (country === CI) | ||
return toCiIso(address); | ||
} | ||
return null; | ||
}; | ||
export const toCountry = (address) => { | ||
@@ -57,12 +23,11 @@ const country = address.country; | ||
return IOM; | ||
if (country === CI) { | ||
if (isGbrAddress(address)) { | ||
const iso = toCiIso(address); | ||
if (iso === "GG") | ||
if (isGbrAddress(address)) { | ||
if (country === CI) { | ||
if (/^GY/.test(address.postcode)) | ||
return "Guernsey"; | ||
if (iso === "JE") | ||
if (/^JE/.test(address.postcode)) | ||
return "Jersey"; | ||
} | ||
} | ||
return address.country || null; | ||
return country; | ||
}; | ||
@@ -73,8 +38,9 @@ export const updateCountry = (select, address) => { | ||
if (isSelect(select)) { | ||
const iso = toIso(address); | ||
if (hasValue(select, iso)) | ||
change({ e: select, value: iso }); | ||
const bcc = toCountry(address); | ||
if (hasValue(select, bcc)) | ||
change({ e: select, value: bcc }); | ||
if (hasValue(select, address.country_iso_2)) | ||
change({ e: select, value: address.country_iso_2 }); | ||
if (hasValue(select, address.country_iso)) | ||
change({ e: select, value: address.country_iso }); | ||
} | ||
@@ -81,0 +47,0 @@ if (isInput(select)) { |
@@ -7,3 +7,3 @@ export declare const isObject: (value: any) => boolean; | ||
} | ||
export declare const debounce: (func: any, wait: number, options?: Options | undefined) => { | ||
export declare const debounce: (func: any, wait: number, options?: Options) => { | ||
(this: any, ...args: any): any; | ||
@@ -10,0 +10,0 @@ cancel: () => void; |
@@ -7,4 +7,4 @@ import { ParentTest, SelectorNode } from "./types"; | ||
export declare const getParent: (node: HTMLElement, entity: string, test?: ParentTest) => HTMLElement | null; | ||
export declare const toHtmlElem: (parent: HTMLElement, selector?: string | undefined) => HTMLElement | null; | ||
export declare const getAnchors: (selector: string, d?: Document | undefined) => HTMLElement[]; | ||
export declare const toHtmlElem: (parent: HTMLElement, selector?: string) => HTMLElement | null; | ||
export declare const getAnchors: (selector: string, d?: Document) => HTMLElement[]; | ||
interface InsertBeforeOptions { | ||
@@ -21,3 +21,3 @@ elem: HTMLElement; | ||
export declare const getDocument: (scope: HTMLElement | Document) => Document; | ||
export declare type CSSStyle = Partial<Record<keyof CSSStyleDeclaration, string>>; | ||
export type CSSStyle = Partial<Record<keyof CSSStyleDeclaration, string>>; | ||
export declare const setStyle: (element: HTMLElement, style: CSSStyle) => string | null; | ||
@@ -24,0 +24,0 @@ export declare const restoreStyle: (element: HTMLElement, style: string | null) => void; |
@@ -10,4 +10,4 @@ interface EventOptions { | ||
export declare const newEvent: NewEvent; | ||
export declare type Events = "change" | "input" | "select"; | ||
export type Events = "change" | "input" | "select"; | ||
export declare const trigger: (e: HTMLElement, event: Events) => boolean; | ||
export {}; |
@@ -6,3 +6,3 @@ export declare const isSelect: (e: HTMLElement | null) => e is HTMLSelectElement; | ||
export declare const hasValue: (select: HTMLElement, value: string | null) => boolean; | ||
declare type InputElement = HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement; | ||
type InputElement = HTMLSelectElement | HTMLInputElement | HTMLTextAreaElement; | ||
interface SetValue { | ||
@@ -9,0 +9,0 @@ (e: InputElement, value: string): void; |
interface KeyCodeMapping { | ||
[key: number]: SupportedKey; | ||
} | ||
declare type SupportedKey = "Enter" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "Escape" | "Backspace"; | ||
type SupportedKey = "Enter" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "Escape" | "Backspace"; | ||
export declare const keyCodeMapping: KeyCodeMapping; | ||
@@ -6,0 +6,0 @@ export declare const supportedKeys: string[]; |
import { components } from "@ideal-postcodes/openapi"; | ||
export declare type UkSuggestion = components["schemas"]["UkAddressSuggestion"]; | ||
export declare type GlobalAddressSuggestion = components["schemas"]["AddressSuggestion"]; | ||
export declare type AddressSuggestion = GlobalAddressSuggestion | UkSuggestion; | ||
export declare type PafAddress = components["schemas"]["PafAddress"]; | ||
export declare type MrAddress = components["schemas"]["MrAddress"]; | ||
export declare type NybAddress = components["schemas"]["NybAddress"]; | ||
export declare type PafaAddress = components["schemas"]["PafAliasAddress"]; | ||
export declare type WelshPafAddress = components["schemas"]["WelshPafAddress"]; | ||
export declare type GlobalAddress = components["schemas"]["GbrGlobalAddress"]; | ||
export declare type GbrAddress = PafAddress | MrAddress | NybAddress | PafaAddress | WelshPafAddress | GlobalAddress; | ||
export declare type UspsAddress = components["schemas"]["UspsAddress"]; | ||
export declare type UsaGlobalAddress = components["schemas"]["UsaGlobalAddress"]; | ||
export declare type UsaAddress = UspsAddress | UsaGlobalAddress; | ||
export declare type AnyAddress = GbrAddress | UsaAddress; | ||
export type UkSuggestion = components["schemas"]["UkAddressSuggestion"]; | ||
export type GlobalAddressSuggestion = components["schemas"]["AddressSuggestion"]; | ||
export type AddressSuggestion = GlobalAddressSuggestion | UkSuggestion; | ||
export type PafAddress = components["schemas"]["PafAddress"]; | ||
export type MrAddress = components["schemas"]["MrAddress"]; | ||
export type NybAddress = components["schemas"]["NybAddress"]; | ||
export type PafaAddress = components["schemas"]["PafAliasAddress"]; | ||
export type WelshPafAddress = components["schemas"]["WelshPafAddress"]; | ||
export type GlobalAddress = components["schemas"]["GbrGlobalAddress"]; | ||
export type GbrAddress = PafAddress | MrAddress | NybAddress | PafaAddress | WelshPafAddress | GlobalAddress; | ||
export type UspsAddress = components["schemas"]["UspsAddress"]; | ||
export type UsaGlobalAddress = components["schemas"]["UsaGlobalAddress"]; | ||
export type UsaAddress = UspsAddress | UsaGlobalAddress; | ||
export type AnyAddress = GbrAddress | UsaAddress; | ||
export interface Binding { | ||
@@ -64,17 +64,13 @@ pageTest: PageTest; | ||
} | ||
export declare type AutocompleteConfig = any; | ||
export declare type PostcodeLookupConfig = any; | ||
export declare type ChannelIslandIso = "JE" | "GG"; | ||
export declare type UspsIso = "US" | "GU" | "PR"; | ||
export declare type CountryIso = "GB" | "IM" | ChannelIslandIso | UspsIso; | ||
export declare type Country = components["schemas"]["Country"] | "United Kingdom" | "Channel Islands"; | ||
export declare type LineCount = 1 | 2 | 3; | ||
export declare type LoadState = "complete" | "loading"; | ||
export type AutocompleteConfig = any; | ||
export type PostcodeLookupConfig = any; | ||
export type LineCount = 1 | 2 | 3; | ||
export type LoadState = "complete" | "loading"; | ||
export interface ParentTest { | ||
(e: HTMLElement): boolean; | ||
} | ||
export declare type OutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export declare type UsaOutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export declare type NamedFields = Partial<Record<keyof GbrAddress, string>>; | ||
export declare type SelectorNode = string | HTMLInputElement | HTMLTextAreaElement; | ||
export type OutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export type UsaOutputFields = Partial<Record<keyof GbrAddress, SelectorNode>>; | ||
export type NamedFields = Partial<Record<keyof GbrAddress, string>>; | ||
export type SelectorNode = string | HTMLInputElement | HTMLTextAreaElement; | ||
export declare const isGbrAddress: (address: AnyAddress) => address is GbrAddress; |
{ | ||
"name": "@ideal-postcodes/jsutil", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"description": "Browser Address Autocomplete for api.ideal-postcodes.co.uk", | ||
@@ -27,3 +27,2 @@ "author": { | ||
"coverage": "codecov", | ||
"docs": "typedoc", | ||
"prepublishOnly": "npm run build", | ||
@@ -112,5 +111,3 @@ "test": "karma start", | ||
"@cablanchard/tsconfig": "~2.0.0", | ||
"@ideal-postcodes/api-fixtures": "~1.3.0", | ||
"@ideal-postcodes/api-typings": "^2.1.0", | ||
"@ideal-postcodes/doc-assets": "~1.0.6", | ||
"@ideal-postcodes/api-typings": "~2.1.0", | ||
"@ideal-postcodes/openapi": "3.1.0", | ||
@@ -121,3 +118,3 @@ "@ideal-postcodes/supported-browsers": "~2.5.0", | ||
"@types/mocha": "~9.1.0", | ||
"@types/node": "~18.6.4", | ||
"@types/node": "~20.8.8", | ||
"@types/prettier": "~2.7.0", | ||
@@ -135,3 +132,3 @@ "agadoo": "~2.0.0", | ||
"karma-mocha": "~2.0.1", | ||
"karma-typescript": "~5.5.1", | ||
"karma-typescript": "~5.5.4", | ||
"karma-typescript-es6-transform": "~5.5.2", | ||
@@ -146,5 +143,4 @@ "mocha": "~9.2.0", | ||
"ts-node": "~10.7.0", | ||
"typedoc": "^0.22.7", | ||
"typescript": "~4.6.3" | ||
"typescript": "~5.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34
108827
2583