Last active
February 12, 2024 21:17
-
-
Save cwparsons/71b226916ebdb44d6b7a7dfdee95f94f to your computer and use it in GitHub Desktop.
A TypeScript definition file for Canada Post's AddressComplete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace pca { | |
class Eventable { | |
constructor(source: any); | |
listen: (event: string, action: any) => void; | |
} | |
class Address extends Eventable { | |
constructor(fields?: Address.Binding[], options?: Address.Options); | |
} | |
const fieldMode: { | |
COUNTRY: number; | |
DEFAULT: number; | |
NONE: number; | |
POPULATE: number; | |
PRESERVE: number; | |
SEARCH: number; | |
}; | |
enum FieldMode { | |
COUNTRY = 8, | |
DEFAULT = 3, | |
NONE = 0, | |
POPULATE = 2, | |
PRESERVE = 4, | |
SEARCH = 1 | |
} | |
namespace Address { | |
interface Binding { | |
element: string; | |
field: string; | |
mode: FieldMode; | |
} | |
interface Options { | |
key: string; | |
name?: string; | |
populate?: boolean; | |
onlyInputs?: boolean; | |
autoSearch?: boolean; | |
preselect?: boolean; | |
prompt?: boolean; | |
promptDelay?: number; | |
inlineMessages?: boolean; | |
setCursor?: boolean; | |
matchCount?: boolean; | |
minSearch?: number; | |
minItems?: number; | |
maxItems?: number; | |
manualEntry?: boolean; | |
manualEntryItem?: boolean; | |
disableTime?: number; | |
suppressAutocomplete?: boolean; | |
setCountryByIP?: boolean; | |
culture?: string; | |
languagePreference?: string; | |
filteringMode?: any; // pca.filteringMode; | |
orderingMode?: any; // pca.orderingMode; | |
countries?: any; // pca.CountryList.Options; | |
list?: any; // pca.AutoComplete.Options; | |
bar?: any; // pca.Address.BarOptions; | |
search?: any; // pca.Address.SearchOptions; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment