amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
106 stars 76 forks source link

emailComponent. call().hasRendered is not a function #1232

Open alex-james opened 6 months ago

alex-james commented 6 months ago

I'm running Magento 2.4.6-p4 Open Source with the Amazon module 5.16.1,

After logging in to Amazon / confirming existing login and returning to the checkout Delivery step I see the following in the console log:

Uncaught TypeError: emailComponent. call...).hasRendered is not a function at UiClass. setEmail (checkout-address,is:105:43) at checkout-addressis:72:26 at handleResponse (checkout-session address-load,15:35;13) at Object. validateAndHandle (checkout-session=address-load, j.s:43;13) at fire (iguery. js:3500:50) at Object. firewith [as resolvewith] (jguery js:3630:29) at done (iquery. is:9796:30) at XMLHt tpRequest. <anonymous> (iguery.is: 10057:37)

Looking at the code it relates to changes in view/frontend/web/js/view/checkout-address.js to the setEmail() function which has changed (at least since v5.10.0) to include calls to:

emailComponent.call().hasRendered()

the view/frontend/web/js/view/form/element/email.js script referenced by emailComponent does not include a call() or hasRendered() method.

I'm also struggling to understand the reason for the setEmail() function as the email field is surely a KO component with a callback in view/frontend/web/js/view/form/element/email.js as emailHasChanged() which handles changes and seems to server the same purpose as setEmail() by calling:

checkoutData.setValidatedEmailValue() and checkoutData.setInputFieldEmailValue(