Context:
- What is the difference between «
Magento_Checkout/js/checkout-data
»'sgetValidatedEmailValue()
andgetInputFieldEmailValue()
methods? - The «
Magento_Checkout/js/checkout-data
» JavaScript object interface and its implementation - How to get the current customer’s email on the frontend checkout screen?
Implementation
setValidatedEmailValue() method
setInputFieldEmailValue() method
The single usage
Magento_Checkout/js/view/form/element/email::emailHasChanged()
a5fa3af3/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js#L58-L79
/**
* Callback on changing email property
*/
emailHasChanged: function () {
var self = this;
clearTimeout(this.emailCheckTimeout);
if (self.validateEmail()) {
quote.guestEmail = self.email();
checkoutData.setValidatedEmailValue(self.email());
}
this.emailCheckTimeout = setTimeout(function () {
if (self.validateEmail()) {
self.checkEmailAvailability();
} else {
self.isPasswordVisible(false);
}
}, self.checkDelay);
checkoutData.setInputFieldEmailValue(self.email());
},
Details: How is Magento_Checkout/js/view/form/element/email::emailHasChanged()
implemented and used?