Skip to content

Commit

Permalink
Merge pull request vtex-apps#253 from vtex-apps/fix/ita-number
Browse files Browse the repository at this point in the history
fix:  Italian number when using custom address form
  • Loading branch information
lucvysk authored Sep 9, 2024
2 parents 4863717 + 7608d3f commit 017c529
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Italian number when using custom address form

## [0.18.8] - 2024-07-23

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion checkout-ui-custom/checkout6-custom.js

Large diffs are not rendered by default.

50 changes: 44 additions & 6 deletions checkout-ui-custom/src/_js/_countries.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
module.exports._countriesrules = {
ITA: {
postalCode: {
valueIn: "long_name",
types: [
"postal_code"
],
required: false
},
number: {
valueIn: "long_name",
types: [
"street_number"
],
required: true,
notApplicable: true
},
street: {
valueIn: "long_name",
types: [
"route"
]
},
neighborhood: {
valueIn: "long_name",
types: [
"neighborhood",
"sublocality_level_1",
"sublocality_level_2",
"sublocality_level_3",
"sublocality_level_4",
"sublocality_level_5"
]
},
state: {
valueIn: 'short_name',
types: ['administrative_area_level_2'],
valueIn: "short_name",
types: [
"administrative_area_level_2"
]
},
city: {
valueIn: 'long_name',
types: ['locality'],
valueIn: "long_name",
types: [
"administrative_area_level_3",
"locality"
]
},
number: true,
postalCode: true,
receiverName: {
required: true
}
},
GBR: {
state: {
Expand Down
4 changes: 3 additions & 1 deletion checkout-ui-custom/src/_js/_customAddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ class fnsCustomAddressForm {
// temporaly workaround for USA and CAN
if (
_country === 'USA' ||
_country === 'ITA' ||
_country === 'MLT' ||
_country === 'CAN'
) {
Expand Down Expand Up @@ -1130,6 +1129,9 @@ class fnsCustomAddressForm {
if (country == 'MLT') {
return _countriesrules.MLT
}
if (country == 'ITA') {
return _countriesrules.ITA
}

return success ? rules.geolocation : _this.getCountryRule('default')
})
Expand Down
2 changes: 1 addition & 1 deletion node/templates/checkout6-custom.js

Large diffs are not rendered by default.

0 comments on commit 017c529

Please sign in to comment.