Skip to content

Commit

Permalink
Merge pull request #219 from vtex-apps/fix/indexedItems
Browse files Browse the repository at this point in the history
- match of shipping step as indexOf
  • Loading branch information
lucvysk authored Aug 15, 2023
2 parents 39621db + a8e9fcf commit 992d802
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- match of shipping step as indexOf
- indexedItems when having gift

## [0.13.2] - 2023-08-04

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

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions checkout-ui-custom/src/_js/_customAddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,6 @@ class fnsCustomAddressForm {
$(window).on('orderFormUpdated.vtex', function (evt, orderForm) {
_this.orderForm = orderForm
_this.checkFirstLogin(orderForm)

})

}
Expand All @@ -1023,9 +1022,7 @@ class fnsCustomAddressForm {
.getCountryRule(_this.orderForm.storePreferencesData.countryCode)
.then(rules => {
_this.addressrules = rules
_this.checkFirstLogin(orderForm)
_this.bind()
_this.events()
_this.deliveryCountries = window.checkout.deliveryCountries()
_this.mainCountry = window.checkout.countryCode()
_this.lang = _this.orderForm.clientPreferencesData.locale
Expand Down
19 changes: 5 additions & 14 deletions checkout-ui-custom/src/_js/_v.custom.checkout.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class checkoutCustom {
if (_orderForm.length) {
const indexedInItems = _orderForm.reduce((c, v) => {
if (v.parentItemIndex !== null) {
const index = v.parentItemIndex - giftDifference < 0 ? v.parentItemIndex : v.parentItemIndex - giftDifference
const index = v.parentItemIndex
c[index] = c[index] || []
c[index].push(v)
}
Expand Down Expand Up @@ -838,12 +838,11 @@ class checkoutCustom {
if (window.location.hash) {
const [, hashstep] = window.location.hash.split('/')

const classStep = bClassStep.filter( st => { return ~hashstep.indexOf(st) })
if (
bClassStep.findIndex(st => {
return st === hashstep
}) !== -1
classStep.length
) {
$('body').addClass(prefixClass + hashstep)
$('body').addClass(prefixClass + classStep[0])
}
}
}
Expand Down Expand Up @@ -1000,22 +999,14 @@ class checkoutCustom {

if (_this.customAddressForm) {
_this.customAddressForm = new FnsCustomAddressForm({})
_this.customAddressForm.events()
}
}

goToShippingStep() {
window.location.hash = '#/shipping'
}

activateCustomForm() {
const _this = this

if (_this.customAddressForm) {
$('body').addClass('v-custom-addressForm-on')
_this.customAddressForm.validateAllFields()
}
}

appendMessageEmptyStreet(orderForm) {
const _this = this
if(!(orderForm && orderForm.shippingData && orderForm.shippingData.address && orderForm.shippingData.address.street && orderForm.shippingData.address.street.trim()) ) {
Expand Down
2 changes: 1 addition & 1 deletion node/templates/checkout6-custom.js

Large diffs are not rendered by default.

0 comments on commit 992d802

Please sign in to comment.