How are the «Magento_Checkout/js/checkout-data»'s setValidatedEmailValue() and setInputFieldEmailValue() methods implemeted and used?

magento_checkout-js-checkout-data
checkout
javascript
frontend-checkout-data
email
(Dmitry Fedyuk) #1

Context:

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?

0 Likes

What is the difference between «Magento_Checkout/js/checkout-data»'s getValidatedEmailValue() and getInputFieldEmailValue() methods?