Skip to content

Commit

Permalink
Merge pull request #191 from vtex-apps/fix/duplicated-number
Browse files Browse the repository at this point in the history
Puerto Rico country rules + address form duplicated number
  • Loading branch information
lucvysk authored Apr 13, 2023
2 parents f2efb08 + 876498d commit 3f81cf9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Puerto Rico country rules

### Fixed

- address form duplicated number

## [0.9.2] - 2023-04-07

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion checkout-ui-custom/checkout6-custom.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions checkout-ui-custom/src/_js/_countries.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@ module.exports._countriesrules = {
number: false,
postalCode: true,
},
PRI: {
state: 'administrative_area_level_1',
city: 'administrative_are_level_2',
neighborhood: 'locality',
number: false,
postalCode: true,
},
}

// _countries.find(i=>i[0]=="US")
Expand Down
6 changes: 3 additions & 3 deletions checkout-ui-custom/src/_js/_customAddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class fnsCustomAddressForm {
geoCoordinates = ''
) {
$('.vcustom--vtex-omnishipping-1-x-address #v-custom-ship-street').val(
formattedStreet || street
'number' in this.addressrules ? street : formattedStreet || street
)
$('.vcustom--vtex-omnishipping-1-x-address #ship-complement').val(
complement
Expand All @@ -105,11 +105,11 @@ class fnsCustomAddressForm {
)
$('.vcustom--vtex-omnishipping-1-x-address #v-custom-ship-street').attr(
'data-street',
formattedStreet || street
'number' in this.addressrules ? street : formattedStreet || street
)
$('.vcustom--vtex-omnishipping-1-x-address #v-custom-ship-street').attr(
'data-number',
number
'number' in this.addressrules ? number : null
)
$('.vcustom--vtex-omnishipping-1-x-address #v-custom-ship-street').attr(
'data-neighborhood',
Expand Down
1 change: 1 addition & 0 deletions checkout-ui-custom/src/_js/_v.custom.checkout.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ class checkoutCustom {

if (
window.location.hash === '#/payment' &&
orderForm.shippingData.address &&
orderForm.shippingData.address.addressType !== 'search' &&
orderForm.shippingData.address.street === null &&
_this.customAddressForm
Expand Down
2 changes: 1 addition & 1 deletion node/templates/checkout6-custom.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node/templates/checkout6-custom.js

Large diffs are not rendered by default.

0 comments on commit 3f81cf9

Please sign in to comment.