diff --git a/lang/nl.json b/lang/nl.json index 65a2a42a2..1a1882779 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -74,6 +74,7 @@ "Products": "Producten", "Quantity": "Hoeveelheid", "Region": "Regio", + "Register": "Registreren", "Related products": "Gerelateerde producten", "Relevance": "Relevantie", "Remove": "Verwijderen", diff --git a/resources/js/components/Checkout/CheckoutLogin.vue b/resources/js/components/Checkout/CheckoutLogin.vue index 3df17648d..5173b87b1 100644 --- a/resources/js/components/Checkout/CheckoutLogin.vue +++ b/resources/js/components/Checkout/CheckoutLogin.vue @@ -5,7 +5,6 @@ import { useDebounceFn } from '@vueuse/core' const debouncePromise = useDebounceFn(async function (self) { self.isEmailAvailable = await isEmailAvailable(self.email || '') - await self.handleGuest() }, 300) export default { diff --git a/resources/js/fetch.js b/resources/js/fetch.js index 0416f72e7..cad60ee96 100644 --- a/resources/js/fetch.js +++ b/resources/js/fetch.js @@ -151,7 +151,10 @@ export const magentoGraphQL = (window.magentoGraphQL = async ( console.error(data.errors) data?.errors?.forEach((error) => { - if (!['graphql-authorization', 'graphql-authentication'].includes(error?.extensions?.category)) { + if ( + !['graphql-authorization', 'graphql-authentication'].includes(error?.extensions?.category) || + error.path.includes('generateCustomerToken') + ) { return } diff --git a/resources/js/stores/useUser.js b/resources/js/stores/useUser.js index d49109925..4b51be59f 100644 --- a/resources/js/stores/useUser.js +++ b/resources/js/stores/useUser.js @@ -128,7 +128,7 @@ export const register = async function (email, firstname, lastname, password, in } export const login = async function (email, password) { - return magentoGraphQL( + const response = await magentoGraphQL( 'mutation generateCustomerToken ($email: String!, $password: String!) { generateCustomerToken (email: $email, password: $password) { token } }', { email: email, @@ -137,10 +137,11 @@ export const login = async function (email, password) { { notifyOnError: false, }, - ).then(async (response) => { - await loginByToken(response.data.generateCustomerToken.token) - return response - }) + ) + + await loginByToken(response.data.generateCustomerToken.token) + + return response } export const loginByToken = async function (customerToken) { diff --git a/resources/views/checkout/pages/onestep.blade.php b/resources/views/checkout/pages/onestep.blade.php index e6cd40ee0..ce0ced8aa 100644 --- a/resources/views/checkout/pages/onestep.blade.php +++ b/resources/views/checkout/pages/onestep.blade.php @@ -17,7 +17,7 @@ ).catch(); }">
- @include('rapidez::checkout.steps.login') + @include('rapidez::checkout.steps.login', ['onestep' => true])

@lang('Shipping address')

diff --git a/resources/views/checkout/steps/login.blade.php b/resources/views/checkout/steps/login.blade.php index f889a5943..d5f14249d 100644 --- a/resources/views/checkout/steps/login.blade.php +++ b/resources/views/checkout/steps/login.blade.php @@ -11,6 +11,7 @@ type="email" v-model="checkoutLogin.email" v-bind:disabled="loggedIn" + v-on:change="() => checkoutLogin.go()" required /> @@ -62,5 +63,13 @@ @lang('Create an account') + @if ($onestep ?? false) + + @endif diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Chrome-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Chrome-linux.png index a21003374..f01a00669 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Chrome-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Chrome-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b6c09972465ab9bfe7a4211dc139aea995d82a699ef44b4ce4e7f71161f4ee4 -size 82686 +oid sha256:e44f16dc400d8266921383d0784350a85f36709cd15d9d5248539b59b76cb7d9 +size 84326 diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Safari-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Safari-linux.png index 720ed9c29..323284039 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Safari-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-Mobile-Safari-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4131f296eb036cb140a41edba16af0422a994730fdf82fe7910260b78ffef919 -size 92671 +oid sha256:27f3e44b1de9d71f3dadea6494887b15f82957c747a0ff5e544741f1b2490ffc +size 94418 diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-chromium-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-chromium-linux.png index 4f2182e5d..8200eb15c 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-chromium-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-chromium-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c369f9065cea3ee150821f9c289df6b5a91ad993d29ba4db897d2e0736a017e -size 80011 +oid sha256:5979230a1b1b3d5fcde346ceb985816d4b65bb6ee89cc11c3368a99a569652ff +size 85026 diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-firefox-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-firefox-linux.png index 8da62804e..f608fa2e0 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-firefox-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-firefox-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31e5918fab8e3b7a789098a966e9e3760da1f5972acf2fb2cf45e9f02dbaaf52 -size 129548 +oid sha256:4621e879f498838f7fd0625c2a7e398aa6abcb169a17d500c912b830ee78e420 +size 137217 diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-webkit-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-webkit-linux.png index c1b0b9213..dc657d50f 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-webkit-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-1-webkit-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7c55cc72ecf54ecb7222d050295d53dafc7dea43b30a502716f1fb347a50fbf4 -size 95481 +oid sha256:2296480354aa80ff0e3b74c21924d7f32f1f4ff115174de375a38c1117321e75 +size 102226 diff --git a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-2-webkit-linux.png b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-2-webkit-linux.png index d6d8d81aa..f00071b86 100644 --- a/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-2-webkit-linux.png +++ b/tests/playwright/checkout.spec.js-snapshots/onestep---as-user-2-webkit-linux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f64c2f63864d0ef546553a411b9cddb0c70369f3314a106c05270e9ff272a8e0 -size 84698 +oid sha256:eb995ba7c9b839d401f2b092059270c6dc1c53b7ba82f8bdf453d53ad01b72a1 +size 86633 diff --git a/tests/playwright/pages/CheckoutPage.js b/tests/playwright/pages/CheckoutPage.js index 25e807ec3..e6a1549c4 100644 --- a/tests/playwright/pages/CheckoutPage.js +++ b/tests/playwright/pages/CheckoutPage.js @@ -15,6 +15,8 @@ export class CheckoutPage { async login(email, password = false, register = false) { await this.page.fill('[name=email]', email) + await this.page.locator('[name=email]').dispatchEvent('change') + await this.page.waitForTimeout(200) await this.page.waitForLoadState('networkidle') if (password && !register) { @@ -139,6 +141,9 @@ export class CheckoutPage { if (email) { await this.login(email, password, register) + if (password) await this.page.getByTestId('login').click() + await this.page.waitForTimeout(500) + await this.page.waitForLoadState('networkidle') } await this.shippingAddress()