Skip to content

Commit d61c074

Browse files
authored
Merge pull request #252 from vtex-apps/fix/mlt-postalcode
fix: add postal code to malta
2 parents fb5bcb3 + 1bf1e42 commit d61c074

File tree

7 files changed

+59
-45
lines changed

7 files changed

+59
-45
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- add postal code to Malta
13+
1014
## [0.18.7] - 2024-07-15
1115

1216
### Fixed

checkout-ui-custom/checkout6-custom.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checkout-ui-custom/checkout6-custom.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checkout-ui-custom/src/_js/_customAddressForm.js

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
/* eslint-disable func-names */
55
/* eslint-disable max-params */
66
const { _locale } = require('./_locale-infos.js')
7-
const { _countries,_countriesrules, _cities, _addressPlaceholder } = require('./_countries.js')
7+
const {
8+
_countries,
9+
_countriesrules,
10+
_cities,
11+
_addressPlaceholder,
12+
} = require('./_countries.js')
813
const { getShipStateValue } = require('./_utils')
914

1015
// temporaly workaorund
@@ -448,14 +453,14 @@ class fnsCustomAddressForm {
448453
// temporaly workaround for MLT
449454
if (_country === 'MLT') {
450455
_state = null
451-
_postalCode = null
452456
}
453457
// end temporaly workaround for MLT
454458

455459
// temporaly workaround for USA and CAN
456460
if (
457461
_country === 'USA' ||
458462
_country === 'ITA' ||
463+
_country === 'MLT' ||
459464
_country === 'CAN'
460465
) {
461466
_number = null
@@ -1122,7 +1127,7 @@ class fnsCustomAddressForm {
11221127
.then(jsonRes => {
11231128
const { data: rules, success } = jsonRes
11241129

1125-
if(country=="MLT") {
1130+
if (country == 'MLT') {
11261131
return _countriesrules.MLT
11271132
}
11281133

@@ -1172,49 +1177,50 @@ class fnsCustomAddressForm {
11721177
$('.vcustom--vtex-omnishipping-1-x-address').length < 1 &&
11731178
orderForm.items.length
11741179
) {
1175-
1176-
const lastCountry = _this.orderForm.shippingData?.address?.country || _this.orderForm.storePreferencesData.countryCode
1180+
const lastCountry =
1181+
(_this.orderForm.shippingData &&
1182+
_this.orderForm.shippingData.address &&
1183+
_this.orderForm.shippingData.address.country) ||
1184+
_this.orderForm.storePreferencesData.countryCode
11771185

11781186
$('body').addClass(`${this.classOn}`)
11791187
_this.orderForm = orderForm
1180-
_this
1181-
.getCountryRule(lastCountry)
1182-
.then(rules => {
1183-
_this.addressrules = rules
1184-
_this.bind()
1185-
_this.deliveryCountries = window.checkout.deliveryCountries()
1186-
_this.mainCountry = window.checkout.countryCode()
1187-
_this.lang = _this.orderForm.clientPreferencesData.locale
1188-
1189-
_this.locale =
1190-
_locale[_this.orderForm.storePreferencesData.countryCode] ||
1191-
_locale.GBR
1192-
1193-
if (_this.lang === 'es-AR') _this.lang = 'es'
1194-
1195-
if (_this.orderForm && _this.orderForm.shippingData) {
1196-
const shippingData = _this.orderForm.shippingData.address
1197-
1198-
if (shippingData) {
1199-
_this.updateAddress(
1200-
shippingData.country,
1201-
shippingData.postalCode,
1202-
shippingData.city,
1203-
shippingData.state,
1204-
shippingData.street,
1205-
shippingData.number,
1206-
shippingData.complement,
1207-
'',
1208-
shippingData.addressId,
1209-
shippingData.geoCoordinates
1210-
)
1211-
} else {
1212-
_this.updateAddress('')
1213-
}
1188+
_this.getCountryRule(lastCountry).then(rules => {
1189+
_this.addressrules = rules
1190+
_this.bind()
1191+
_this.deliveryCountries = window.checkout.deliveryCountries()
1192+
_this.mainCountry = window.checkout.countryCode()
1193+
_this.lang = _this.orderForm.clientPreferencesData.locale
1194+
1195+
_this.locale =
1196+
_locale[_this.orderForm.storePreferencesData.countryCode] ||
1197+
_locale.GBR
1198+
1199+
if (_this.lang === 'es-AR') _this.lang = 'es'
1200+
1201+
if (_this.orderForm && _this.orderForm.shippingData) {
1202+
const shippingData = _this.orderForm.shippingData.address
1203+
1204+
if (shippingData) {
1205+
_this.updateAddress(
1206+
shippingData.country,
1207+
shippingData.postalCode,
1208+
shippingData.city,
1209+
shippingData.state,
1210+
shippingData.street,
1211+
shippingData.number,
1212+
shippingData.complement,
1213+
'',
1214+
shippingData.addressId,
1215+
shippingData.geoCoordinates
1216+
)
1217+
} else {
1218+
_this.updateAddress('')
12141219
}
1220+
}
12151221

1216-
_this.form(orderForm)
1217-
})
1222+
_this.form(orderForm)
1223+
})
12181224
}
12191225
}
12201226
}

checkout-ui-custom/src/_scss/_components/_customAddressForm.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,7 @@ body.v-custom-fnsCustomAddressForm {
243243
margin: 30px auto 0 auto;
244244
text-align: center;
245245
}
246+
247+
.vtex-omnishipping-1-x-addressSummaryActive .address-summary.address-summary-MLT .postalCode:before {
248+
content:" - ";
249+
}

node/templates/checkout6-custom.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/templates/checkout6-custom.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)