How is Magento_Checkout/js/view/form/element/email::emailHasChanged() implemented and used?

checkout
javascript
email
(Dmitry Fedyuk) #1

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

Implementation

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());
},

The single usage

Magento_Checkout/js/view/form/element/email

0 Likes

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