Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"Products": "Producten",
"Quantity": "Hoeveelheid",
"Region": "Regio",
"Register": "Registreren",
"Related products": "Gerelateerde producten",
"Relevance": "Relevantie",
"Remove": "Verwijderen",
Expand Down
1 change: 0 additions & 1 deletion resources/js/components/Checkout/CheckoutLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion resources/js/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 6 additions & 5 deletions resources/js/stores/useUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/checkout/pages/onestep.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
).catch();
}">
<div class="lg:w-1/2 lg:pr-2.5 lg:col-span-2">
@include('rapidez::checkout.steps.login')
@include('rapidez::checkout.steps.login', ['onestep' => true])
</div>
<div v-if="!cart.is_virtual">
<h2 class="text-xl font-bold mb-3 lg:mb-9">@lang('Shipping address')</h2>
Expand Down
9 changes: 9 additions & 0 deletions resources/views/checkout/steps/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
type="email"
v-model="checkoutLogin.email"
v-bind:disabled="loggedIn"
v-on:change="() => checkoutLogin.go()"
required
/>
</label>
Expand Down Expand Up @@ -62,5 +63,13 @@
@lang('Create an account')
</x-rapidez::input.checkbox>
</template>
@if ($onestep ?? false)
<template v-if="!loggedIn && (checkoutLogin.createAccount || !checkoutLogin.isEmailAvailable)">
<x-rapidez::button.conversion v-on:click="checkoutLogin.go" type="button" formnovalidate data-testid="login" class="mt-3" loader>
<template v-if="checkoutLogin.createAccount && checkoutLogin.isEmailAvailable">@lang('Register')</template>
<template v-else>@lang('Login')</template>
</x-rapidez::button.conversion>
</template>
@endif
</fieldset>
</checkout-login>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/playwright/pages/CheckoutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down