codeforlife 2.6.3 → 2.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/components/form/CountryField.tsx +8 -2
- package/src/components/form/TextField.tsx +25 -1
- package/src/utils/general.ts +647 -141
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.6.5](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.4...v2.6.5) (2025-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* unique values ([#74](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/74)) ([1d183d2](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/1d183d2806a7aa8ba98e78bf8a3fa9927ff37389))
|
|
7
|
+
|
|
8
|
+
## [2.6.4](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.3...v2.6.4) (2025-01-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* country iso code mapping ([#73](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/73)) ([162111c](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/162111cc181a58c2bdf39df8ae566b8ab1f34426))
|
|
14
|
+
|
|
1
15
|
## [2.6.3](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.2...v2.6.3) (2024-12-18)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type ChipTypeMap } from "@mui/material"
|
|
2
2
|
import { type ElementType } from "react"
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
COUNTRY_ISO_CODES,
|
|
5
|
+
COUNTRY_ISO_CODE_MAPPING,
|
|
6
|
+
type CountryIsoCodes,
|
|
7
|
+
} from "../../utils/general"
|
|
4
8
|
import AutocompleteField, {
|
|
5
9
|
type AutocompleteFieldProps,
|
|
6
10
|
} from "./AutocompleteField"
|
|
@@ -58,7 +62,9 @@ const CountryField = <
|
|
|
58
62
|
return (
|
|
59
63
|
<AutocompleteField
|
|
60
64
|
options={COUNTRY_ISO_CODES}
|
|
61
|
-
getOptionLabel={isoCode =>
|
|
65
|
+
getOptionLabel={isoCode =>
|
|
66
|
+
COUNTRY_ISO_CODE_MAPPING[isoCode as CountryIsoCodes]
|
|
67
|
+
}
|
|
62
68
|
textFieldProps={{ name, label, placeholder, ...otherTextFieldProps }}
|
|
63
69
|
{...otherAutocompleteFieldProps}
|
|
64
70
|
/>
|
|
@@ -30,6 +30,8 @@ export type TextFieldProps = Omit<
|
|
|
30
30
|
validateOptions?: ValidateOptions
|
|
31
31
|
dirty?: boolean
|
|
32
32
|
split?: string | RegExp
|
|
33
|
+
unique?: boolean
|
|
34
|
+
uniqueCaseInsensitive?: boolean
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
// https://formik.org/docs/examples/with-material-ui
|
|
@@ -40,6 +42,8 @@ const TextField: FC<TextFieldProps> = ({
|
|
|
40
42
|
type = "text",
|
|
41
43
|
required = false,
|
|
42
44
|
dirty = false,
|
|
45
|
+
unique = false,
|
|
46
|
+
uniqueCaseInsensitive = false,
|
|
43
47
|
split,
|
|
44
48
|
validateOptions,
|
|
45
49
|
...otherTextFieldProps
|
|
@@ -49,7 +53,27 @@ const TextField: FC<TextFieldProps> = ({
|
|
|
49
53
|
const dotPath = name.split(".")
|
|
50
54
|
|
|
51
55
|
let _schema: Schema = schema
|
|
52
|
-
if (split)
|
|
56
|
+
if (split) {
|
|
57
|
+
_schema = YupArray().of(_schema)
|
|
58
|
+
if (unique || uniqueCaseInsensitive) {
|
|
59
|
+
_schema = _schema.test({
|
|
60
|
+
message: "cannot have duplicates",
|
|
61
|
+
test: values => {
|
|
62
|
+
if (Array.isArray(values) && values.length >= 2) {
|
|
63
|
+
return (
|
|
64
|
+
new Set(
|
|
65
|
+
uniqueCaseInsensitive && typeof values[0] === "string"
|
|
66
|
+
? values.map(value => value.toLowerCase())
|
|
67
|
+
: values,
|
|
68
|
+
).size === values.length
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return true
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
53
77
|
if (required) {
|
|
54
78
|
_schema = _schema.required()
|
|
55
79
|
if (split) _schema = (_schema as ArraySchema<string[], any>).min(1)
|
package/src/utils/general.ts
CHANGED
|
@@ -59,259 +59,765 @@ export function camelCaseToSnakeCase(obj: Record<string, any>): void {
|
|
|
59
59
|
export const MIN_DATE = new Date(0, 0, 0)
|
|
60
60
|
|
|
61
61
|
export const COUNTRY_ISO_CODES = [
|
|
62
|
+
"AD",
|
|
63
|
+
"AE",
|
|
62
64
|
"AF",
|
|
63
|
-
"
|
|
65
|
+
"AG",
|
|
66
|
+
"AI",
|
|
64
67
|
"AL",
|
|
65
|
-
"
|
|
66
|
-
"AS",
|
|
67
|
-
"AD",
|
|
68
|
+
"AM",
|
|
68
69
|
"AO",
|
|
69
|
-
"AI",
|
|
70
70
|
"AQ",
|
|
71
|
-
"AG",
|
|
72
71
|
"AR",
|
|
73
|
-
"
|
|
74
|
-
"AW",
|
|
75
|
-
"AU",
|
|
72
|
+
"AS",
|
|
76
73
|
"AT",
|
|
74
|
+
"AU",
|
|
75
|
+
"AW",
|
|
76
|
+
"AX",
|
|
77
77
|
"AZ",
|
|
78
|
-
"
|
|
79
|
-
"BH",
|
|
80
|
-
"BD",
|
|
78
|
+
"BA",
|
|
81
79
|
"BB",
|
|
82
|
-
"
|
|
80
|
+
"BD",
|
|
83
81
|
"BE",
|
|
84
|
-
"
|
|
82
|
+
"BF",
|
|
83
|
+
"BG",
|
|
84
|
+
"BH",
|
|
85
|
+
"BI",
|
|
85
86
|
"BJ",
|
|
87
|
+
"BL",
|
|
86
88
|
"BM",
|
|
87
|
-
"
|
|
89
|
+
"BN",
|
|
88
90
|
"BO",
|
|
89
91
|
"BQ",
|
|
90
|
-
"BA",
|
|
91
|
-
"BW",
|
|
92
|
-
"BV",
|
|
93
92
|
"BR",
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"CM",
|
|
93
|
+
"BS",
|
|
94
|
+
"BT",
|
|
95
|
+
"BV",
|
|
96
|
+
"BW",
|
|
97
|
+
"BY",
|
|
98
|
+
"BZ",
|
|
101
99
|
"CA",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
100
|
+
"CC",
|
|
101
|
+
"CD",
|
|
104
102
|
"CF",
|
|
105
|
-
"
|
|
103
|
+
"CG",
|
|
104
|
+
"CH",
|
|
105
|
+
"CI",
|
|
106
|
+
"CK",
|
|
106
107
|
"CL",
|
|
108
|
+
"CM",
|
|
107
109
|
"CN",
|
|
108
|
-
"CX",
|
|
109
|
-
"CC",
|
|
110
110
|
"CO",
|
|
111
|
-
"KM",
|
|
112
|
-
"CG",
|
|
113
|
-
"CD",
|
|
114
|
-
"CK",
|
|
115
111
|
"CR",
|
|
116
|
-
"CI",
|
|
117
|
-
"HR",
|
|
118
112
|
"CU",
|
|
113
|
+
"CV",
|
|
119
114
|
"CW",
|
|
115
|
+
"CX",
|
|
120
116
|
"CY",
|
|
121
117
|
"CZ",
|
|
122
|
-
"
|
|
118
|
+
"DE",
|
|
123
119
|
"DJ",
|
|
120
|
+
"DK",
|
|
124
121
|
"DM",
|
|
125
122
|
"DO",
|
|
123
|
+
"DZ",
|
|
126
124
|
"EC",
|
|
125
|
+
"EE",
|
|
127
126
|
"EG",
|
|
128
|
-
"
|
|
129
|
-
"GQ",
|
|
127
|
+
"EH",
|
|
130
128
|
"ER",
|
|
131
|
-
"
|
|
129
|
+
"ES",
|
|
132
130
|
"ET",
|
|
131
|
+
"FI",
|
|
132
|
+
"FJ",
|
|
133
133
|
"FK",
|
|
134
|
+
"FM",
|
|
134
135
|
"FO",
|
|
135
|
-
"FJ",
|
|
136
|
-
"FI",
|
|
137
136
|
"FR",
|
|
138
|
-
"GF",
|
|
139
|
-
"PF",
|
|
140
|
-
"TF",
|
|
141
137
|
"GA",
|
|
142
|
-
"
|
|
138
|
+
"GB",
|
|
139
|
+
"GD",
|
|
143
140
|
"GE",
|
|
144
|
-
"
|
|
141
|
+
"GF",
|
|
142
|
+
"GG",
|
|
145
143
|
"GH",
|
|
146
144
|
"GI",
|
|
147
|
-
"GR",
|
|
148
145
|
"GL",
|
|
149
|
-
"
|
|
146
|
+
"GM",
|
|
147
|
+
"GN",
|
|
150
148
|
"GP",
|
|
151
|
-
"
|
|
149
|
+
"GQ",
|
|
150
|
+
"GR",
|
|
151
|
+
"GS",
|
|
152
152
|
"GT",
|
|
153
|
-
"
|
|
154
|
-
"GN",
|
|
153
|
+
"GU",
|
|
155
154
|
"GW",
|
|
156
155
|
"GY",
|
|
157
|
-
"
|
|
156
|
+
"HK",
|
|
158
157
|
"HM",
|
|
159
|
-
"VA",
|
|
160
158
|
"HN",
|
|
161
|
-
"
|
|
159
|
+
"HR",
|
|
160
|
+
"HT",
|
|
162
161
|
"HU",
|
|
163
|
-
"IS",
|
|
164
|
-
"IN",
|
|
165
162
|
"ID",
|
|
166
|
-
"IR",
|
|
167
|
-
"IQ",
|
|
168
163
|
"IE",
|
|
169
|
-
"IM",
|
|
170
164
|
"IL",
|
|
165
|
+
"IM",
|
|
166
|
+
"IN",
|
|
167
|
+
"IO",
|
|
168
|
+
"IQ",
|
|
169
|
+
"IR",
|
|
170
|
+
"IS",
|
|
171
171
|
"IT",
|
|
172
|
-
"JM",
|
|
173
|
-
"JP",
|
|
174
172
|
"JE",
|
|
173
|
+
"JM",
|
|
175
174
|
"JO",
|
|
176
|
-
"
|
|
175
|
+
"JP",
|
|
177
176
|
"KE",
|
|
177
|
+
"KG",
|
|
178
|
+
"KH",
|
|
178
179
|
"KI",
|
|
180
|
+
"KM",
|
|
181
|
+
"KN",
|
|
179
182
|
"KP",
|
|
180
183
|
"KR",
|
|
181
184
|
"KW",
|
|
182
|
-
"
|
|
185
|
+
"KY",
|
|
186
|
+
"KZ",
|
|
183
187
|
"LA",
|
|
184
|
-
"LV",
|
|
185
188
|
"LB",
|
|
186
|
-
"
|
|
187
|
-
"LR",
|
|
188
|
-
"LY",
|
|
189
|
+
"LC",
|
|
189
190
|
"LI",
|
|
191
|
+
"LK",
|
|
192
|
+
"LR",
|
|
193
|
+
"LS",
|
|
190
194
|
"LT",
|
|
191
195
|
"LU",
|
|
192
|
-
"
|
|
193
|
-
"
|
|
196
|
+
"LV",
|
|
197
|
+
"LY",
|
|
198
|
+
"MA",
|
|
199
|
+
"MC",
|
|
200
|
+
"MD",
|
|
201
|
+
"ME",
|
|
202
|
+
"MF",
|
|
194
203
|
"MG",
|
|
195
|
-
"MW",
|
|
196
|
-
"MY",
|
|
197
|
-
"MV",
|
|
198
|
-
"ML",
|
|
199
|
-
"MT",
|
|
200
204
|
"MH",
|
|
205
|
+
"MK",
|
|
206
|
+
"ML",
|
|
207
|
+
"MM",
|
|
208
|
+
"MN",
|
|
209
|
+
"MO",
|
|
210
|
+
"MP",
|
|
201
211
|
"MQ",
|
|
202
212
|
"MR",
|
|
213
|
+
"MS",
|
|
214
|
+
"MT",
|
|
203
215
|
"MU",
|
|
204
|
-
"
|
|
216
|
+
"MV",
|
|
217
|
+
"MW",
|
|
205
218
|
"MX",
|
|
206
|
-
"
|
|
207
|
-
"MD",
|
|
208
|
-
"MC",
|
|
209
|
-
"MN",
|
|
210
|
-
"ME",
|
|
211
|
-
"MS",
|
|
212
|
-
"MA",
|
|
219
|
+
"MY",
|
|
213
220
|
"MZ",
|
|
214
|
-
"MM",
|
|
215
221
|
"NA",
|
|
216
|
-
"NR",
|
|
217
|
-
"NP",
|
|
218
|
-
"NL",
|
|
219
222
|
"NC",
|
|
220
|
-
"NZ",
|
|
221
|
-
"NI",
|
|
222
223
|
"NE",
|
|
223
|
-
"NG",
|
|
224
|
-
"NU",
|
|
225
224
|
"NF",
|
|
226
|
-
"
|
|
225
|
+
"NG",
|
|
226
|
+
"NI",
|
|
227
|
+
"NL",
|
|
227
228
|
"NO",
|
|
229
|
+
"NP",
|
|
230
|
+
"NR",
|
|
231
|
+
"NU",
|
|
232
|
+
"NZ",
|
|
228
233
|
"OM",
|
|
229
|
-
"PK",
|
|
230
|
-
"PW",
|
|
231
|
-
"PS",
|
|
232
234
|
"PA",
|
|
233
|
-
"PG",
|
|
234
|
-
"PY",
|
|
235
235
|
"PE",
|
|
236
|
+
"PF",
|
|
237
|
+
"PG",
|
|
236
238
|
"PH",
|
|
237
|
-
"
|
|
239
|
+
"PK",
|
|
238
240
|
"PL",
|
|
239
|
-
"
|
|
241
|
+
"PM",
|
|
242
|
+
"PN",
|
|
240
243
|
"PR",
|
|
244
|
+
"PS",
|
|
245
|
+
"PT",
|
|
246
|
+
"PW",
|
|
247
|
+
"PY",
|
|
241
248
|
"QA",
|
|
242
249
|
"RE",
|
|
243
250
|
"RO",
|
|
251
|
+
"RS",
|
|
244
252
|
"RU",
|
|
245
253
|
"RW",
|
|
246
|
-
"BL",
|
|
247
|
-
"SH",
|
|
248
|
-
"KN",
|
|
249
|
-
"LC",
|
|
250
|
-
"MF",
|
|
251
|
-
"PM",
|
|
252
|
-
"VC",
|
|
253
|
-
"WS",
|
|
254
|
-
"SM",
|
|
255
|
-
"ST",
|
|
256
254
|
"SA",
|
|
257
|
-
"
|
|
258
|
-
"RS",
|
|
255
|
+
"SB",
|
|
259
256
|
"SC",
|
|
260
|
-
"
|
|
257
|
+
"SD",
|
|
258
|
+
"SE",
|
|
261
259
|
"SG",
|
|
262
|
-
"
|
|
263
|
-
"SK",
|
|
260
|
+
"SH",
|
|
264
261
|
"SI",
|
|
265
|
-
"
|
|
262
|
+
"SJ",
|
|
263
|
+
"SK",
|
|
264
|
+
"SL",
|
|
265
|
+
"SM",
|
|
266
|
+
"SN",
|
|
266
267
|
"SO",
|
|
267
|
-
"ZA",
|
|
268
|
-
"GS",
|
|
269
|
-
"SS",
|
|
270
|
-
"ES",
|
|
271
|
-
"LK",
|
|
272
|
-
"SD",
|
|
273
268
|
"SR",
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
269
|
+
"SS",
|
|
270
|
+
"ST",
|
|
271
|
+
"SV",
|
|
272
|
+
"SX",
|
|
278
273
|
"SY",
|
|
279
|
-
"
|
|
280
|
-
"
|
|
281
|
-
"
|
|
282
|
-
"
|
|
283
|
-
"TL",
|
|
274
|
+
"SZ",
|
|
275
|
+
"TC",
|
|
276
|
+
"TD",
|
|
277
|
+
"TF",
|
|
284
278
|
"TG",
|
|
279
|
+
"TH",
|
|
280
|
+
"TJ",
|
|
285
281
|
"TK",
|
|
286
|
-
"
|
|
287
|
-
"
|
|
282
|
+
"TL",
|
|
283
|
+
"TM",
|
|
288
284
|
"TN",
|
|
285
|
+
"TO",
|
|
289
286
|
"TR",
|
|
290
|
-
"
|
|
291
|
-
"TC",
|
|
287
|
+
"TT",
|
|
292
288
|
"TV",
|
|
293
|
-
"
|
|
289
|
+
"TW",
|
|
290
|
+
"TZ",
|
|
294
291
|
"UA",
|
|
295
|
-
"
|
|
296
|
-
"GB",
|
|
297
|
-
"US",
|
|
292
|
+
"UG",
|
|
298
293
|
"UM",
|
|
294
|
+
"US",
|
|
299
295
|
"UY",
|
|
300
296
|
"UZ",
|
|
301
|
-
"
|
|
297
|
+
"VA",
|
|
298
|
+
"VC",
|
|
302
299
|
"VE",
|
|
303
|
-
"VN",
|
|
304
300
|
"VG",
|
|
305
301
|
"VI",
|
|
302
|
+
"VN",
|
|
303
|
+
"VU",
|
|
306
304
|
"WF",
|
|
307
|
-
"
|
|
305
|
+
"WS",
|
|
308
306
|
"YE",
|
|
307
|
+
"YT",
|
|
308
|
+
"ZA",
|
|
309
309
|
"ZM",
|
|
310
310
|
"ZW",
|
|
311
311
|
] as const
|
|
312
312
|
|
|
313
313
|
export type CountryIsoCodes = (typeof COUNTRY_ISO_CODES)[number]
|
|
314
314
|
|
|
315
|
+
export const COUNTRIES = [
|
|
316
|
+
"Andorra",
|
|
317
|
+
"United Arab Emirates (the)",
|
|
318
|
+
"Afghanistan",
|
|
319
|
+
"Antigua and Barbuda",
|
|
320
|
+
"Anguilla",
|
|
321
|
+
"Albania",
|
|
322
|
+
"Armenia",
|
|
323
|
+
"Angola",
|
|
324
|
+
"Antarctica",
|
|
325
|
+
"Argentina",
|
|
326
|
+
"American Samoa",
|
|
327
|
+
"Austria",
|
|
328
|
+
"Australia",
|
|
329
|
+
"Aruba",
|
|
330
|
+
"Åland Islands",
|
|
331
|
+
"Azerbaijan",
|
|
332
|
+
"Bosnia and Herzegovina",
|
|
333
|
+
"Barbados",
|
|
334
|
+
"Bangladesh",
|
|
335
|
+
"Belgium",
|
|
336
|
+
"Burkina Faso",
|
|
337
|
+
"Bulgaria",
|
|
338
|
+
"Bahrain",
|
|
339
|
+
"Burundi",
|
|
340
|
+
"Benin",
|
|
341
|
+
"Saint Barthélemy",
|
|
342
|
+
"Bermuda",
|
|
343
|
+
"Brunei Darussalam",
|
|
344
|
+
"Bolivia (Plurinational State of)",
|
|
345
|
+
"Bonaire, Sint Eustatius and Saba",
|
|
346
|
+
"Brazil",
|
|
347
|
+
"Bahamas (the)",
|
|
348
|
+
"Bhutan",
|
|
349
|
+
"Bouvet Island",
|
|
350
|
+
"Botswana",
|
|
351
|
+
"Belarus",
|
|
352
|
+
"Belize",
|
|
353
|
+
"Canada",
|
|
354
|
+
"Cocos (Keeling) Islands (the)",
|
|
355
|
+
"Congo (the Democratic Republic of the)",
|
|
356
|
+
"Central African Republic (the)",
|
|
357
|
+
"Congo (the)",
|
|
358
|
+
"Switzerland",
|
|
359
|
+
"Côte d'Ivoire",
|
|
360
|
+
"Cook Islands (the)",
|
|
361
|
+
"Chile",
|
|
362
|
+
"Cameroon",
|
|
363
|
+
"China",
|
|
364
|
+
"Colombia",
|
|
365
|
+
"Costa Rica",
|
|
366
|
+
"Cuba",
|
|
367
|
+
"Cabo Verde",
|
|
368
|
+
"Curaçao",
|
|
369
|
+
"Christmas Island",
|
|
370
|
+
"Cyprus",
|
|
371
|
+
"Czechia",
|
|
372
|
+
"Germany",
|
|
373
|
+
"Djibouti",
|
|
374
|
+
"Denmark",
|
|
375
|
+
"Dominica",
|
|
376
|
+
"Dominican Republic (the",
|
|
377
|
+
"Algeria",
|
|
378
|
+
"Ecuador",
|
|
379
|
+
"Estonia",
|
|
380
|
+
"Egypt",
|
|
381
|
+
"Western Sahara",
|
|
382
|
+
"Eritrea",
|
|
383
|
+
"Spain",
|
|
384
|
+
"Ethiopia",
|
|
385
|
+
"Finland",
|
|
386
|
+
"Fiji",
|
|
387
|
+
"Falkland Islands (the) [Malvinas]",
|
|
388
|
+
"Micronesia (Federated States of)",
|
|
389
|
+
"Faroe Islands (the)",
|
|
390
|
+
"France",
|
|
391
|
+
"Gabon",
|
|
392
|
+
"United Kingdom of Great Britain and Northern Ireland (the)",
|
|
393
|
+
"Grenada",
|
|
394
|
+
"Georgia",
|
|
395
|
+
"French Guiana",
|
|
396
|
+
"Guernsey",
|
|
397
|
+
"Ghana",
|
|
398
|
+
"Gibraltar",
|
|
399
|
+
"Greenland",
|
|
400
|
+
"Gambia (the)",
|
|
401
|
+
"Guinea",
|
|
402
|
+
"Guadeloupe",
|
|
403
|
+
"Equatorial Guinea",
|
|
404
|
+
"Greece",
|
|
405
|
+
"South Georgia and the South Sandwich Islands",
|
|
406
|
+
"Guatemala",
|
|
407
|
+
"Guam",
|
|
408
|
+
"Guinea-Bissau",
|
|
409
|
+
"Guyana",
|
|
410
|
+
"Hong Kong",
|
|
411
|
+
"Heard Island and McDonald Islands",
|
|
412
|
+
"Honduras",
|
|
413
|
+
"Croatia",
|
|
414
|
+
"Haiti",
|
|
415
|
+
"Hungary",
|
|
416
|
+
"Indonesia",
|
|
417
|
+
"Ireland",
|
|
418
|
+
"Israel",
|
|
419
|
+
"Isle of Man",
|
|
420
|
+
"India",
|
|
421
|
+
"British Indian Ocean Territory (the)",
|
|
422
|
+
"Iraq",
|
|
423
|
+
"Iran (Islamic Republic of)",
|
|
424
|
+
"Iceland",
|
|
425
|
+
"Italy",
|
|
426
|
+
"Jersey",
|
|
427
|
+
"Jamaica",
|
|
428
|
+
"Jordan",
|
|
429
|
+
"Japan",
|
|
430
|
+
"Kenya",
|
|
431
|
+
"Kyrgyzstan",
|
|
432
|
+
"Cambodia",
|
|
433
|
+
"Kiribati",
|
|
434
|
+
"Comoros (the)",
|
|
435
|
+
"Saint Kitts and Nevis",
|
|
436
|
+
"Korea (the Democratic People's Republic of)",
|
|
437
|
+
"Korea (the Republic of)",
|
|
438
|
+
"Kuwait",
|
|
439
|
+
"Cayman Islands (the)",
|
|
440
|
+
"Kazakhstan",
|
|
441
|
+
"Lao People's Democratic Republic (the)",
|
|
442
|
+
"Lebanon",
|
|
443
|
+
"Saint Lucia",
|
|
444
|
+
"Liechtenstein",
|
|
445
|
+
"Sri Lanka",
|
|
446
|
+
"Liberia",
|
|
447
|
+
"Lesotho",
|
|
448
|
+
"Lithuania",
|
|
449
|
+
"Luxembourg",
|
|
450
|
+
"Latvia",
|
|
451
|
+
"Libya",
|
|
452
|
+
"Morocco",
|
|
453
|
+
"Monaco",
|
|
454
|
+
"Moldova (the Republic of)",
|
|
455
|
+
"Montenegro",
|
|
456
|
+
"Saint Martin (French part)",
|
|
457
|
+
"Madagascar",
|
|
458
|
+
"Marshall Islands (the)",
|
|
459
|
+
"Republic of North Macedonia",
|
|
460
|
+
"Mali",
|
|
461
|
+
"Myanmar",
|
|
462
|
+
"Mongolia",
|
|
463
|
+
"Macao",
|
|
464
|
+
"Northern Mariana Islands (the)",
|
|
465
|
+
"Martinique",
|
|
466
|
+
"Mauritania",
|
|
467
|
+
"Montserrat",
|
|
468
|
+
"Malta",
|
|
469
|
+
"Mauritius",
|
|
470
|
+
"Maldives",
|
|
471
|
+
"Malawi",
|
|
472
|
+
"Mexico",
|
|
473
|
+
"Malaysia",
|
|
474
|
+
"Mozambique",
|
|
475
|
+
"Namibia",
|
|
476
|
+
"New Caledonia",
|
|
477
|
+
"Niger (the)",
|
|
478
|
+
"Norfolk Island",
|
|
479
|
+
"Nigeria",
|
|
480
|
+
"Nicaragua",
|
|
481
|
+
"Netherlands (the)",
|
|
482
|
+
"Norway",
|
|
483
|
+
"Nepal",
|
|
484
|
+
"Nauru",
|
|
485
|
+
"Niue",
|
|
486
|
+
"New Zealand",
|
|
487
|
+
"Oman",
|
|
488
|
+
"Panama",
|
|
489
|
+
"Peru",
|
|
490
|
+
"French Polynesia",
|
|
491
|
+
"Papua New Guinea",
|
|
492
|
+
"Philippines (the)",
|
|
493
|
+
"Pakistan",
|
|
494
|
+
"Poland",
|
|
495
|
+
"Saint Pierre and Miquelon",
|
|
496
|
+
"Pitcairn",
|
|
497
|
+
"Puerto Rico",
|
|
498
|
+
"Palestine, State of",
|
|
499
|
+
"Portugal",
|
|
500
|
+
"Palau",
|
|
501
|
+
"Paraguay",
|
|
502
|
+
"Qatar",
|
|
503
|
+
"Réunion",
|
|
504
|
+
"Romania",
|
|
505
|
+
"Serbia",
|
|
506
|
+
"Russian Federation (the)",
|
|
507
|
+
"Rwanda",
|
|
508
|
+
"Saudi Arabia",
|
|
509
|
+
"Solomon Islands",
|
|
510
|
+
"Seychelles",
|
|
511
|
+
"Sudan (the)",
|
|
512
|
+
"Sweden",
|
|
513
|
+
"Singapore",
|
|
514
|
+
"Saint Helena, Ascension and Tristan da Cunha",
|
|
515
|
+
"Slovenia",
|
|
516
|
+
"Svalbard and Jan Mayen",
|
|
517
|
+
"Slovakia",
|
|
518
|
+
"Sierra Leone",
|
|
519
|
+
"San Marino",
|
|
520
|
+
"Senegal",
|
|
521
|
+
"Somalia",
|
|
522
|
+
"Suriname",
|
|
523
|
+
"South Sudan",
|
|
524
|
+
"Sao Tome and Principe",
|
|
525
|
+
"El Salvador",
|
|
526
|
+
"Sint Maarten (Dutch part)",
|
|
527
|
+
"Syrian Arab Republic",
|
|
528
|
+
"Eswatini",
|
|
529
|
+
"Turks and Caicos Islands (the)",
|
|
530
|
+
"Chad",
|
|
531
|
+
"French Southern Territories (the)",
|
|
532
|
+
"Togo",
|
|
533
|
+
"Thailand",
|
|
534
|
+
"Tajikistan",
|
|
535
|
+
"Tokelau",
|
|
536
|
+
"Timor-Leste",
|
|
537
|
+
"Turkmenistan",
|
|
538
|
+
"Tunisia",
|
|
539
|
+
"Tonga",
|
|
540
|
+
"Turkey",
|
|
541
|
+
"Trinidad and Tobago",
|
|
542
|
+
"Tuvalu",
|
|
543
|
+
"Taiwan (Province of China)",
|
|
544
|
+
"Tanzania, United Republic of",
|
|
545
|
+
"Ukraine",
|
|
546
|
+
"Uganda",
|
|
547
|
+
"United States Minor Outlying Islands (the)",
|
|
548
|
+
"United States of America (the)",
|
|
549
|
+
"Uruguay",
|
|
550
|
+
"Uzbekistan",
|
|
551
|
+
"Holy See (the)",
|
|
552
|
+
"Saint Vincent and the Grenadines",
|
|
553
|
+
"Venezuela (Bolivarian Republic of)",
|
|
554
|
+
"Virgin Islands (British)",
|
|
555
|
+
"Virgin Islands (U.S.)",
|
|
556
|
+
"Viet Nam",
|
|
557
|
+
"Vanuatu",
|
|
558
|
+
"Wallis and Futuna",
|
|
559
|
+
"Samoa",
|
|
560
|
+
"Yemen",
|
|
561
|
+
"Mayotte",
|
|
562
|
+
"South Africa",
|
|
563
|
+
"Zambia",
|
|
564
|
+
"Zimbabwe",
|
|
565
|
+
] as const
|
|
566
|
+
|
|
567
|
+
export type Countries = (typeof COUNTRIES)[number]
|
|
568
|
+
|
|
569
|
+
export const COUNTRY_ISO_CODE_MAPPING: Record<CountryIsoCodes, Countries> = {
|
|
570
|
+
AD: "Andorra",
|
|
571
|
+
AE: "United Arab Emirates (the)",
|
|
572
|
+
AF: "Afghanistan",
|
|
573
|
+
AG: "Antigua and Barbuda",
|
|
574
|
+
AI: "Anguilla",
|
|
575
|
+
AL: "Albania",
|
|
576
|
+
AM: "Armenia",
|
|
577
|
+
AO: "Angola",
|
|
578
|
+
AQ: "Antarctica",
|
|
579
|
+
AR: "Argentina",
|
|
580
|
+
AS: "American Samoa",
|
|
581
|
+
AT: "Austria",
|
|
582
|
+
AU: "Australia",
|
|
583
|
+
AW: "Aruba",
|
|
584
|
+
AX: "Åland Islands",
|
|
585
|
+
AZ: "Azerbaijan",
|
|
586
|
+
BA: "Bosnia and Herzegovina",
|
|
587
|
+
BB: "Barbados",
|
|
588
|
+
BD: "Bangladesh",
|
|
589
|
+
BE: "Belgium",
|
|
590
|
+
BF: "Burkina Faso",
|
|
591
|
+
BG: "Bulgaria",
|
|
592
|
+
BH: "Bahrain",
|
|
593
|
+
BI: "Burundi",
|
|
594
|
+
BJ: "Benin",
|
|
595
|
+
BL: "Saint Barthélemy",
|
|
596
|
+
BM: "Bermuda",
|
|
597
|
+
BN: "Brunei Darussalam",
|
|
598
|
+
BO: "Bolivia (Plurinational State of)",
|
|
599
|
+
BQ: "Bonaire, Sint Eustatius and Saba",
|
|
600
|
+
BR: "Brazil",
|
|
601
|
+
BS: "Bahamas (the)",
|
|
602
|
+
BT: "Bhutan",
|
|
603
|
+
BV: "Bouvet Island",
|
|
604
|
+
BW: "Botswana",
|
|
605
|
+
BY: "Belarus",
|
|
606
|
+
BZ: "Belize",
|
|
607
|
+
CA: "Canada",
|
|
608
|
+
CC: "Cocos (Keeling) Islands (the)",
|
|
609
|
+
CD: "Congo (the Democratic Republic of the)",
|
|
610
|
+
CF: "Central African Republic (the)",
|
|
611
|
+
CG: "Congo (the)",
|
|
612
|
+
CH: "Switzerland",
|
|
613
|
+
CI: "Côte d'Ivoire",
|
|
614
|
+
CK: "Cook Islands (the)",
|
|
615
|
+
CL: "Chile",
|
|
616
|
+
CM: "Cameroon",
|
|
617
|
+
CN: "China",
|
|
618
|
+
CO: "Colombia",
|
|
619
|
+
CR: "Costa Rica",
|
|
620
|
+
CU: "Cuba",
|
|
621
|
+
CV: "Cabo Verde",
|
|
622
|
+
CW: "Curaçao",
|
|
623
|
+
CX: "Christmas Island",
|
|
624
|
+
CY: "Cyprus",
|
|
625
|
+
CZ: "Czechia",
|
|
626
|
+
DE: "Germany",
|
|
627
|
+
DJ: "Djibouti",
|
|
628
|
+
DK: "Denmark",
|
|
629
|
+
DM: "Dominica",
|
|
630
|
+
DO: "Dominican Republic (the",
|
|
631
|
+
DZ: "Algeria",
|
|
632
|
+
EC: "Ecuador",
|
|
633
|
+
EE: "Estonia",
|
|
634
|
+
EG: "Egypt",
|
|
635
|
+
EH: "Western Sahara",
|
|
636
|
+
ER: "Eritrea",
|
|
637
|
+
ES: "Spain",
|
|
638
|
+
ET: "Ethiopia",
|
|
639
|
+
FI: "Finland",
|
|
640
|
+
FJ: "Fiji",
|
|
641
|
+
FK: "Falkland Islands (the) [Malvinas]",
|
|
642
|
+
FM: "Micronesia (Federated States of)",
|
|
643
|
+
FO: "Faroe Islands (the)",
|
|
644
|
+
FR: "France",
|
|
645
|
+
GA: "Gabon",
|
|
646
|
+
GB: "United Kingdom of Great Britain and Northern Ireland (the)",
|
|
647
|
+
GD: "Grenada",
|
|
648
|
+
GE: "Georgia",
|
|
649
|
+
GF: "French Guiana",
|
|
650
|
+
GG: "Guernsey",
|
|
651
|
+
GH: "Ghana",
|
|
652
|
+
GI: "Gibraltar",
|
|
653
|
+
GL: "Greenland",
|
|
654
|
+
GM: "Gambia (the)",
|
|
655
|
+
GN: "Guinea",
|
|
656
|
+
GP: "Guadeloupe",
|
|
657
|
+
GQ: "Equatorial Guinea",
|
|
658
|
+
GR: "Greece",
|
|
659
|
+
GS: "South Georgia and the South Sandwich Islands",
|
|
660
|
+
GT: "Guatemala",
|
|
661
|
+
GU: "Guam",
|
|
662
|
+
GW: "Guinea-Bissau",
|
|
663
|
+
GY: "Guyana",
|
|
664
|
+
HK: "Hong Kong",
|
|
665
|
+
HM: "Heard Island and McDonald Islands",
|
|
666
|
+
HN: "Honduras",
|
|
667
|
+
HR: "Croatia",
|
|
668
|
+
HT: "Haiti",
|
|
669
|
+
HU: "Hungary",
|
|
670
|
+
ID: "Indonesia",
|
|
671
|
+
IE: "Ireland",
|
|
672
|
+
IL: "Israel",
|
|
673
|
+
IM: "Isle of Man",
|
|
674
|
+
IN: "India",
|
|
675
|
+
IO: "British Indian Ocean Territory (the)",
|
|
676
|
+
IQ: "Iraq",
|
|
677
|
+
IR: "Iran (Islamic Republic of)",
|
|
678
|
+
IS: "Iceland",
|
|
679
|
+
IT: "Italy",
|
|
680
|
+
JE: "Jersey",
|
|
681
|
+
JM: "Jamaica",
|
|
682
|
+
JO: "Jordan",
|
|
683
|
+
JP: "Japan",
|
|
684
|
+
KE: "Kenya",
|
|
685
|
+
KG: "Kyrgyzstan",
|
|
686
|
+
KH: "Cambodia",
|
|
687
|
+
KI: "Kiribati",
|
|
688
|
+
KM: "Comoros (the)",
|
|
689
|
+
KN: "Saint Kitts and Nevis",
|
|
690
|
+
KP: "Korea (the Democratic People's Republic of)",
|
|
691
|
+
KR: "Korea (the Republic of)",
|
|
692
|
+
KW: "Kuwait",
|
|
693
|
+
KY: "Cayman Islands (the)",
|
|
694
|
+
KZ: "Kazakhstan",
|
|
695
|
+
LA: "Lao People's Democratic Republic (the)",
|
|
696
|
+
LB: "Lebanon",
|
|
697
|
+
LC: "Saint Lucia",
|
|
698
|
+
LI: "Liechtenstein",
|
|
699
|
+
LK: "Sri Lanka",
|
|
700
|
+
LR: "Liberia",
|
|
701
|
+
LS: "Lesotho",
|
|
702
|
+
LT: "Lithuania",
|
|
703
|
+
LU: "Luxembourg",
|
|
704
|
+
LV: "Latvia",
|
|
705
|
+
LY: "Libya",
|
|
706
|
+
MA: "Morocco",
|
|
707
|
+
MC: "Monaco",
|
|
708
|
+
MD: "Moldova (the Republic of)",
|
|
709
|
+
ME: "Montenegro",
|
|
710
|
+
MF: "Saint Martin (French part)",
|
|
711
|
+
MG: "Madagascar",
|
|
712
|
+
MH: "Marshall Islands (the)",
|
|
713
|
+
MK: "Republic of North Macedonia",
|
|
714
|
+
ML: "Mali",
|
|
715
|
+
MM: "Myanmar",
|
|
716
|
+
MN: "Mongolia",
|
|
717
|
+
MO: "Macao",
|
|
718
|
+
MP: "Northern Mariana Islands (the)",
|
|
719
|
+
MQ: "Martinique",
|
|
720
|
+
MR: "Mauritania",
|
|
721
|
+
MS: "Montserrat",
|
|
722
|
+
MT: "Malta",
|
|
723
|
+
MU: "Mauritius",
|
|
724
|
+
MV: "Maldives",
|
|
725
|
+
MW: "Malawi",
|
|
726
|
+
MX: "Mexico",
|
|
727
|
+
MY: "Malaysia",
|
|
728
|
+
MZ: "Mozambique",
|
|
729
|
+
NA: "Namibia",
|
|
730
|
+
NC: "New Caledonia",
|
|
731
|
+
NE: "Niger (the)",
|
|
732
|
+
NF: "Norfolk Island",
|
|
733
|
+
NG: "Nigeria",
|
|
734
|
+
NI: "Nicaragua",
|
|
735
|
+
NL: "Netherlands (the)",
|
|
736
|
+
NO: "Norway",
|
|
737
|
+
NP: "Nepal",
|
|
738
|
+
NR: "Nauru",
|
|
739
|
+
NU: "Niue",
|
|
740
|
+
NZ: "New Zealand",
|
|
741
|
+
OM: "Oman",
|
|
742
|
+
PA: "Panama",
|
|
743
|
+
PE: "Peru",
|
|
744
|
+
PF: "French Polynesia",
|
|
745
|
+
PG: "Papua New Guinea",
|
|
746
|
+
PH: "Philippines (the)",
|
|
747
|
+
PK: "Pakistan",
|
|
748
|
+
PL: "Poland",
|
|
749
|
+
PM: "Saint Pierre and Miquelon",
|
|
750
|
+
PN: "Pitcairn",
|
|
751
|
+
PR: "Puerto Rico",
|
|
752
|
+
PS: "Palestine, State of",
|
|
753
|
+
PT: "Portugal",
|
|
754
|
+
PW: "Palau",
|
|
755
|
+
PY: "Paraguay",
|
|
756
|
+
QA: "Qatar",
|
|
757
|
+
RE: "Réunion",
|
|
758
|
+
RO: "Romania",
|
|
759
|
+
RS: "Serbia",
|
|
760
|
+
RU: "Russian Federation (the)",
|
|
761
|
+
RW: "Rwanda",
|
|
762
|
+
SA: "Saudi Arabia",
|
|
763
|
+
SB: "Solomon Islands",
|
|
764
|
+
SC: "Seychelles",
|
|
765
|
+
SD: "Sudan (the)",
|
|
766
|
+
SE: "Sweden",
|
|
767
|
+
SG: "Singapore",
|
|
768
|
+
SH: "Saint Helena, Ascension and Tristan da Cunha",
|
|
769
|
+
SI: "Slovenia",
|
|
770
|
+
SJ: "Svalbard and Jan Mayen",
|
|
771
|
+
SK: "Slovakia",
|
|
772
|
+
SL: "Sierra Leone",
|
|
773
|
+
SM: "San Marino",
|
|
774
|
+
SN: "Senegal",
|
|
775
|
+
SO: "Somalia",
|
|
776
|
+
SR: "Suriname",
|
|
777
|
+
SS: "South Sudan",
|
|
778
|
+
ST: "Sao Tome and Principe",
|
|
779
|
+
SV: "El Salvador",
|
|
780
|
+
SX: "Sint Maarten (Dutch part)",
|
|
781
|
+
SY: "Syrian Arab Republic",
|
|
782
|
+
SZ: "Eswatini",
|
|
783
|
+
TC: "Turks and Caicos Islands (the)",
|
|
784
|
+
TD: "Chad",
|
|
785
|
+
TF: "French Southern Territories (the)",
|
|
786
|
+
TG: "Togo",
|
|
787
|
+
TH: "Thailand",
|
|
788
|
+
TJ: "Tajikistan",
|
|
789
|
+
TK: "Tokelau",
|
|
790
|
+
TL: "Timor-Leste",
|
|
791
|
+
TM: "Turkmenistan",
|
|
792
|
+
TN: "Tunisia",
|
|
793
|
+
TO: "Tonga",
|
|
794
|
+
TR: "Turkey",
|
|
795
|
+
TT: "Trinidad and Tobago",
|
|
796
|
+
TV: "Tuvalu",
|
|
797
|
+
TW: "Taiwan (Province of China)",
|
|
798
|
+
TZ: "Tanzania, United Republic of",
|
|
799
|
+
UA: "Ukraine",
|
|
800
|
+
UG: "Uganda",
|
|
801
|
+
UM: "United States Minor Outlying Islands (the)",
|
|
802
|
+
US: "United States of America (the)",
|
|
803
|
+
UY: "Uruguay",
|
|
804
|
+
UZ: "Uzbekistan",
|
|
805
|
+
VA: "Holy See (the)",
|
|
806
|
+
VC: "Saint Vincent and the Grenadines",
|
|
807
|
+
VE: "Venezuela (Bolivarian Republic of)",
|
|
808
|
+
VG: "Virgin Islands (British)",
|
|
809
|
+
VI: "Virgin Islands (U.S.)",
|
|
810
|
+
VN: "Viet Nam",
|
|
811
|
+
VU: "Vanuatu",
|
|
812
|
+
WF: "Wallis and Futuna",
|
|
813
|
+
WS: "Samoa",
|
|
814
|
+
YE: "Yemen",
|
|
815
|
+
YT: "Mayotte",
|
|
816
|
+
ZA: "South Africa",
|
|
817
|
+
ZM: "Zambia",
|
|
818
|
+
ZW: "Zimbabwe",
|
|
819
|
+
}
|
|
820
|
+
|
|
315
821
|
export const UK_COUNTIES = [
|
|
316
822
|
"Aberdeen City",
|
|
317
823
|
"Aberdeenshire",
|