@vtex/faststore-plugin-buyer-portal 2.0.41 → 2.0.43
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/package.json +1 -1
- package/src/features/addresses/components/AddressForm/AddressForm.tsx +185 -130
- package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +3 -24
- package/src/features/addresses/components/EditAddressDrawer/EditAddressDrawer.tsx +2 -21
- package/src/features/addresses/data/COL.ts +36 -0
- package/src/features/addresses/data/FRA.ts +1 -0
- package/src/features/addresses/data/countries.ts +3 -1
- package/src/features/addresses/data/states.ts +4 -0
- package/src/features/addresses/utils/countryRules.test.ts +262 -0
- package/src/features/addresses/utils/countryRules.ts +399 -0
- package/src/features/addresses/utils/index.ts +1 -0
- package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx +2 -14
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/shared/utils/phoneNumber.ts +2 -0
- package/src/features/shared/utils/postalCode.ts +10 -70
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { ExistingAddress } from "../";
|
|
4
4
|
import {
|
|
@@ -9,11 +9,16 @@ import {
|
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
11
11
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
12
|
-
import { maskPostalCode } from "../../../shared/utils/postalCode";
|
|
13
12
|
import { CountryOptions, type CountryOption } from "../../data/countries";
|
|
14
13
|
import { useDebouncedSearchAddress } from "../../hooks/useDebouncedSearchAddress";
|
|
15
14
|
import { AddressData, AddressInput } from "../../types";
|
|
16
15
|
import {
|
|
16
|
+
applyHiddenNumberDefault,
|
|
17
|
+
applyNumberInput,
|
|
18
|
+
applyZipInput,
|
|
19
|
+
collectAddressIssues,
|
|
20
|
+
fieldsToClearOnCountryChange,
|
|
21
|
+
getCountryRule,
|
|
17
22
|
getStateDisplayValue,
|
|
18
23
|
getStateSaveValue,
|
|
19
24
|
isStateSelected,
|
|
@@ -65,11 +70,19 @@ export const AddressForm = ({
|
|
|
65
70
|
currentOrgUnit?.id ?? ""
|
|
66
71
|
);
|
|
67
72
|
|
|
73
|
+
const countryKey = address.countryCode || address.country;
|
|
74
|
+
const countryRule = getCountryRule(countryKey);
|
|
75
|
+
const issues = isTouched ? collectAddressIssues(address, t) : [];
|
|
76
|
+
const issueFor = (path: string) =>
|
|
77
|
+
issues.find((issue) => issue.path === path);
|
|
78
|
+
|
|
68
79
|
const countryTranslations: Record<string, string> = {
|
|
69
80
|
BRA: t("addresses.forms.country.brazil"),
|
|
70
81
|
USA: t("addresses.forms.country.usa"),
|
|
71
82
|
CAN: t("addresses.forms.country.canada"),
|
|
72
83
|
MEX: t("addresses.forms.country.mexico"),
|
|
84
|
+
FRA: t("addresses.forms.country.france"),
|
|
85
|
+
COL: t("addresses.forms.country.colombia"),
|
|
73
86
|
};
|
|
74
87
|
|
|
75
88
|
const cleanCompletedAddress = () => {
|
|
@@ -79,25 +92,76 @@ export const AddressForm = ({
|
|
|
79
92
|
}
|
|
80
93
|
};
|
|
81
94
|
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const nextNumber = applyHiddenNumberDefault(
|
|
97
|
+
countryKey,
|
|
98
|
+
address.streetNumber
|
|
99
|
+
);
|
|
100
|
+
if (nextNumber !== (address.streetNumber ?? "")) {
|
|
101
|
+
setAddress({ ...address, streetNumber: nextNumber });
|
|
102
|
+
}
|
|
103
|
+
}, [countryKey]);
|
|
104
|
+
|
|
82
105
|
const handleChangePostalCode = (postalCode: string) => {
|
|
83
106
|
setAddress({
|
|
84
107
|
...address,
|
|
85
|
-
zip:
|
|
108
|
+
zip: applyZipInput(countryKey, postalCode),
|
|
86
109
|
});
|
|
87
110
|
};
|
|
88
111
|
|
|
89
112
|
const hideLabel = isEdit || fixedType;
|
|
90
113
|
|
|
91
114
|
const handleCountrySelect = (option: CountryOption) => {
|
|
92
|
-
|
|
115
|
+
const previousCountry = countryKey;
|
|
116
|
+
const fieldsToClear = fieldsToClearOnCountryChange(
|
|
117
|
+
previousCountry,
|
|
118
|
+
option.id,
|
|
119
|
+
address.streetNumber
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const nextAddress: AddressInput = {
|
|
93
123
|
...address,
|
|
94
124
|
country: option.name,
|
|
95
125
|
countryCode: option.id,
|
|
96
|
-
state: "",
|
|
97
|
-
|
|
126
|
+
state: fieldsToClear.includes("state") ? "" : address.state,
|
|
127
|
+
streetNumber: fieldsToClear.includes("streetNumber")
|
|
128
|
+
? ""
|
|
129
|
+
: address.streetNumber,
|
|
130
|
+
neighborhood: fieldsToClear.includes("neighborhood")
|
|
131
|
+
? ""
|
|
132
|
+
: address.neighborhood,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
nextAddress.streetNumber = applyHiddenNumberDefault(
|
|
136
|
+
option.id,
|
|
137
|
+
nextAddress.streetNumber
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
setAddress(nextAddress);
|
|
98
141
|
setSelectedState("");
|
|
99
142
|
};
|
|
100
143
|
|
|
144
|
+
const streetLabel = countryRule.streetAddress.separated
|
|
145
|
+
? t("addresses.forms.streetName")
|
|
146
|
+
: t("addresses.forms.streetAddress");
|
|
147
|
+
|
|
148
|
+
const postalCodeField = (
|
|
149
|
+
<div key="zipCode">
|
|
150
|
+
<InputText
|
|
151
|
+
label={t("addresses.forms.postalCode")}
|
|
152
|
+
value={address.zip}
|
|
153
|
+
className="address-postal-code"
|
|
154
|
+
hasError={Boolean(issueFor("zip"))}
|
|
155
|
+
onChange={(event) => handleChangePostalCode(event.target.value)}
|
|
156
|
+
disabled={!address.countryCode && !address.country}
|
|
157
|
+
/>
|
|
158
|
+
<ErrorMessage
|
|
159
|
+
show={Boolean(issueFor("zip"))}
|
|
160
|
+
message={issueFor("zip")?.message ?? ""}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
|
|
101
165
|
return (
|
|
102
166
|
<>
|
|
103
167
|
{!useExistingAddress ? (
|
|
@@ -134,22 +198,7 @@ export const AddressForm = ({
|
|
|
134
198
|
/>
|
|
135
199
|
</div>
|
|
136
200
|
|
|
137
|
-
{
|
|
138
|
-
<div key="zipCode">
|
|
139
|
-
<InputText
|
|
140
|
-
label={t("addresses.forms.postalCode")}
|
|
141
|
-
value={address.zip}
|
|
142
|
-
className="address-postal-code"
|
|
143
|
-
hasError={isTouched && !address.zip?.trim()}
|
|
144
|
-
onChange={(event) => handleChangePostalCode(event.target.value)}
|
|
145
|
-
disabled={!address.countryCode}
|
|
146
|
-
/>
|
|
147
|
-
<ErrorMessage
|
|
148
|
-
show={isTouched && !address.zip?.trim()}
|
|
149
|
-
message={t("addresses.validation.postalCodeRequired")}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
)}
|
|
201
|
+
{countryRule.zip.renderFirst && postalCodeField}
|
|
153
202
|
|
|
154
203
|
<div key="addressName">
|
|
155
204
|
{isEdit ? (
|
|
@@ -157,7 +206,7 @@ export const AddressForm = ({
|
|
|
157
206
|
label={t("addresses.forms.addressName")}
|
|
158
207
|
value={address.name}
|
|
159
208
|
className="address-name"
|
|
160
|
-
hasError={
|
|
209
|
+
hasError={Boolean(issueFor("name"))}
|
|
161
210
|
onChange={(event) =>
|
|
162
211
|
setAddress({ ...address, name: event.target.value })
|
|
163
212
|
}
|
|
@@ -203,59 +252,68 @@ export const AddressForm = ({
|
|
|
203
252
|
)}
|
|
204
253
|
/>
|
|
205
254
|
)}
|
|
255
|
+
<ErrorMessage
|
|
256
|
+
show={Boolean(issueFor("name"))}
|
|
257
|
+
message={issueFor("name")?.message ?? ""}
|
|
258
|
+
/>
|
|
206
259
|
</div>
|
|
207
260
|
|
|
208
261
|
<div key="streetAddress">
|
|
209
262
|
<InputText
|
|
210
|
-
label={
|
|
263
|
+
label={streetLabel}
|
|
211
264
|
value={address.streetAddress}
|
|
212
265
|
className="street-address"
|
|
213
|
-
hasError={
|
|
266
|
+
hasError={Boolean(issueFor("streetAddress"))}
|
|
214
267
|
onChange={(event) =>
|
|
215
268
|
setAddress({ ...address, streetAddress: event.target.value })
|
|
216
269
|
}
|
|
217
270
|
/>
|
|
218
271
|
<ErrorMessage
|
|
219
|
-
show={
|
|
220
|
-
message={
|
|
272
|
+
show={Boolean(issueFor("streetAddress"))}
|
|
273
|
+
message={issueFor("streetAddress")?.message ?? ""}
|
|
221
274
|
/>
|
|
222
275
|
</div>
|
|
223
276
|
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
277
|
+
{countryRule.streetNumber.visible && (
|
|
278
|
+
<div key="streetNumber">
|
|
279
|
+
<InputText
|
|
280
|
+
label={t("addresses.forms.number")}
|
|
281
|
+
value={address.streetNumber || ""}
|
|
282
|
+
className="address-number"
|
|
283
|
+
hasError={Boolean(issueFor("streetNumber"))}
|
|
284
|
+
onChange={(event) =>
|
|
285
|
+
setAddress({
|
|
286
|
+
...address,
|
|
287
|
+
streetNumber: applyNumberInput(
|
|
288
|
+
countryKey,
|
|
289
|
+
event.target.value
|
|
290
|
+
),
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
/>
|
|
294
|
+
<ErrorMessage
|
|
295
|
+
show={Boolean(issueFor("streetNumber"))}
|
|
296
|
+
message={issueFor("streetNumber")?.message ?? ""}
|
|
297
|
+
/>
|
|
298
|
+
</div>
|
|
299
|
+
)}
|
|
300
|
+
|
|
301
|
+
{countryRule.neighborhood.visible && (
|
|
302
|
+
<div key="neighborhood">
|
|
303
|
+
<InputText
|
|
304
|
+
label={t(countryRule.neighborhood.labelKey)}
|
|
305
|
+
value={address.neighborhood || ""}
|
|
306
|
+
className="address-neighborhood"
|
|
307
|
+
hasError={Boolean(issueFor("neighborhood"))}
|
|
308
|
+
onChange={(event) =>
|
|
309
|
+
setAddress({ ...address, neighborhood: event.target.value })
|
|
310
|
+
}
|
|
311
|
+
/>
|
|
312
|
+
<ErrorMessage
|
|
313
|
+
show={Boolean(issueFor("neighborhood"))}
|
|
314
|
+
message={issueFor("neighborhood")?.message ?? ""}
|
|
315
|
+
/>
|
|
316
|
+
</div>
|
|
259
317
|
)}
|
|
260
318
|
|
|
261
319
|
<div key="streetAddress2">
|
|
@@ -274,89 +332,82 @@ export const AddressForm = ({
|
|
|
274
332
|
label={t("addresses.forms.city")}
|
|
275
333
|
className="address-city"
|
|
276
334
|
value={address.city}
|
|
277
|
-
hasError={
|
|
335
|
+
hasError={Boolean(issueFor("city"))}
|
|
278
336
|
onChange={(event) =>
|
|
279
337
|
setAddress({ ...address, city: event.target.value })
|
|
280
338
|
}
|
|
281
339
|
/>
|
|
282
340
|
<ErrorMessage
|
|
283
|
-
show={
|
|
284
|
-
message={
|
|
341
|
+
show={Boolean(issueFor("city"))}
|
|
342
|
+
message={issueFor("city")?.message ?? ""}
|
|
285
343
|
/>
|
|
286
344
|
</div>
|
|
287
345
|
|
|
288
|
-
|
|
289
|
-
<
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
renderOption={(option, index) => {
|
|
311
|
-
const stateData = findStateByDisplayValue(
|
|
312
|
-
address.countryCode || "",
|
|
313
|
-
option
|
|
314
|
-
);
|
|
315
|
-
const isSelected = stateData
|
|
316
|
-
? isStateSelected(address.state, stateData)
|
|
317
|
-
: false;
|
|
318
|
-
|
|
319
|
-
return (
|
|
320
|
-
<AutocompleteDropdown.Item
|
|
321
|
-
key={`${option}-${index}`}
|
|
322
|
-
closeOnClick
|
|
323
|
-
index={index}
|
|
324
|
-
isSelected={isSelected}
|
|
325
|
-
onClick={() => {
|
|
326
|
-
if (stateData) {
|
|
327
|
-
setSelectedState(getStateDisplayValue(stateData));
|
|
328
|
-
setAddress({
|
|
329
|
-
...address,
|
|
330
|
-
state: getStateSaveValue(stateData),
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}}
|
|
334
|
-
>
|
|
335
|
-
{option}
|
|
336
|
-
{isSelected && <Icon name="Check" width={12} height={12} />}
|
|
337
|
-
</AutocompleteDropdown.Item>
|
|
338
|
-
);
|
|
339
|
-
}}
|
|
340
|
-
/>
|
|
341
|
-
</div>
|
|
342
|
-
|
|
343
|
-
{address.countryCode !== "BRA" && (
|
|
344
|
-
<div key="zipCode">
|
|
345
|
-
<InputText
|
|
346
|
-
label={t("addresses.forms.postalCode")}
|
|
347
|
-
value={address.zip}
|
|
348
|
-
className="address-postal-code"
|
|
349
|
-
hasError={isTouched && !address.zip?.trim()}
|
|
350
|
-
onChange={(event) => handleChangePostalCode(event.target.value)}
|
|
346
|
+
{countryRule.state.visible && (
|
|
347
|
+
<div key="state">
|
|
348
|
+
<AutocompleteDropdown
|
|
349
|
+
data-fs-bp-create-address-state-selector
|
|
350
|
+
label={t("addresses.forms.state")}
|
|
351
|
+
className="address-state"
|
|
352
|
+
value={selectedState}
|
|
353
|
+
options={getStateDisplayOptions(address.countryCode || "")}
|
|
354
|
+
shouldCloseOnSelect
|
|
355
|
+
onConfirmKeyPress={(option) => {
|
|
356
|
+
const stateData = findStateByDisplayValue(
|
|
357
|
+
address.countryCode || "",
|
|
358
|
+
option
|
|
359
|
+
);
|
|
360
|
+
if (stateData) {
|
|
361
|
+
setSelectedState(option);
|
|
362
|
+
setAddress({
|
|
363
|
+
...address,
|
|
364
|
+
state: getStateSaveValue(stateData),
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}}
|
|
351
368
|
disabled={!address.countryCode}
|
|
369
|
+
renderOption={(option, index) => {
|
|
370
|
+
const stateData = findStateByDisplayValue(
|
|
371
|
+
address.countryCode || "",
|
|
372
|
+
option
|
|
373
|
+
);
|
|
374
|
+
const isSelected = stateData
|
|
375
|
+
? isStateSelected(address.state, stateData)
|
|
376
|
+
: false;
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<AutocompleteDropdown.Item
|
|
380
|
+
key={`${option}-${index}`}
|
|
381
|
+
closeOnClick
|
|
382
|
+
index={index}
|
|
383
|
+
isSelected={isSelected}
|
|
384
|
+
onClick={() => {
|
|
385
|
+
if (stateData) {
|
|
386
|
+
setSelectedState(getStateDisplayValue(stateData));
|
|
387
|
+
setAddress({
|
|
388
|
+
...address,
|
|
389
|
+
state: getStateSaveValue(stateData),
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
{option}
|
|
395
|
+
{isSelected && (
|
|
396
|
+
<Icon name="Check" width={12} height={12} />
|
|
397
|
+
)}
|
|
398
|
+
</AutocompleteDropdown.Item>
|
|
399
|
+
);
|
|
400
|
+
}}
|
|
352
401
|
/>
|
|
353
402
|
<ErrorMessage
|
|
354
|
-
show={
|
|
355
|
-
message={
|
|
403
|
+
show={Boolean(issueFor("state"))}
|
|
404
|
+
message={issueFor("state")?.message ?? ""}
|
|
356
405
|
/>
|
|
357
406
|
</div>
|
|
358
407
|
)}
|
|
359
408
|
|
|
409
|
+
{!countryRule.zip.renderFirst && postalCodeField}
|
|
410
|
+
|
|
360
411
|
{isEdit && (
|
|
361
412
|
<div key="geoCoordinates">
|
|
362
413
|
<InputText
|
|
@@ -399,6 +450,10 @@ export const AddressForm = ({
|
|
|
399
450
|
</AutocompleteDropdown.Item>
|
|
400
451
|
)}
|
|
401
452
|
/>
|
|
453
|
+
<ErrorMessage
|
|
454
|
+
show={Boolean(issueFor("types"))}
|
|
455
|
+
message={issueFor("types")?.message ?? ""}
|
|
456
|
+
/>
|
|
402
457
|
</div>
|
|
403
458
|
)}
|
|
404
459
|
</div>
|
|
@@ -22,6 +22,7 @@ import { useLocalization } from "../../../shared/localization/LocalizationContex
|
|
|
22
22
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
23
23
|
import { useCreateNewAddress } from "../../hooks";
|
|
24
24
|
import { LocationInput } from "../../types/AddressData";
|
|
25
|
+
import { collectAddressIssues } from "../../utils";
|
|
25
26
|
|
|
26
27
|
import type { RecipientInput, AddressInput, AddressData } from "../../types";
|
|
27
28
|
|
|
@@ -155,30 +156,8 @@ export const CreateAddressDrawer = ({
|
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const hasRequiredFields =
|
|
161
|
-
address.name &&
|
|
162
|
-
address.streetAddress &&
|
|
163
|
-
address.country &&
|
|
164
|
-
address.zip &&
|
|
165
|
-
address.state &&
|
|
166
|
-
address.city &&
|
|
167
|
-
address.types.length > 0;
|
|
168
|
-
|
|
169
|
-
const hasBrazilianNumber =
|
|
170
|
-
!isBrazil || (isBrazil && address.streetNumber?.trim());
|
|
171
|
-
|
|
172
|
-
const hasBrazilianNeighborhood =
|
|
173
|
-
!isBrazil || (isBrazil && address.neighborhood?.trim());
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
(hasRequiredFields && hasBrazilianNumber && hasBrazilianNeighborhood) ||
|
|
177
|
-
useExistingAddress
|
|
178
|
-
);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const isConfirmButtonEnabled = hasMinimumAddressInformation();
|
|
159
|
+
const isConfirmButtonEnabled =
|
|
160
|
+
useExistingAddress || collectAddressIssues(address, t).length === 0;
|
|
182
161
|
|
|
183
162
|
return (
|
|
184
163
|
<BasicDrawer data-fs-bp-create-address-drawer close={close} {...props}>
|
|
@@ -8,6 +8,7 @@ import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
|
8
8
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
9
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
10
10
|
import { useEditAddress } from "../../hooks";
|
|
11
|
+
import { collectAddressIssues } from "../../utils";
|
|
11
12
|
|
|
12
13
|
import type { AddressInput, AddressData } from "../../types";
|
|
13
14
|
|
|
@@ -91,27 +92,7 @@ export const EditAddressDrawer = ({
|
|
|
91
92
|
});
|
|
92
93
|
};
|
|
93
94
|
|
|
94
|
-
const
|
|
95
|
-
const isBrazil = address.countryCode === "BRA";
|
|
96
|
-
const hasRequiredFields =
|
|
97
|
-
address.name &&
|
|
98
|
-
address.streetAddress &&
|
|
99
|
-
address.country &&
|
|
100
|
-
address.zip &&
|
|
101
|
-
address.state &&
|
|
102
|
-
address.city &&
|
|
103
|
-
address.types.length > 0;
|
|
104
|
-
|
|
105
|
-
const hasBrazilianNumber =
|
|
106
|
-
!isBrazil || (isBrazil && address.streetNumber?.trim());
|
|
107
|
-
|
|
108
|
-
const hasBrazilianNeighborhood =
|
|
109
|
-
!isBrazil || (isBrazil && address.neighborhood?.trim());
|
|
110
|
-
|
|
111
|
-
return hasRequiredFields && hasBrazilianNumber && hasBrazilianNeighborhood;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const isConfirmButtonEnabled = hasMinimumAddressInformation();
|
|
95
|
+
const isConfirmButtonEnabled = collectAddressIssues(address, t).length === 0;
|
|
115
96
|
|
|
116
97
|
return (
|
|
117
98
|
<BasicDrawer data-fs-bp-edit-address-drawer close={close} {...props}>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** 32 departments + Bogotá D.C. */
|
|
2
|
+
export const states = [
|
|
3
|
+
"Amazonas",
|
|
4
|
+
"Antioquia",
|
|
5
|
+
"Arauca",
|
|
6
|
+
"Atlántico",
|
|
7
|
+
"Bogotá D.C.",
|
|
8
|
+
"Bolívar",
|
|
9
|
+
"Boyacá",
|
|
10
|
+
"Caldas",
|
|
11
|
+
"Caquetá",
|
|
12
|
+
"Casanare",
|
|
13
|
+
"Cauca",
|
|
14
|
+
"Cesar",
|
|
15
|
+
"Chocó",
|
|
16
|
+
"Córdoba",
|
|
17
|
+
"Cundinamarca",
|
|
18
|
+
"Guainía",
|
|
19
|
+
"Guaviare",
|
|
20
|
+
"Huila",
|
|
21
|
+
"La Guajira",
|
|
22
|
+
"Magdalena",
|
|
23
|
+
"Meta",
|
|
24
|
+
"Nariño",
|
|
25
|
+
"Norte de Santander",
|
|
26
|
+
"Putumayo",
|
|
27
|
+
"Quindío",
|
|
28
|
+
"Risaralda",
|
|
29
|
+
"Archipiélago de San Andrés, Providencia y Santa Catalina",
|
|
30
|
+
"Santander",
|
|
31
|
+
"Sucre",
|
|
32
|
+
"Tolima",
|
|
33
|
+
"Valle del Cauca",
|
|
34
|
+
"Vaupés",
|
|
35
|
+
"Vichada",
|
|
36
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const states: string[] = [];
|
|
@@ -8,6 +8,8 @@ export const CountryOptions: CountryOption[] = [
|
|
|
8
8
|
{ id: "USA", name: "United States of America" },
|
|
9
9
|
{ id: "CAN", name: "Canada" },
|
|
10
10
|
{ id: "MEX", name: "Mexico" },
|
|
11
|
+
{ id: "FRA", name: "France" },
|
|
12
|
+
{ id: "COL", name: "Colombia" },
|
|
11
13
|
];
|
|
12
14
|
|
|
13
|
-
export type CountryCodes = "USA" | "MEX" | "BRA" | "CAN";
|
|
15
|
+
export type CountryCodes = "USA" | "MEX" | "BRA" | "CAN" | "FRA" | "COL";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { states as BRAStates } from "./BRA";
|
|
2
2
|
import { states as CANStates } from "./CAN";
|
|
3
|
+
import { states as COLStates } from "./COL";
|
|
4
|
+
import { states as FRAStates } from "./FRA";
|
|
3
5
|
import { states as MEXStates } from "./MEX";
|
|
4
6
|
import { states as USAStates, StateOption } from "./USA";
|
|
5
7
|
|
|
@@ -10,4 +12,6 @@ export const states: Record<string, StateData[]> = {
|
|
|
10
12
|
BRA: BRAStates,
|
|
11
13
|
USA: USAStates,
|
|
12
14
|
CAN: CANStates,
|
|
15
|
+
FRA: FRAStates,
|
|
16
|
+
COL: COLStates,
|
|
13
17
|
};
|