mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-19 11:15:21 +01:00
Extract constants for autofill into separate file
This commit is contained in:
parent
1dab87f43c
commit
0fbeabf7a6
@ -21,116 +21,7 @@ import AutofillScript from '../models/autofillScript';
|
||||
|
||||
import { BrowserApi } from '../browser/browserApi';
|
||||
|
||||
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
||||
'placeholder', 'label-left', 'label-top', 'data-recurly'];
|
||||
|
||||
const CardAttributesExtended: string[] = [...CardAttributes, 'label-right'];
|
||||
|
||||
const IdentityAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
||||
'placeholder', 'label-left', 'label-top', 'data-recurly'];
|
||||
|
||||
const UsernameFieldNames: string[] = [
|
||||
// English
|
||||
'username', 'user name', 'email', 'email address', 'e-mail', 'e-mail address', 'userid', 'user id',
|
||||
'customer id', 'login id',
|
||||
// German
|
||||
'benutzername', 'benutzer name', 'email adresse', 'e-mail adresse', 'benutzerid', 'benutzer id'];
|
||||
|
||||
const FirstnameFieldNames: string[] = [
|
||||
// English
|
||||
'f-name', 'first-name', 'given-name', 'first-n',
|
||||
// German
|
||||
'vorname',
|
||||
];
|
||||
|
||||
const LastnameFieldNames: string[] = [
|
||||
// English
|
||||
'l-name', 'last-name', 's-name', 'surname', 'family-name', 'family-n', 'last-n',
|
||||
// German
|
||||
'nachname', 'familienname',
|
||||
];
|
||||
|
||||
const ExcludedAutofillTypes: string[] = ['radio', 'checkbox', 'hidden', 'file', 'button', 'image', 'reset', 'search'];
|
||||
|
||||
// Each index represents a language. These three arrays should all be the same length.
|
||||
// 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese
|
||||
const MonthAbbr = ['mm', 'mm', 'mm', 'mm', 'mm', 'mm'];
|
||||
const YearAbbrShort = ['yy', 'åå', 'jj', 'aa', 'гг', 'rr'];
|
||||
const YearAbbrLong = ['yyyy', 'åååå', 'jjjj', 'aa', 'гггг', 'rrrr'];
|
||||
|
||||
const OperationDelays = new Map<string, number>([
|
||||
['buzzsprout.com', 100],
|
||||
]);
|
||||
|
||||
/* tslint:disable */
|
||||
const IsoCountries: { [id: string]: string; } = {
|
||||
afghanistan: "AF", "aland islands": "AX", albania: "AL", algeria: "DZ", "american samoa": "AS", andorra: "AD",
|
||||
angola: "AO", anguilla: "AI", antarctica: "AQ", "antigua and barbuda": "AG", argentina: "AR", armenia: "AM",
|
||||
aruba: "AW", australia: "AU", austria: "AT", azerbaijan: "AZ", bahamas: "BS", bahrain: "BH", bangladesh: "BD",
|
||||
barbados: "BB", belarus: "BY", belgium: "BE", belize: "BZ", benin: "BJ", bermuda: "BM", bhutan: "BT",
|
||||
bolivia: "BO", "bosnia and herzegovina": "BA", botswana: "BW", "bouvet island": "BV", brazil: "BR",
|
||||
"british indian ocean territory": "IO", "brunei darussalam": "BN", bulgaria: "BG", "burkina faso": "BF",
|
||||
burundi: "BI", cambodia: "KH", cameroon: "CM", canada: "CA", "cape verde": "CV", "cayman islands": "KY",
|
||||
"central african republic": "CF", chad: "TD", chile: "CL", china: "CN", "christmas island": "CX",
|
||||
"cocos (keeling) islands": "CC", colombia: "CO", comoros: "KM", congo: "CG", "congo, democratic republic": "CD",
|
||||
"cook islands": "CK", "costa rica": "CR", "cote d'ivoire": "CI", croatia: "HR", cuba: "CU", cyprus: "CY",
|
||||
"czech republic": "CZ", denmark: "DK", djibouti: "DJ", dominica: "DM", "dominican republic": "DO", ecuador: "EC",
|
||||
egypt: "EG", "el salvador": "SV", "equatorial guinea": "GQ", eritrea: "ER", estonia: "EE", ethiopia: "ET",
|
||||
"falkland islands": "FK", "faroe islands": "FO", fiji: "FJ", finland: "FI", france: "FR", "french guiana": "GF",
|
||||
"french polynesia": "PF", "french southern territories": "TF", gabon: "GA", gambia: "GM", georgia: "GE",
|
||||
germany: "DE", ghana: "GH", gibraltar: "GI", greece: "GR", greenland: "GL", grenada: "GD", guadeloupe: "GP",
|
||||
guam: "GU", guatemala: "GT", guernsey: "GG", guinea: "GN", "guinea-bissau": "GW", guyana: "GY", haiti: "HT",
|
||||
"heard island & mcdonald islands": "HM", "holy see (vatican city state)": "VA", honduras: "HN", "hong kong": "HK",
|
||||
hungary: "HU", iceland: "IS", india: "IN", indonesia: "ID", "iran, islamic republic of": "IR", iraq: "IQ",
|
||||
ireland: "IE", "isle of man": "IM", israel: "IL", italy: "IT", jamaica: "JM", japan: "JP", jersey: "JE",
|
||||
jordan: "JO", kazakhstan: "KZ", kenya: "KE", kiribati: "KI", "republic of korea": "KR", "south korea": "KR",
|
||||
"democratic people's republic of korea": "KP", "north korea": "KP", kuwait: "KW", kyrgyzstan: "KG",
|
||||
"lao people's democratic republic": "LA", latvia: "LV", lebanon: "LB", lesotho: "LS", liberia: "LR",
|
||||
"libyan arab jamahiriya": "LY", liechtenstein: "LI", lithuania: "LT", luxembourg: "LU", macao: "MO",
|
||||
macedonia: "MK", madagascar: "MG", malawi: "MW", malaysia: "MY", maldives: "MV", mali: "ML", malta: "MT",
|
||||
"marshall islands": "MH", martinique: "MQ", mauritania: "MR", mauritius: "MU", mayotte: "YT", mexico: "MX",
|
||||
"micronesia, federated states of": "FM", moldova: "MD", monaco: "MC", mongolia: "MN", montenegro: "ME",
|
||||
montserrat: "MS", morocco: "MA", mozambique: "MZ", myanmar: "MM", namibia: "NA", nauru: "NR", nepal: "NP",
|
||||
netherlands: "NL", "netherlands antilles": "AN", "new caledonia": "NC", "new zealand": "NZ", nicaragua: "NI",
|
||||
niger: "NE", nigeria: "NG", niue: "NU", "norfolk island": "NF", "northern mariana islands": "MP", norway: "NO",
|
||||
oman: "OM", pakistan: "PK", palau: "PW", "palestinian territory, occupied": "PS", panama: "PA",
|
||||
"papua new guinea": "PG", paraguay: "PY", peru: "PE", philippines: "PH", pitcairn: "PN", poland: "PL",
|
||||
portugal: "PT", "puerto rico": "PR", qatar: "QA", reunion: "RE", romania: "RO", "russian federation": "RU",
|
||||
rwanda: "RW", "saint barthelemy": "BL", "saint helena": "SH", "saint kitts and nevis": "KN", "saint lucia": "LC",
|
||||
"saint martin": "MF", "saint pierre and miquelon": "PM", "saint vincent and grenadines": "VC", samoa: "WS",
|
||||
"san marino": "SM", "sao tome and principe": "ST", "saudi arabia": "SA", senegal: "SN", serbia: "RS",
|
||||
seychelles: "SC", "sierra leone": "SL", singapore: "SG", slovakia: "SK", slovenia: "SI", "solomon islands": "SB",
|
||||
somalia: "SO", "south africa": "ZA", "south georgia and sandwich isl.": "GS", spain: "ES", "sri lanka": "LK",
|
||||
sudan: "SD", suriname: "SR", "svalbard and jan mayen": "SJ", swaziland: "SZ", sweden: "SE", switzerland: "CH",
|
||||
"syrian arab republic": "SY", taiwan: "TW", tajikistan: "TJ", tanzania: "TZ", thailand: "TH", "timor-leste": "TL",
|
||||
togo: "TG", tokelau: "TK", tonga: "TO", "trinidad and tobago": "TT", tunisia: "TN", turkey: "TR",
|
||||
turkmenistan: "TM", "turks and caicos islands": "TC", tuvalu: "TV", uganda: "UG", ukraine: "UA",
|
||||
"united arab emirates": "AE", "united kingdom": "GB", "united states": "US",
|
||||
"united states outlying islands": "UM", uruguay: "UY", uzbekistan: "UZ", vanuatu: "VU", venezuela: "VE",
|
||||
vietnam: "VN", "virgin islands, british": "VG", "virgin islands, u.s.": "VI", "wallis and futuna": "WF",
|
||||
"western sahara": "EH", yemen: "YE", zambia: "ZM", zimbabwe: "ZW",
|
||||
};
|
||||
|
||||
const IsoStates: { [id: string]: string; } = {
|
||||
alabama: 'AL', alaska: 'AK', 'american samoa': 'AS', arizona: 'AZ', arkansas: 'AR', california: 'CA',
|
||||
colorado: 'CO', connecticut: 'CT', delaware: 'DE', 'district of columbia': 'DC',
|
||||
'federated states of micronesia': 'FM', florida: 'FL', georgia: 'GA', guam: 'GU', hawaii: 'HI', idaho: 'ID',
|
||||
illinois: 'IL', indiana: 'IN', iowa: 'IA', kansas: 'KS', kentucky: 'KY', louisiana: 'LA', maine: 'ME',
|
||||
'marshall islands': 'MH', maryland: 'MD', massachusetts: 'MA', michigan: 'MI', minnesota: 'MN', mississippi: 'MS',
|
||||
missouri: 'MO', montana: 'MT', nebraska: 'NE', nevada: 'NV', 'new hampshire': 'NH', 'new jersey': 'NJ',
|
||||
'new mexico': 'NM', 'new york': 'NY', 'north carolina': 'NC', 'north dakota': 'ND',
|
||||
'northern mariana islands': 'MP', ohio: 'OH', oklahoma: 'OK', oregon: 'OR', palau: 'PW', pennsylvania: 'PA',
|
||||
'puerto rico': 'PR', 'rhode island': 'RI', 'south carolina': 'SC', 'south dakota': 'SD', tennessee: 'TN',
|
||||
texas: 'TX', utah: 'UT', vermont: 'VT', 'virgin islands': 'VI', virginia: 'VA', washington: 'WA',
|
||||
'west virginia': 'WV', wisconsin: 'WI', wyoming: 'WY',
|
||||
};
|
||||
|
||||
var IsoProvinces: { [id: string]: string; } = {
|
||||
alberta: 'AB', 'british columbia': 'BC', manitoba: 'MB', 'new brunswick': 'NB', 'newfoundland and labrador': 'NL',
|
||||
'nova scotia': 'NS', ontario: 'ON', 'prince edward island': 'PE', quebec: 'QC', saskatchewan: 'SK',
|
||||
};
|
||||
// /* tslint:enable */
|
||||
|
||||
import { AutoFillConstants } from './autofillConstants';
|
||||
export default class AutofillService implements AutofillServiceInterface {
|
||||
|
||||
constructor(private cipherService: CipherService, private userService: UserService,
|
||||
@ -437,7 +328,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
// No password fields on this page. Let's try to just fuzzy fill the username.
|
||||
pageDetails.fields.forEach((f: any) => {
|
||||
if (f.viewable && (f.type === 'text' || f.type === 'email' || f.type === 'tel') &&
|
||||
this.fieldIsFuzzyMatch(f, UsernameFieldNames)) {
|
||||
this.fieldIsFuzzyMatch(f, AutoFillConstants.UsernameFieldNames)) {
|
||||
usernames.push(f);
|
||||
}
|
||||
});
|
||||
@ -478,12 +369,12 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isExcludedType(f.type, ExcludedAutofillTypes)) {
|
||||
if (this.isExcludedType(f.type, AutoFillConstants.ExcludedAutofillTypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < CardAttributes.length; i++) {
|
||||
const attr = CardAttributes[i];
|
||||
for (let i = 0; i < AutoFillConstants.CardAttributes.length; i++) {
|
||||
const attr = AutoFillConstants.CardAttributes[i];
|
||||
if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) {
|
||||
continue;
|
||||
}
|
||||
@ -634,36 +525,36 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
}
|
||||
|
||||
let exp: string = null;
|
||||
for (let i = 0; i < MonthAbbr.length; i++) {
|
||||
if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '/' + YearAbbrShort[i]) &&
|
||||
for (let i = 0; i < AutoFillConstants.MonthAbbr.length; i++) {
|
||||
if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrShort[i]) &&
|
||||
partYear != null) {
|
||||
exp = fullMonth + '/' + partYear;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '/' + YearAbbrLong[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '/' + AutoFillConstants.YearAbbrLong[i])) {
|
||||
exp = fullMonth + '/' + fullYear;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + '/' + MonthAbbr[i]) &&
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '/' + AutoFillConstants.MonthAbbr[i]) &&
|
||||
partYear != null) {
|
||||
exp = partYear + '/' + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + '/' + MonthAbbr[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '/' + AutoFillConstants.MonthAbbr[i])) {
|
||||
exp = fullYear + '/' + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '-' + YearAbbrShort[i]) &&
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrShort[i]) &&
|
||||
partYear != null) {
|
||||
exp = fullMonth + '-' + partYear;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + '-' + YearAbbrLong[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + '-' + AutoFillConstants.YearAbbrLong[i])) {
|
||||
exp = fullMonth + '-' + fullYear;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + '-' + MonthAbbr[i]) &&
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + '-' + AutoFillConstants.MonthAbbr[i]) &&
|
||||
partYear != null) {
|
||||
exp = partYear + '-' + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + '-' + MonthAbbr[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + '-' + AutoFillConstants.MonthAbbr[i])) {
|
||||
exp = fullYear + '-' + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrShort[i] + MonthAbbr[i]) &&
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrShort[i] + AutoFillConstants.MonthAbbr[i]) &&
|
||||
partYear != null) {
|
||||
exp = partYear + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, YearAbbrLong[i] + MonthAbbr[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.YearAbbrLong[i] + AutoFillConstants.MonthAbbr[i])) {
|
||||
exp = fullYear + fullMonth;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + YearAbbrShort[i]) &&
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrShort[i]) &&
|
||||
partYear != null) {
|
||||
exp = fullMonth + partYear;
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, MonthAbbr[i] + YearAbbrLong[i])) {
|
||||
} else if (this.fieldAttrsContain(fillFields.exp, AutoFillConstants.MonthAbbr[i] + AutoFillConstants.YearAbbrLong[i])) {
|
||||
exp = fullMonth + fullYear;
|
||||
}
|
||||
|
||||
@ -688,7 +579,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
}
|
||||
|
||||
let doesContain = false;
|
||||
CardAttributesExtended.forEach(attr => {
|
||||
AutoFillConstants.CardAttributesExtended.forEach(attr => {
|
||||
if (doesContain || !field.hasOwnProperty(attr) || !field[attr]) {
|
||||
return;
|
||||
}
|
||||
@ -714,12 +605,12 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isExcludedType(f.type, ExcludedAutofillTypes)) {
|
||||
if (this.isExcludedType(f.type, AutoFillConstants.ExcludedAutofillTypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < IdentityAttributes.length; i++) {
|
||||
const attr = IdentityAttributes[i];
|
||||
for (let i = 0; i < AutoFillConstants.IdentityAttributes.length; i++) {
|
||||
const attr = AutoFillConstants.IdentityAttributes[i];
|
||||
if (!f.hasOwnProperty(attr) || !f[attr] || !f.viewable) {
|
||||
continue;
|
||||
}
|
||||
@ -731,7 +622,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
fillFields.name = f;
|
||||
break;
|
||||
} else if (!fillFields.firstName && this.isFieldMatch(f[attr],
|
||||
FirstnameFieldNames)) {
|
||||
AutoFillConstants.FirstnameFieldNames)) {
|
||||
fillFields.firstName = f;
|
||||
break;
|
||||
} else if (!fillFields.middleName && this.isFieldMatch(f[attr],
|
||||
@ -739,7 +630,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
fillFields.middleName = f;
|
||||
break;
|
||||
} else if (!fillFields.lastName && this.isFieldMatch(f[attr],
|
||||
LastnameFieldNames)) {
|
||||
AutoFillConstants.LastnameFieldNames)) {
|
||||
fillFields.lastName = f;
|
||||
break;
|
||||
} else if (!fillFields.title && this.isFieldMatch(f[attr],
|
||||
@ -820,7 +711,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
let filledState = false;
|
||||
if (fillFields.state && identity.state && identity.state.length > 2) {
|
||||
const stateLower = identity.state.toLowerCase();
|
||||
const isoState = IsoStates[stateLower] || IsoProvinces[stateLower];
|
||||
const isoState = AutoFillConstants.IsoStates[stateLower] || AutoFillConstants.IsoProvinces[stateLower];
|
||||
if (isoState) {
|
||||
filledState = true;
|
||||
this.makeScriptActionWithValue(fillScript, isoState, fillFields.state, filledFields);
|
||||
@ -834,7 +725,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
let filledCountry = false;
|
||||
if (fillFields.country && identity.country && identity.country.length > 2) {
|
||||
const countryLower = identity.country.toLowerCase();
|
||||
const isoCountry = IsoCountries[countryLower];
|
||||
const isoCountry = AutoFillConstants.IsoCountries[countryLower];
|
||||
if (isoCountry) {
|
||||
filledCountry = true;
|
||||
this.makeScriptActionWithValue(fillScript, isoCountry, fillFields.country, filledFields);
|
||||
@ -1016,7 +907,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||
(f.type === 'text' || f.type === 'email' || f.type === 'tel')) {
|
||||
usernameField = f;
|
||||
|
||||
if (this.findMatchingFieldIndex(f, UsernameFieldNames) > -1) {
|
||||
if (this.findMatchingFieldIndex(f, AutoFillConstants.UsernameFieldNames) > -1) {
|
||||
// We found an exact match. No need to keep looking.
|
||||
break;
|
||||
}
|
||||
|
420
src/services/autofillConstants.ts
Normal file
420
src/services/autofillConstants.ts
Normal file
@ -0,0 +1,420 @@
|
||||
export class AutoFillConstants {
|
||||
static readonly CardAttributes: string[] = [
|
||||
"autoCompleteType",
|
||||
"data-stripe",
|
||||
"htmlName",
|
||||
"htmlID",
|
||||
"label-tag",
|
||||
"placeholder",
|
||||
"label-left",
|
||||
"label-top",
|
||||
"data-recurly",
|
||||
];
|
||||
|
||||
static readonly CardAttributesExtended: string[] = [
|
||||
...AutoFillConstants.CardAttributes,
|
||||
"label-right",
|
||||
];
|
||||
|
||||
static readonly IdentityAttributes: string[] = [
|
||||
"autoCompleteType",
|
||||
"data-stripe",
|
||||
"htmlName",
|
||||
"htmlID",
|
||||
"label-tag",
|
||||
"placeholder",
|
||||
"label-left",
|
||||
"label-top",
|
||||
"data-recurly",
|
||||
];
|
||||
|
||||
static readonly UsernameFieldNames: string[] = [
|
||||
// English
|
||||
"username",
|
||||
"user name",
|
||||
"email",
|
||||
"email address",
|
||||
"e-mail",
|
||||
"e-mail address",
|
||||
"userid",
|
||||
"user id",
|
||||
"customer id",
|
||||
"login id",
|
||||
// German
|
||||
"benutzername",
|
||||
"benutzer name",
|
||||
"email adresse",
|
||||
"e-mail adresse",
|
||||
"benutzerid",
|
||||
"benutzer id",
|
||||
];
|
||||
|
||||
static readonly FirstnameFieldNames: string[] = [
|
||||
// English
|
||||
"f-name",
|
||||
"first-name",
|
||||
"given-name",
|
||||
"first-n",
|
||||
// German
|
||||
"vorname",
|
||||
];
|
||||
|
||||
static readonly LastnameFieldNames: string[] = [
|
||||
// English
|
||||
"l-name",
|
||||
"last-name",
|
||||
"s-name",
|
||||
"surname",
|
||||
"family-name",
|
||||
"family-n",
|
||||
"last-n",
|
||||
// German
|
||||
"nachname",
|
||||
"familienname",
|
||||
];
|
||||
|
||||
static readonly ExcludedAutofillTypes: string[] = [
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"file",
|
||||
"button",
|
||||
"image",
|
||||
"reset",
|
||||
"search",
|
||||
];
|
||||
|
||||
// Each index represents a language. These three arrays should all be the same length.
|
||||
// 0: English, 1: Danish, 2: German/Dutch, 3: French/Spanish/Italian, 4: Russian, 5: Portuguese
|
||||
static readonly MonthAbbr = ["mm", "mm", "mm", "mm", "mm", "mm"];
|
||||
static readonly YearAbbrShort = ["yy", "åå", "jj", "aa", "гг", "rr"];
|
||||
static readonly YearAbbrLong = ["yyyy", "åååå", "jjjj", "aa", "гггг", "rrrr"];
|
||||
|
||||
static readonly OperationDelays = new Map<string, number>([["buzzsprout.com", 100]]);
|
||||
|
||||
static readonly IsoCountries: { [id: string]: string } = {
|
||||
afghanistan: "AF",
|
||||
"aland islands": "AX",
|
||||
albania: "AL",
|
||||
algeria: "DZ",
|
||||
"american samoa": "AS",
|
||||
andorra: "AD",
|
||||
angola: "AO",
|
||||
anguilla: "AI",
|
||||
antarctica: "AQ",
|
||||
"antigua and barbuda": "AG",
|
||||
argentina: "AR",
|
||||
armenia: "AM",
|
||||
aruba: "AW",
|
||||
australia: "AU",
|
||||
austria: "AT",
|
||||
azerbaijan: "AZ",
|
||||
bahamas: "BS",
|
||||
bahrain: "BH",
|
||||
bangladesh: "BD",
|
||||
barbados: "BB",
|
||||
belarus: "BY",
|
||||
belgium: "BE",
|
||||
belize: "BZ",
|
||||
benin: "BJ",
|
||||
bermuda: "BM",
|
||||
bhutan: "BT",
|
||||
bolivia: "BO",
|
||||
"bosnia and herzegovina": "BA",
|
||||
botswana: "BW",
|
||||
"bouvet island": "BV",
|
||||
brazil: "BR",
|
||||
"british indian ocean territory": "IO",
|
||||
"brunei darussalam": "BN",
|
||||
bulgaria: "BG",
|
||||
"burkina faso": "BF",
|
||||
burundi: "BI",
|
||||
cambodia: "KH",
|
||||
cameroon: "CM",
|
||||
canada: "CA",
|
||||
"cape verde": "CV",
|
||||
"cayman islands": "KY",
|
||||
"central african republic": "CF",
|
||||
chad: "TD",
|
||||
chile: "CL",
|
||||
china: "CN",
|
||||
"christmas island": "CX",
|
||||
"cocos (keeling) islands": "CC",
|
||||
colombia: "CO",
|
||||
comoros: "KM",
|
||||
congo: "CG",
|
||||
"congo, democratic republic": "CD",
|
||||
"cook islands": "CK",
|
||||
"costa rica": "CR",
|
||||
"cote d'ivoire": "CI",
|
||||
croatia: "HR",
|
||||
cuba: "CU",
|
||||
cyprus: "CY",
|
||||
"czech republic": "CZ",
|
||||
denmark: "DK",
|
||||
djibouti: "DJ",
|
||||
dominica: "DM",
|
||||
"dominican republic": "DO",
|
||||
ecuador: "EC",
|
||||
egypt: "EG",
|
||||
"el salvador": "SV",
|
||||
"equatorial guinea": "GQ",
|
||||
eritrea: "ER",
|
||||
estonia: "EE",
|
||||
ethiopia: "ET",
|
||||
"falkland islands": "FK",
|
||||
"faroe islands": "FO",
|
||||
fiji: "FJ",
|
||||
finland: "FI",
|
||||
france: "FR",
|
||||
"french guiana": "GF",
|
||||
"french polynesia": "PF",
|
||||
"french southern territories": "TF",
|
||||
gabon: "GA",
|
||||
gambia: "GM",
|
||||
georgia: "GE",
|
||||
germany: "DE",
|
||||
ghana: "GH",
|
||||
gibraltar: "GI",
|
||||
greece: "GR",
|
||||
greenland: "GL",
|
||||
grenada: "GD",
|
||||
guadeloupe: "GP",
|
||||
guam: "GU",
|
||||
guatemala: "GT",
|
||||
guernsey: "GG",
|
||||
guinea: "GN",
|
||||
"guinea-bissau": "GW",
|
||||
guyana: "GY",
|
||||
haiti: "HT",
|
||||
"heard island & mcdonald islands": "HM",
|
||||
"holy see (vatican city state)": "VA",
|
||||
honduras: "HN",
|
||||
"hong kong": "HK",
|
||||
hungary: "HU",
|
||||
iceland: "IS",
|
||||
india: "IN",
|
||||
indonesia: "ID",
|
||||
"iran, islamic republic of": "IR",
|
||||
iraq: "IQ",
|
||||
ireland: "IE",
|
||||
"isle of man": "IM",
|
||||
israel: "IL",
|
||||
italy: "IT",
|
||||
jamaica: "JM",
|
||||
japan: "JP",
|
||||
jersey: "JE",
|
||||
jordan: "JO",
|
||||
kazakhstan: "KZ",
|
||||
kenya: "KE",
|
||||
kiribati: "KI",
|
||||
"republic of korea": "KR",
|
||||
"south korea": "KR",
|
||||
"democratic people's republic of korea": "KP",
|
||||
"north korea": "KP",
|
||||
kuwait: "KW",
|
||||
kyrgyzstan: "KG",
|
||||
"lao people's democratic republic": "LA",
|
||||
latvia: "LV",
|
||||
lebanon: "LB",
|
||||
lesotho: "LS",
|
||||
liberia: "LR",
|
||||
"libyan arab jamahiriya": "LY",
|
||||
liechtenstein: "LI",
|
||||
lithuania: "LT",
|
||||
luxembourg: "LU",
|
||||
macao: "MO",
|
||||
macedonia: "MK",
|
||||
madagascar: "MG",
|
||||
malawi: "MW",
|
||||
malaysia: "MY",
|
||||
maldives: "MV",
|
||||
mali: "ML",
|
||||
malta: "MT",
|
||||
"marshall islands": "MH",
|
||||
martinique: "MQ",
|
||||
mauritania: "MR",
|
||||
mauritius: "MU",
|
||||
mayotte: "YT",
|
||||
mexico: "MX",
|
||||
"micronesia, federated states of": "FM",
|
||||
moldova: "MD",
|
||||
monaco: "MC",
|
||||
mongolia: "MN",
|
||||
montenegro: "ME",
|
||||
montserrat: "MS",
|
||||
morocco: "MA",
|
||||
mozambique: "MZ",
|
||||
myanmar: "MM",
|
||||
namibia: "NA",
|
||||
nauru: "NR",
|
||||
nepal: "NP",
|
||||
netherlands: "NL",
|
||||
"netherlands antilles": "AN",
|
||||
"new caledonia": "NC",
|
||||
"new zealand": "NZ",
|
||||
nicaragua: "NI",
|
||||
niger: "NE",
|
||||
nigeria: "NG",
|
||||
niue: "NU",
|
||||
"norfolk island": "NF",
|
||||
"northern mariana islands": "MP",
|
||||
norway: "NO",
|
||||
oman: "OM",
|
||||
pakistan: "PK",
|
||||
palau: "PW",
|
||||
"palestinian territory, occupied": "PS",
|
||||
panama: "PA",
|
||||
"papua new guinea": "PG",
|
||||
paraguay: "PY",
|
||||
peru: "PE",
|
||||
philippines: "PH",
|
||||
pitcairn: "PN",
|
||||
poland: "PL",
|
||||
portugal: "PT",
|
||||
"puerto rico": "PR",
|
||||
qatar: "QA",
|
||||
reunion: "RE",
|
||||
romania: "RO",
|
||||
"russian federation": "RU",
|
||||
rwanda: "RW",
|
||||
"saint barthelemy": "BL",
|
||||
"saint helena": "SH",
|
||||
"saint kitts and nevis": "KN",
|
||||
"saint lucia": "LC",
|
||||
"saint martin": "MF",
|
||||
"saint pierre and miquelon": "PM",
|
||||
"saint vincent and grenadines": "VC",
|
||||
samoa: "WS",
|
||||
"san marino": "SM",
|
||||
"sao tome and principe": "ST",
|
||||
"saudi arabia": "SA",
|
||||
senegal: "SN",
|
||||
serbia: "RS",
|
||||
seychelles: "SC",
|
||||
"sierra leone": "SL",
|
||||
singapore: "SG",
|
||||
slovakia: "SK",
|
||||
slovenia: "SI",
|
||||
"solomon islands": "SB",
|
||||
somalia: "SO",
|
||||
"south africa": "ZA",
|
||||
"south georgia and sandwich isl.": "GS",
|
||||
spain: "ES",
|
||||
"sri lanka": "LK",
|
||||
sudan: "SD",
|
||||
suriname: "SR",
|
||||
"svalbard and jan mayen": "SJ",
|
||||
swaziland: "SZ",
|
||||
sweden: "SE",
|
||||
switzerland: "CH",
|
||||
"syrian arab republic": "SY",
|
||||
taiwan: "TW",
|
||||
tajikistan: "TJ",
|
||||
tanzania: "TZ",
|
||||
thailand: "TH",
|
||||
"timor-leste": "TL",
|
||||
togo: "TG",
|
||||
tokelau: "TK",
|
||||
tonga: "TO",
|
||||
"trinidad and tobago": "TT",
|
||||
tunisia: "TN",
|
||||
turkey: "TR",
|
||||
turkmenistan: "TM",
|
||||
"turks and caicos islands": "TC",
|
||||
tuvalu: "TV",
|
||||
uganda: "UG",
|
||||
ukraine: "UA",
|
||||
"united arab emirates": "AE",
|
||||
"united kingdom": "GB",
|
||||
"united states": "US",
|
||||
"united states outlying islands": "UM",
|
||||
uruguay: "UY",
|
||||
uzbekistan: "UZ",
|
||||
vanuatu: "VU",
|
||||
venezuela: "VE",
|
||||
vietnam: "VN",
|
||||
"virgin islands, british": "VG",
|
||||
"virgin islands, u.s.": "VI",
|
||||
"wallis and futuna": "WF",
|
||||
"western sahara": "EH",
|
||||
yemen: "YE",
|
||||
zambia: "ZM",
|
||||
zimbabwe: "ZW",
|
||||
};
|
||||
|
||||
static readonly IsoStates: { [id: string]: string } = {
|
||||
alabama: "AL",
|
||||
alaska: "AK",
|
||||
"american samoa": "AS",
|
||||
arizona: "AZ",
|
||||
arkansas: "AR",
|
||||
california: "CA",
|
||||
colorado: "CO",
|
||||
connecticut: "CT",
|
||||
delaware: "DE",
|
||||
"district of columbia": "DC",
|
||||
"federated states of micronesia": "FM",
|
||||
florida: "FL",
|
||||
georgia: "GA",
|
||||
guam: "GU",
|
||||
hawaii: "HI",
|
||||
idaho: "ID",
|
||||
illinois: "IL",
|
||||
indiana: "IN",
|
||||
iowa: "IA",
|
||||
kansas: "KS",
|
||||
kentucky: "KY",
|
||||
louisiana: "LA",
|
||||
maine: "ME",
|
||||
"marshall islands": "MH",
|
||||
maryland: "MD",
|
||||
massachusetts: "MA",
|
||||
michigan: "MI",
|
||||
minnesota: "MN",
|
||||
mississippi: "MS",
|
||||
missouri: "MO",
|
||||
montana: "MT",
|
||||
nebraska: "NE",
|
||||
nevada: "NV",
|
||||
"new hampshire": "NH",
|
||||
"new jersey": "NJ",
|
||||
"new mexico": "NM",
|
||||
"new york": "NY",
|
||||
"north carolina": "NC",
|
||||
"north dakota": "ND",
|
||||
"northern mariana islands": "MP",
|
||||
ohio: "OH",
|
||||
oklahoma: "OK",
|
||||
oregon: "OR",
|
||||
palau: "PW",
|
||||
pennsylvania: "PA",
|
||||
"puerto rico": "PR",
|
||||
"rhode island": "RI",
|
||||
"south carolina": "SC",
|
||||
"south dakota": "SD",
|
||||
tennessee: "TN",
|
||||
texas: "TX",
|
||||
utah: "UT",
|
||||
vermont: "VT",
|
||||
"virgin islands": "VI",
|
||||
virginia: "VA",
|
||||
washington: "WA",
|
||||
"west virginia": "WV",
|
||||
wisconsin: "WI",
|
||||
wyoming: "WY",
|
||||
};
|
||||
|
||||
static readonly IsoProvinces: { [id: string]: string } = {
|
||||
alberta: "AB",
|
||||
"british columbia": "BC",
|
||||
manitoba: "MB",
|
||||
"new brunswick": "NB",
|
||||
"newfoundland and labrador": "NL",
|
||||
"nova scotia": "NS",
|
||||
ontario: "ON",
|
||||
"prince edward island": "PE",
|
||||
quebec: "QC",
|
||||
saskatchewan: "SK",
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user