Skip to content

Commit

Permalink
fix(storefront): BCTHEME-535 Translation Gap: Cart -> Shipping estima…
Browse files Browse the repository at this point in the history
…tor error messages.
  • Loading branch information
“bc-yevhenii-buliuk” committed May 25, 2021
1 parent 31ac15a commit 1e2666f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Translation Gap: Cart -> Shipping estimator error messages. [#2065](https://github.com/bigcommerce/cornerstone/pull/2065)
- Added settings for payment banners. [#2021](https://github.com/bigcommerce/cornerstone/pull/2021)
- Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039)
- Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047)
Expand Down
6 changes: 5 additions & 1 deletion assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ export default class Cart extends PageManager {
this.bindGiftCertificateEvents();

// initiate shipping estimator module
this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'));
const shippingErrorMessages = {
country: this.context.shippingCountryErrorMessage,
province: this.context.shippingProvinceErrorMessage
}
this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'), shippingErrorMessages);
}
}
7 changes: 4 additions & 3 deletions assets/js/theme/cart/shipping-estimator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import collapsibleFactory from '../common/collapsible';
import swal from '../global/sweet-alert';

export default class ShippingEstimator {
constructor($element) {
constructor($element, shippingErrorMessages) {
this.$element = $element;

this.$state = $('[data-field-type="State"]', this.$element);
this.isEstimatorFormOpened = false;
this.shippingErrorMessages = shippingErrorMessages;
this.initFormValidation();
this.bindStateCountryChange();
this.bindEstimatorEvents();
Expand Down Expand Up @@ -63,7 +64,7 @@ export default class ShippingEstimator {

cb(result);
},
errorMessage: 'The \'Country\' field cannot be blank.',
errorMessage: this.shippingErrorMessages.country
},
]);
}
Expand All @@ -85,7 +86,7 @@ export default class ShippingEstimator {

cb(result);
},
errorMessage: 'The \'State/Province\' field cannot be blank.',
errorMessage: this.shippingErrorMessages.province
},
]);
}
Expand Down
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
"zip_postal_code": "Zip/postcode",
"free_shipping": "Free shipping",
"hide_ups_rates": "Hide UPS Rates",
"show_ups_rates": "Show UPS Rates"
"show_ups_rates": "Show UPS Rates",
"empty_country_error": "The Country field cannot be blank.",
"empty_province_error": "The State/Province field cannot be blank."
},
"gift_wrapping": {
"title": "Gift Wrapping",
Expand Down
3 changes: 3 additions & 0 deletions templates/components/cart/shipping-estimator.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{{inject 'shippingCountryErrorMessage' (lang 'cart.shipping_estimator.empty_country_error')}}
{{inject 'shippingProvinceErrorMessage' (lang 'cart.shipping_estimator.empty_province_error')}}

{{#if shipping_cost}}
<div class="cart-total-value">
<div class="subtotal shipping-estimate-show">
Expand Down

0 comments on commit 1e2666f

Please sign in to comment.