mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge branch 'trunk' into PCP-3030-fastlane-improvements-for-kadence-theme
This commit is contained in:
commit
e99c1ea75f
6 changed files with 27 additions and 4 deletions
|
@ -6,6 +6,7 @@ import BillingView from "./Views/BillingView";
|
|||
import CardView from "./Views/CardView";
|
||||
import PayPalInsights from "./Insights/PayPalInsights";
|
||||
import {disable,enable} from "../../../ppcp-button/resources/js/modules/Helper/ButtonDisabler";
|
||||
import {getCurrentPaymentMethod} from "../../../ppcp-button/resources/js/modules/Helper/CheckoutMethodState";
|
||||
|
||||
class AxoManager {
|
||||
|
||||
|
@ -154,6 +155,13 @@ class AxoManager {
|
|||
this.cardView.refresh();
|
||||
});
|
||||
|
||||
// Prevents sending checkout form when pressing Enter key on input field
|
||||
// and triggers customer lookup
|
||||
this.$('form.woocommerce-checkout input').on('keydown', async (ev) => {
|
||||
if(ev.key === 'Enter' && getCurrentPaymentMethod() === 'ppcp-axo-gateway' ) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
rerender() {
|
||||
|
@ -222,6 +230,8 @@ class AxoManager {
|
|||
}
|
||||
|
||||
if (scenario.axoProfileViews) {
|
||||
this.el.billingAddressContainer.hide();
|
||||
|
||||
this.shippingView.activate();
|
||||
this.billingView.activate();
|
||||
this.cardView.activate();
|
||||
|
@ -520,6 +530,10 @@ class AxoManager {
|
|||
page_type: 'checkout'
|
||||
});
|
||||
|
||||
await this.lookupCustomerByEmail();
|
||||
}
|
||||
|
||||
async lookupCustomerByEmail() {
|
||||
const lookupResponse = await this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);
|
||||
|
||||
if (lookupResponse.customerContextId) {
|
||||
|
@ -537,7 +551,8 @@ class AxoManager {
|
|||
// Add addresses
|
||||
this.setShipping(authResponse.profileData.shippingAddress);
|
||||
this.setBilling({
|
||||
address: authResponse.profileData.card.paymentSource.card.billingAddress
|
||||
address: authResponse.profileData.card.paymentSource.card.billingAddress,
|
||||
phoneNumber: authResponse.profileData.shippingAddress.phoneNumber.nationalNumber ?? ''
|
||||
});
|
||||
this.setCard(authResponse.profileData.card);
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import {setVisible} from "../../../../ppcp-button/resources/js/modules/Helper/Hiding";
|
||||
|
||||
class DomElement {
|
||||
|
||||
constructor(config) {
|
||||
|
|
|
@ -18,6 +18,7 @@ class Fastlane {
|
|||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
reject();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -90,6 +90,10 @@ class BillingView {
|
|||
company: {
|
||||
'selector': '#billing_company_field',
|
||||
'valuePath': null,
|
||||
},
|
||||
phone: {
|
||||
'selector': '#billing_phone_field',
|
||||
'valuePath': 'billing.phoneNumber'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -40,6 +40,7 @@ class ShippingView {
|
|||
<h3>Shipping</h3>
|
||||
<a href="javascript:void(0)" ${this.el.changeShippingAddressLink.attributes}>Edit</a>
|
||||
</div>
|
||||
<div>${data.value('email')}</div>
|
||||
<div>${data.value('company')}</div>
|
||||
<div>${data.value('firstName')} ${data.value('lastName')}</div>
|
||||
<div>${data.value('street1')}</div>
|
||||
|
@ -52,6 +53,9 @@ class ShippingView {
|
|||
`;
|
||||
},
|
||||
fields: {
|
||||
email: {
|
||||
'valuePath': 'email',
|
||||
},
|
||||
firstName: {
|
||||
'key': 'firstName',
|
||||
'selector': '#shipping_first_name_field',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue