diff --git a/.changeset/lucky-bananas-carry.md b/.changeset/lucky-bananas-carry.md new file mode 100644 index 0000000000..7d8db2e7b2 --- /dev/null +++ b/.changeset/lucky-bananas-carry.md @@ -0,0 +1,9 @@ +--- +"@graphcommerce/magento-cart-email": patch +"@graphcommerce/magento-newsletter": patch +"@graphcommerce/magento-customer": patch +"@graphcommerce/ecommerce-ui": patch +"@graphcommerce/magento-cart": patch +--- + +Created a new EmailElement component to make re-use easier diff --git a/.changeset/stale-coins-explode.md b/.changeset/stale-coins-explode.md new file mode 100644 index 0000000000..da8385c2ca --- /dev/null +++ b/.changeset/stale-coins-explode.md @@ -0,0 +1,7 @@ +--- +"@graphcommerce/magento-graphcms": minor +"@graphcommerce/magento-customer": minor +"@graphcommerce/magento-store": minor +--- + +Implement confirm email functionality diff --git a/docs/framework/config.md b/docs/framework/config.md index 6db63ef425..ef1e1a000b 100644 --- a/docs/framework/config.md +++ b/docs/framework/config.md @@ -169,14 +169,6 @@ Determines if, after adding a cross-sell item to the cart, the user should be re Default: 'false' -#### customerRequireEmailConfirmation: boolean - -Due to a limitation in the GraphQL API of Magento 2, we need to know if the -customer requires email confirmation. - -This value should match Magento 2's configuration value for -`customer/create_account/confirm` and should be removed once we can query - #### dataLayer: [DatalayerConfig](#DatalayerConfig) #### debug: [GraphCommerceDebugConfig](#GraphCommerceDebugConfig) diff --git a/examples/magento-graphcms/locales/de.po b/examples/magento-graphcms/locales/de.po index 1b25edea64..0f56e66e63 100644 --- a/examples/magento-graphcms/locales/de.po +++ b/examples/magento-graphcms/locales/de.po @@ -28,6 +28,12 @@ msgstr "Über <0/>" msgid "Account" msgstr "Kundenkonto" +msgid "Account confirmation" +msgstr "Bestätigung des Kontos" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Konto bestätigt. Sie können sich jetzt anmelden." + msgid "Add address" msgstr "Adresse hinzufügen" @@ -109,6 +115,9 @@ msgstr "Warenkorb" msgid "Cart ({0})" msgstr "Warenkorb ({0})" +msgid "Categories" +msgstr "Kategorien" + msgid "Change" msgstr "Ändern" @@ -157,6 +166,9 @@ msgstr "Neue E-Mail bestätigen" msgid "Confirm password" msgstr "Passwort bestätigen" +msgid "Confirm registration" +msgstr "Bestätigung der Registrierung" + msgid "Confirmation + Track & trace" msgstr "Bestätigung + Track & Trace" @@ -259,6 +271,9 @@ msgstr "Vergleichsliste leeren" msgid "Fill in your e-mail to login or create an account" msgstr "Geben Sie Ihre E-Mail-Adresse ein, um sich anzumelden oder ein Kundenkonto zu erstellen" +msgid "Fill in your email to confirm registration" +msgstr "Füllen Sie Ihre E-Mail aus, um die Registrierung zu bestätigen" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Geben Sie Ihr neues Passwort ein, bestätigen Sie es und klicken Sie auf die Schaltfläche „Speichern“." @@ -493,9 +508,6 @@ msgstr "Persönliche Daten" msgid "Place order" msgstr "Kostenpflichtig bestellen" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Bitte überprüfen Sie Ihren Posteingang, um Ihre E-Mail-Adresse zu bestätigen ({email})" - msgid "Please enter a valid email address" msgstr "Bitte geben Sie eine gültige E-Mail-Adresse ein" @@ -544,6 +556,9 @@ msgstr "Kürzlich angesehene Produkte" msgid "Region" msgstr "Region" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Registrierung erfolgreich. Bitte überprüfen Sie Ihren Posteingang, um Ihre E-Mail-Adresse zu bestätigen ({email})" + msgid "Relevance" msgstr "Relevanz" @@ -805,6 +820,9 @@ msgstr "Sie bewerten {0}" msgid "You can now <0>sign in again." msgstr "Sie können sich jetzt <0>erneut anmelden." +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "Sie können Ihr Konto nur bestätigen, indem Sie auf den Link in Ihrer E-Mail klicken." + msgid "You can track your order status and much more!" msgstr "Sie können Ihren Bestellstatus und vieles mehr verfolgen!" diff --git a/examples/magento-graphcms/locales/en.po b/examples/magento-graphcms/locales/en.po index b29023f706..ddce61e72c 100644 --- a/examples/magento-graphcms/locales/en.po +++ b/examples/magento-graphcms/locales/en.po @@ -28,6 +28,12 @@ msgstr "Above <0/>" msgid "Account" msgstr "Account" +msgid "Account confirmation" +msgstr "Account confirmation" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Account confirmed. You can now proceed to sign in." + msgid "Add address" msgstr "Add address" @@ -109,6 +115,9 @@ msgstr "Cart" msgid "Cart ({0})" msgstr "Cart ({0})" +msgid "Categories" +msgstr "Categories" + msgid "Change" msgstr "Change" @@ -157,6 +166,9 @@ msgstr "Confirm new email" msgid "Confirm password" msgstr "Confirm password" +msgid "Confirm registration" +msgstr "Confirm registration" + msgid "Confirmation + Track & trace" msgstr "Confirmation + Track & trace" @@ -259,6 +271,9 @@ msgstr "Empty comparelist" msgid "Fill in your e-mail to login or create an account" msgstr "Fill in your e-mail to login or create an account" +msgid "Fill in your email to confirm registration" +msgstr "Fill in your email to confirm registration" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Fill in your new password, confirm it and click on the save button." @@ -493,9 +508,6 @@ msgstr "Personal details" msgid "Place order" msgstr "Place order" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Please check your inbox to validate your email ({email})" - msgid "Please enter a valid email address" msgstr "Please enter a valid email address" @@ -544,6 +556,9 @@ msgstr "Recently viewed products" msgid "Region" msgstr "Region" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Registration successful. Please check your inbox to confirm your email address ({email})" + msgid "Relevance" msgstr "Relevance" @@ -805,6 +820,9 @@ msgstr "You are reviewing {0}" msgid "You can now <0>sign in again." msgstr "You can now <0>sign in again." +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "You can only confirm you account by clicking on the link in your email." + msgid "You can track your order status and much more!" msgstr "You can track your order status and much more!" diff --git a/examples/magento-graphcms/locales/es.po b/examples/magento-graphcms/locales/es.po index 8e76a51f70..e172bf79c9 100644 --- a/examples/magento-graphcms/locales/es.po +++ b/examples/magento-graphcms/locales/es.po @@ -28,6 +28,12 @@ msgstr "Arriba <0/>" msgid "Account" msgstr "Cuenta" +msgid "Account confirmation" +msgstr "Confirmación de cuenta" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Cuenta confirmada. Ahora puede proceder a iniciar sesión." + msgid "Add address" msgstr "Añadir dirección" @@ -109,6 +115,9 @@ msgstr "Carrito" msgid "Cart ({0})" msgstr "Carrito ({0})" +msgid "Categories" +msgstr "Categorías" + msgid "Change" msgstr "Cambiar" @@ -157,6 +166,9 @@ msgstr "Confirmar nuevo correo electrónico" msgid "Confirm password" msgstr "Confirmar contraseña" +msgid "Confirm registration" +msgstr "Confirmar inscripción" + msgid "Confirmation + Track & trace" msgstr "Confirmación + Seguimiento" @@ -259,6 +271,9 @@ msgstr "Ecuación vacía" msgid "Fill in your e-mail to login or create an account" msgstr "Rellene su correo electrónico para iniciar sesión o crear una cuenta" +msgid "Fill in your email to confirm registration" +msgstr "Introduce tu correo electrónico para confirmar el registro" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Rellene su nueva contraseña, confirme e introduzca el botón de guardar." @@ -493,9 +508,6 @@ msgstr "Detalles personales" msgid "Place order" msgstr "Realizar pedido" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Por favor, compruebe su bandeja de entrada para validar su correo electrónico ({email})" - msgid "Please enter a valid email address" msgstr "Por favor, introduzca una dirección de correo electrónico válida" @@ -544,6 +556,9 @@ msgstr "Productos vistos recientemente" msgid "Region" msgstr "Región" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Registro exitoso. Por favor, compruebe su bandeja de entrada para confirmar su dirección de correo electrónico ({email})" + msgid "Relevance" msgstr "Relevancia" @@ -805,6 +820,9 @@ msgstr "Está revisando {0}" msgid "You can now <0>sign in again." msgstr "Ahora puede<0>iniciar sesión de nuevo." +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "Solo puedes confirmar tu cuenta haciendo clic en el enlace de tu correo electrónico." + msgid "You can track your order status and much more!" msgstr "¡Puede seguir el estado de su pedido y mucho más!" diff --git a/examples/magento-graphcms/locales/fr.po b/examples/magento-graphcms/locales/fr.po index d5d6034ccf..c1662849c4 100644 --- a/examples/magento-graphcms/locales/fr.po +++ b/examples/magento-graphcms/locales/fr.po @@ -28,6 +28,12 @@ msgstr "Au-dessus de <0/>" msgid "Account" msgstr "Compte" +msgid "Account confirmation" +msgstr "Confirmation du compte" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Compte confirmé. Vous pouvez maintenant vous connecter." + msgid "Add address" msgstr "Ajouter une adresse" @@ -109,6 +115,9 @@ msgstr "Panier" msgid "Cart ({0})" msgstr "Panier ({0})" +msgid "Categories" +msgstr "Catégories" + msgid "Change" msgstr "Changer" @@ -157,6 +166,9 @@ msgstr "Confirmer le nouvel email" msgid "Confirm password" msgstr "Confirmer le mot de passe" +msgid "Confirm registration" +msgstr "Confirmer l'inscription" + msgid "Confirmation + Track & trace" msgstr "Confirmation + Traçage" @@ -259,6 +271,9 @@ msgstr "Équation vide" msgid "Fill in your e-mail to login or create an account" msgstr "Remplissez votre email pour vous connecter ou créer un compte" +msgid "Fill in your email to confirm registration" +msgstr "Remplissez votre email pour confirmer l'inscription" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Remplissez votre nouveau mot de passe, confirmez-le et cliquez sur le bouton de sauvegarde." @@ -493,9 +508,6 @@ msgstr "Informations personnelles" msgid "Place order" msgstr "Placer la commande" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Veuillez vérifier votre boîte de réception pour valider votre email ({email})" - msgid "Please enter a valid email address" msgstr "Veuillez entrer une adresse email valide" @@ -544,6 +556,9 @@ msgstr "Derniers produits consultés" msgid "Region" msgstr "Région" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Inscription réussie. Veuillez vérifier votre boîte de réception pour confirmer votre adresse email ({email})" + msgid "Relevance" msgstr "Pertinence" @@ -805,6 +820,9 @@ msgstr "Vous évaluez {0}" msgid "You can now <0>sign in again." msgstr "Vous pouvez maintenant<0>vous connecter à nouveau." +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "Vous ne pouvez confirmer votre compte qu'en cliquant sur le lien dans votre email." + msgid "You can track your order status and much more!" msgstr "Vous pouvez suivre l'état de votre commande et beaucoup plus!" diff --git a/examples/magento-graphcms/locales/it.po b/examples/magento-graphcms/locales/it.po index 2720eaef20..9d2282e66b 100644 --- a/examples/magento-graphcms/locales/it.po +++ b/examples/magento-graphcms/locales/it.po @@ -28,6 +28,12 @@ msgstr "Sopra <0/>" msgid "Account" msgstr "Account" +msgid "Account confirmation" +msgstr "Conferma del conto" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Account confermato. Ora puoi procedere con l'accesso." + msgid "Add address" msgstr "Aggiungi indirizzo" @@ -109,6 +115,9 @@ msgstr "Carrello" msgid "Cart ({0})" msgstr "Carrello ({0})" +msgid "Categories" +msgstr "Categorie" + msgid "Change" msgstr "Cambia" @@ -157,6 +166,9 @@ msgstr "Conferma nuovo indirizzo email" msgid "Confirm password" msgstr "Conferma password" +msgid "Confirm registration" +msgstr "Confermare la registrazione" + msgid "Confirmation + Track & trace" msgstr "Conferma + Track & trace" @@ -259,6 +271,9 @@ msgstr "Equazione vuota" msgid "Fill in your e-mail to login or create an account" msgstr "Compila il tuo indirizzo email per accedere o creare un account" +msgid "Fill in your email to confirm registration" +msgstr "Inserite la vostra e-mail per confermare la registrazione" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Compila la tua nuova password, conferma e clicca sul pulsante salva." @@ -493,9 +508,6 @@ msgstr "Dati personali" msgid "Place order" msgstr "Effettua l'ordine" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Controlla la tua casella di posta per validare la tua email ({email})" - msgid "Please enter a valid email address" msgstr "Inserisci un indirizzo email valido" @@ -544,6 +556,9 @@ msgstr "Prodotti visionati recentemente" msgid "Region" msgstr "Regione" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Registrazione riuscita. Controlla la tua casella di posta per confermare il tuo indirizzo email ({email})" + msgid "Relevance" msgstr "Rilevanza" @@ -805,6 +820,9 @@ msgstr "Stai recensendo {0}" msgid "You can now <0>sign in again." msgstr "Ora puoi <0>accedere nuovamente." +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "Puoi confermare il tuo account solo cliccando sul link nella tua email." + msgid "You can track your order status and much more!" msgstr "Puoi controllare lo stato dell'ordine e molto altro!" diff --git a/examples/magento-graphcms/locales/nl.po b/examples/magento-graphcms/locales/nl.po index f9bf1a474a..549bcf348d 100644 --- a/examples/magento-graphcms/locales/nl.po +++ b/examples/magento-graphcms/locales/nl.po @@ -28,6 +28,12 @@ msgstr "Boven <0/>" msgid "Account" msgstr "Account" +msgid "Account confirmation" +msgstr "Account bevestiging" + +msgid "Account confirmed. You can now proceed to sign in." +msgstr "Account bevestigd. U kunt nu doorgaan met inloggen." + msgid "Add address" msgstr "Adres toevoegen" @@ -109,6 +115,9 @@ msgstr "Winkelwagen" msgid "Cart ({0})" msgstr "Winkelwagen ({0})" +msgid "Categories" +msgstr "Categorieën" + msgid "Change" msgstr "Wijzig" @@ -157,6 +166,9 @@ msgstr "Bevestig nieuwe email" msgid "Confirm password" msgstr "Bevestig wachtwoord" +msgid "Confirm registration" +msgstr "Registratie bevestigen" + msgid "Confirmation + Track & trace" msgstr "Bevestiging + Track & trace" @@ -259,6 +271,9 @@ msgstr "Wissen" msgid "Fill in your e-mail to login or create an account" msgstr "Vul uw e-mailadres in om in te loggen of maak een account aan" +msgid "Fill in your email to confirm registration" +msgstr "Vul je e-mailadres in om de registratie te bevestigen" + msgid "Fill in your new password, confirm it and click on the save button." msgstr "Vul uw nieuwe wachtwoord in, bevestig het en klik op de opslaan knop." @@ -493,9 +508,6 @@ msgstr "Persoonlijke details" msgid "Place order" msgstr "Plaats bestelling" -msgid "Please check your inbox to validate your email ({email})" -msgstr "Controleer uw inbox om uw e-mailadres te valideren ({email})" - msgid "Please enter a valid email address" msgstr "Vul een geldig e-mailadres in" @@ -544,6 +556,9 @@ msgstr "Recent bekeken producten" msgid "Region" msgstr "Regio" +msgid "Registration successful. Please check your inbox to confirm your email address ({email})" +msgstr "Registratie succesvol. Controleer uw inbox om uw e-mailadres te bevestigen ({email})" + msgid "Relevance" msgstr "Relevantie" @@ -805,6 +820,9 @@ msgstr "U reviewt {0}" msgid "You can now <0>sign in again." msgstr "U kunt nu <0>opnieuw inloggen" +msgid "You can only confirm you account by clicking on the link in your email." +msgstr "U kunt uw account alleen bevestigen door op de link in uw e-mail te klikken." + msgid "You can track your order status and much more!" msgstr "U kunt uw bestelstatus bijhouden en veel meer!" diff --git a/examples/magento-graphcms/pages/customer/account/confirm.tsx b/examples/magento-graphcms/pages/customer/account/confirm.tsx new file mode 100644 index 0000000000..91e2bc6094 --- /dev/null +++ b/examples/magento-graphcms/pages/customer/account/confirm.tsx @@ -0,0 +1,56 @@ +import { PageOptions } from '@graphcommerce/framer-next-pages' +import { ConfirmCustomerForm } from '@graphcommerce/magento-customer' +import { PageMeta, StoreConfigDocument } from '@graphcommerce/magento-store' +import { GetStaticProps, LayoutOverlayHeader, LayoutTitle } from '@graphcommerce/next-ui' +import { i18n } from '@lingui/core' +import { Trans } from '@lingui/react' +import { Container } from '@mui/material' +import { LayoutOverlay, LayoutOverlayProps } from '../../../components' +import { graphqlSharedClient } from '../../../lib/graphql/graphqlSsrClient' + +type GetPageStaticProps = GetStaticProps + +function AccountConfirmPage() { + return ( + <> + + + + + + + + + + + + ) +} + +const pageOptions: PageOptions = { + overlayGroup: 'account-public', + sharedKey: () => 'account-public', + Layout: LayoutOverlay, +} +AccountConfirmPage.pageOptions = pageOptions + +export default AccountConfirmPage + +export const getStaticProps: GetPageStaticProps = async ({ locale }) => { + const client = graphqlSharedClient(locale) + const conf = client.query({ query: StoreConfigDocument }) + + if (!(await conf).data.storeConfig?.create_account_confirmation) + return { notFound: true, revalidate: 60 * 20 } + + return { + props: { + apolloState: await conf.then(() => client.cache.extract()), + variantMd: 'bottom', + size: 'max', + }, + } +} diff --git a/packages/cli/dist/bin/mesh.js b/packages/cli/dist/bin/mesh.js index 9e6ceb3ff6..72db263955 100755 --- a/packages/cli/dist/bin/mesh.js +++ b/packages/cli/dist/bin/mesh.js @@ -77,7 +77,7 @@ const main = async () => { (0, next_config_1.packageRoots)(packages).forEach((r) => { const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254] .filter((v) => v > mV) - .map((v) => `${r}/schema-${v}/**/*.graphqls`); + .map((v) => `${r}/*/schema-${v}/**/*.graphqls`); conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`); conf.additionalTypeDefs.push(...alsoScan); }); diff --git a/packages/cli/src/bin/mesh.ts b/packages/cli/src/bin/mesh.ts index 13fb6c6fab..1a679d96ad 100755 --- a/packages/cli/src/bin/mesh.ts +++ b/packages/cli/src/bin/mesh.ts @@ -88,7 +88,7 @@ const main = async () => { packageRoots(packages).forEach((r) => { const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254] .filter((v) => v > mV) - .map((v) => `${r}/schema-${v}/**/*.graphqls`) + .map((v) => `${r}/*/schema-${v}/**/*.graphqls`) conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`) conf.additionalTypeDefs.push(...alsoScan) diff --git a/packages/ecommerce-ui/components/FormComponents/EmailElement.tsx b/packages/ecommerce-ui/components/FormComponents/EmailElement.tsx new file mode 100644 index 0000000000..786ee66b78 --- /dev/null +++ b/packages/ecommerce-ui/components/FormComponents/EmailElement.tsx @@ -0,0 +1,27 @@ +import { emailPattern, FieldValues } from '@graphcommerce/react-hook-form' +import { i18n } from '@lingui/core' +import { Trans } from '@lingui/react' +import { TextFieldElement, TextFieldElementProps } from './TextFieldElement' + +export type EmailElementProps = TextFieldElementProps + +export function EmailElement( + props: EmailElementProps, +): JSX.Element { + const { rules, ...rest } = props + return ( + } + autoComplete='email' + rules={{ + pattern: { + value: emailPattern, + message: i18n._(/* i18n */ 'Please enter a valid email address'), + }, + ...rules, + }} + {...rest} + /> + ) +} diff --git a/packages/ecommerce-ui/components/FormComponents/TextFieldElement.tsx b/packages/ecommerce-ui/components/FormComponents/TextFieldElement.tsx index ae334fea85..4887cbde9b 100644 --- a/packages/ecommerce-ui/components/FormComponents/TextFieldElement.tsx +++ b/packages/ecommerce-ui/components/FormComponents/TextFieldElement.tsx @@ -1,6 +1,11 @@ /* eslint-disable no-nested-ternary */ import { InputCheckmark } from '@graphcommerce/next-ui' -import { FieldValues, UseControllerProps, useController } from '@graphcommerce/react-hook-form' +import { + FieldValues, + UseControllerProps, + emailPattern, + useController, +} from '@graphcommerce/react-hook-form' import { i18n } from '@lingui/core' import { TextField, TextFieldProps } from '@mui/material' @@ -31,9 +36,7 @@ export function TextFieldElement({ if (type === 'email' && !rules.pattern) { rules.pattern = { - // eslint-disable-next-line no-useless-escape - value: - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, + value: emailPattern, message: i18n._(/* i18n */ 'Please enter a valid email address'), } } diff --git a/packages/ecommerce-ui/components/FormComponents/index.ts b/packages/ecommerce-ui/components/FormComponents/index.ts index a329125c3d..0c368bfb61 100644 --- a/packages/ecommerce-ui/components/FormComponents/index.ts +++ b/packages/ecommerce-ui/components/FormComponents/index.ts @@ -11,3 +11,4 @@ export * from './RadioButtonGroup' export * from './SelectElement' export * from './TextFieldElement' export * from './ToggleButtonGroup' +export * from './EmailElement' diff --git a/packages/magento-cart-email/EmailForm/EmailForm.tsx b/packages/magento-cart-email/EmailForm/EmailForm.tsx index e2751f565a..633b9f4392 100644 --- a/packages/magento-cart-email/EmailForm/EmailForm.tsx +++ b/packages/magento-cart-email/EmailForm/EmailForm.tsx @@ -1,4 +1,4 @@ -import { TextFieldElement, WaitForQueries } from '@graphcommerce/ecommerce-ui' +import { EmailElement, TextFieldElement, WaitForQueries } from '@graphcommerce/ecommerce-ui' import { useQuery } from '@graphcommerce/graphql' import { ApolloCartErrorAlert, @@ -54,20 +54,12 @@ const EmailFormBase = React.memo((props) => { - } required={required.email} disabled={cartEmail.loading} - rules={{ - required: required.email, - pattern: { value: emailPattern, message: '' }, - }} InputProps={{ autoComplete: 'email', endAdornment: ( diff --git a/packages/magento-cart/components/InlineAccount/InlineAccount.tsx b/packages/magento-cart/components/InlineAccount/InlineAccount.tsx index d6029a1c0f..27a1bba7e5 100644 --- a/packages/magento-cart/components/InlineAccount/InlineAccount.tsx +++ b/packages/magento-cart/components/InlineAccount/InlineAccount.tsx @@ -1,4 +1,3 @@ -import { useQuery } from '@graphcommerce/graphql' import { SignUpFormInline, IsEmailAvailableDocument, @@ -7,7 +6,6 @@ import { } from '@graphcommerce/magento-customer' import { Button, FormRow, extendableComponent } from '@graphcommerce/next-ui' import { Trans } from '@lingui/react' -// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { Box, SxProps, TextField, Theme, Typography } from '@mui/material' import React, { useState } from 'react' import { useCartQuery } from '../../hooks/useCartQuery' @@ -101,8 +99,7 @@ export function InlineAccount(props: InlineAccountProps) { } value={cart?.email} InputProps={{ readOnly: true, diff --git a/packages/magento-customer/Config.graphqls b/packages/magento-customer/Config.graphqls index f665860d89..ec1feb5941 100644 --- a/packages/magento-customer/Config.graphqls +++ b/packages/magento-customer/Config.graphqls @@ -1,13 +1,4 @@ extend input GraphCommerceConfig { - """ - Due to a limitation in the GraphQL API of Magento 2, we need to know if the - customer requires email confirmation. - - This value should match Magento 2's configuration value for - `customer/create_account/confirm` and should be removed once we can query - """ - customerRequireEmailConfirmation: Boolean - """ Enable Guest Checkout Login: During customer login, GraphCommerce queries Magento to determine whether diff --git a/packages/magento-customer/components/AccountSignInUpForm/AccountSignInUpForm.tsx b/packages/magento-customer/components/AccountSignInUpForm/AccountSignInUpForm.tsx index c0caadee61..eec63c5293 100644 --- a/packages/magento-customer/components/AccountSignInUpForm/AccountSignInUpForm.tsx +++ b/packages/magento-customer/components/AccountSignInUpForm/AccountSignInUpForm.tsx @@ -1,4 +1,9 @@ -import { FormAutoSubmit, TextFieldElement, emailPattern } from '@graphcommerce/ecommerce-ui' +import { + EmailElement, + FormAutoSubmit, + TextFieldElement, + emailPattern, +} from '@graphcommerce/ecommerce-ui' import { useApolloClient } from '@graphcommerce/graphql' import { ActionCard, @@ -138,18 +143,11 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) { - } InputProps={{ endAdornment: mode === 'session-expired' ? ( diff --git a/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomer.graphql b/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomer.graphql new file mode 100644 index 0000000000..5819fe4bc1 --- /dev/null +++ b/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomer.graphql @@ -0,0 +1,7 @@ +mutation ConfirmCustomer($key: String!, $email: String!) { + confirmEmail(input: { confirmation_key: $key, email: $email }) { + customer { + email + } + } +} diff --git a/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomerForm.tsx b/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomerForm.tsx new file mode 100644 index 0000000000..b2f77fbeb9 --- /dev/null +++ b/packages/magento-customer/components/ConfirmCustomer/ConfirmCustomerForm.tsx @@ -0,0 +1,108 @@ +import { + EmailElement, + TextFieldElement, + emailPattern, + useFormGqlMutation, +} from '@graphcommerce/ecommerce-ui' +import { + FormActions, + FormRow, + LayoutTitle, + Button, + FullPageMessage, + IconSvg, + iconPerson, +} from '@graphcommerce/next-ui' +import { Trans } from '@lingui/react' +import { Alert, Box, Container, Divider, FormControl, Typography } from '@mui/material' +import { useRouter } from 'next/router' +import { ApolloCustomerErrorAlert } from '../ApolloCustomerError' +import { ConfirmCustomerDocument } from './ConfirmCustomer.gql' + +export function ConfirmCustomerForm() { + const router = useRouter() + + const key = `${router.query.key ?? ''}` + + const form = useFormGqlMutation( + ConfirmCustomerDocument, + { + onBeforeSubmit(variables) { + return { ...variables, key } + }, + }, + { errorPolicy: 'all' }, + ) + + const { control, formState, error, handleSubmit, submittedVariables } = form + const isSubmitSuccessful = formState.isSubmitSuccessful && !error + + const submitHandler = handleSubmit(() => {}) + + const signInButton = ( + + ) + + return ( + + + + + + {!key && ( + ({ my: theme.spacings.xxs })}> + + + )} + {key && ( + <> + + + + + + + + + + + + + ({ my: theme.spacings.xxs })} + error={error} + graphqlErrorAlertProps={{ action: signInButton }} + /> + + {isSubmitSuccessful && ( + ({ my: theme.spacings.xxs })} + action={signInButton} + > + + + )} + + )} + + ) +} diff --git a/packages/magento-customer/components/ResetPasswordForm/ResetPasswordForm.tsx b/packages/magento-customer/components/ResetPasswordForm/ResetPasswordForm.tsx index ef4a78bc92..8a199d8038 100644 --- a/packages/magento-customer/components/ResetPasswordForm/ResetPasswordForm.tsx +++ b/packages/magento-customer/components/ResetPasswordForm/ResetPasswordForm.tsx @@ -1,4 +1,4 @@ -import { PasswordRepeatElement, TextFieldElement } from '@graphcommerce/ecommerce-ui' +import { EmailElement, PasswordRepeatElement, TextFieldElement } from '@graphcommerce/ecommerce-ui' import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui' import { useFormGqlMutation } from '@graphcommerce/react-hook-form' import { Trans } from '@lingui/react' @@ -44,12 +44,10 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) { return (
- } required disabled={formState.isSubmitting} /> diff --git a/packages/magento-customer/components/SignUpForm/SignUpForm.tsx b/packages/magento-customer/components/SignUpForm/SignUpForm.tsx index 867d200417..0aae6c28df 100644 --- a/packages/magento-customer/components/SignUpForm/SignUpForm.tsx +++ b/packages/magento-customer/components/SignUpForm/SignUpForm.tsx @@ -1,5 +1,7 @@ import { PasswordRepeatElement, SwitchElement } from '@graphcommerce/ecommerce-ui' +import { useQuery } from '@graphcommerce/graphql' import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql' +import { StoreConfigDocument } from '@graphcommerce/magento-store' import { Button, FormActions, FormRow } from '@graphcommerce/next-ui' import { FormPersist, useFormGqlMutation } from '@graphcommerce/react-hook-form' import { Trans } from '@lingui/react' @@ -12,11 +14,10 @@ import { SignUpDocument, SignUpMutation, SignUpMutationVariables } from './SignU type SignUpFormProps = { email: string } -const requireEmailValidation = import.meta.graphCommerce.customerRequireEmailConfirmation ?? false - export function SignUpForm(props: SignUpFormProps) { const { email } = props + const storeConfig = useQuery(StoreConfigDocument) const signIn = useSignInForm({ email }) const form = useFormGqlMutation< SignUpMutation, @@ -28,7 +29,7 @@ export function SignUpForm(props: SignUpFormProps) { onBeforeSubmit: (values) => ({ ...values, email }), experimental_useV2: true, onComplete: async (result, variables) => { - if (!result.errors && !requireEmailValidation) { + if (!result.errors && !storeConfig.data?.storeConfig?.create_account_confirmation) { signIn.setValue('email', variables.email) signIn.setValue('password', variables.password) await signIn.handleSubmit(() => {})() @@ -43,10 +44,17 @@ export function SignUpForm(props: SignUpFormProps) { const submitHandler = handleSubmit(() => {}) - if (requireEmailValidation && form.formState.isSubmitSuccessful) { + if ( + storeConfig.data?.storeConfig?.create_account_confirmation && + !error && + form.formState.isSubmitSuccessful + ) { return ( - + ) } diff --git a/packages/magento-customer/components/SignUpForm/SignUpFormInline.tsx b/packages/magento-customer/components/SignUpForm/SignUpFormInline.tsx index 5508c0ea50..37b7ea6443 100644 --- a/packages/magento-customer/components/SignUpForm/SignUpFormInline.tsx +++ b/packages/magento-customer/components/SignUpForm/SignUpFormInline.tsx @@ -1,5 +1,7 @@ import { ApolloErrorAlert, PasswordRepeatElement } from '@graphcommerce/ecommerce-ui' +import { useQuery } from '@graphcommerce/graphql' import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql' +import { StoreConfigDocument } from '@graphcommerce/magento-store' import { Button, extendableComponent, Form, FormRow } from '@graphcommerce/next-ui' import { useFormGqlMutation } from '@graphcommerce/react-hook-form' import { Trans } from '@lingui/react' @@ -23,11 +25,10 @@ const { classes } = extendableComponent('SignUpFormInline', [ 'buttonContainer', ] as const) -const requireEmailValidation = import.meta.graphCommerce.customerRequireEmailConfirmation ?? false - export function SignUpFormInline(props: SignUpFormInlineProps) { const { email, children, firstname, lastname, onSubmitted } = props + const storeConfig = useQuery(StoreConfigDocument) const signIn = useSignInForm({ email }) const form = useFormGqlMutation< SignUpMutation, @@ -44,7 +45,7 @@ export function SignUpFormInline(props: SignUpFormInlineProps) { }, onBeforeSubmit: (values) => ({ ...values, email }), onComplete: async (result, variables) => { - if (!result.errors && !requireEmailValidation) { + if (!result.errors && !storeConfig.data?.storeConfig?.create_account_confirmation) { signIn.setValue('email', variables.email) signIn.setValue('password', variables.password) await signIn.handleSubmit(() => {})() @@ -59,10 +60,17 @@ export function SignUpFormInline(props: SignUpFormInlineProps) { const [remainingError, inputError] = graphqlErrorByCategory({ category: 'graphql-input', error }) const submitHandler = handleSubmit(() => {}) - if (requireEmailValidation && form.formState.isSubmitSuccessful) { + if ( + storeConfig.data?.storeConfig?.create_account_confirmation && + !error && + form.formState.isSubmitSuccessful + ) { return ( - + ) } diff --git a/packages/magento-customer/components/index.ts b/packages/magento-customer/components/index.ts index 25dea50561..9fb3152f62 100644 --- a/packages/magento-customer/components/index.ts +++ b/packages/magento-customer/components/index.ts @@ -42,3 +42,4 @@ export * from './SignUpForm/SignUpFormInline' export * from './UpdateCustomerEmailForm/UpdateCustomerEmailForm' export * from './UpdateDefaultAddressForm/UpdateDefaultAddressForm' export * from './WaitForCustomer/WaitForCustomer' +export * from './ConfirmCustomer/ConfirmCustomerForm' diff --git a/packages/magento-customer/test/authentication.playwright.ts b/packages/magento-customer/test/authentication.playwright.ts index 1f31c7583d..8a36fce2fa 100644 --- a/packages/magento-customer/test/authentication.playwright.ts +++ b/packages/magento-customer/test/authentication.playwright.ts @@ -59,7 +59,9 @@ test.describe('Authentication flow', () => { test.expect(await element.innerText()).toBeDefined() } else { test.expect((result.data as SignUpMutation).generateCustomerToken).toBeUndefined() - const element = page.locator('text=Please check your inbox to validate your email') + const element = page.locator( + 'text=Registration successful. Please check your inbox to confirm your email address', + ) test.expect(await element.innerText()).toBeDefined() } }) diff --git a/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls b/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls index 73b0863514..5f7702bee5 100644 --- a/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls +++ b/packages/magento-graphql/schema-246/CartAddressInput-vat_id.graphqls @@ -1,15 +1,15 @@ input CartAddressInput { - vat_id: String + vat_id: String @deprecated(reason: "Magento >= 2.4.6") } -interface CartAddressInteface { - vat_id: String +interface CartAddressInterface { + vat_id: String @deprecated(reason: "Magento >= 2.4.6") } type ShippingCartAddress implements CartAddressInterface { - vat_id: String + vat_id: String @deprecated(reason: "Magento >= 2.4.6") } type BillingCartAddress { - vat_id: String + vat_id: String @deprecated(reason: "Magento >= 2.4.6") } diff --git a/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls b/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls index 2484ec2a63..7553ef4574 100644 --- a/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls +++ b/packages/magento-graphql/schema-246/Mutation-deleteCustomer.graphqls @@ -2,5 +2,5 @@ type Mutation { """ Delete customer account """ - deleteCustomer: Boolean + deleteCustomer: Boolean @deprecated(reason: "Magento >= 2.4.6") } diff --git a/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls b/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls index 258c304fc5..2ed790d265 100644 --- a/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls +++ b/packages/magento-graphql/schema-246/OrderItem-gift_message.graphqls @@ -2,26 +2,26 @@ interface OrderItemInterface { """ The selected gift message for the order item """ - gift_message: GiftMessage + gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6") } type OrderItem { """ The selected gift message for the order item """ - gift_message: GiftMessage + gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6") } type BundleOrderItem { """ The selected gift message for the order item """ - gift_message: GiftMessage + gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6") } type DownloadableOrderItem { """ The selected gift message for the order item """ - gift_message: GiftMessage + gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6") } diff --git a/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls b/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls index 2a8af72192..5eb445afb0 100644 --- a/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls +++ b/packages/magento-graphql/schema-246/SelectedShippingMethod.graphqls @@ -1,4 +1,4 @@ type SelectedShippingMethod { - price_excl_tax: Money - price_incl_tax: Money + price_excl_tax: Money @deprecated(reason: "Magento >= 2.4.6") + price_incl_tax: Money @deprecated(reason: "Magento >= 2.4.6") } diff --git a/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls b/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls index 378e5cb049..eb2b6d4763 100644 --- a/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls +++ b/packages/magento-graphql/schema-247/Cart-itemsV2.graphqls @@ -68,4 +68,5 @@ input QuoteItemsSortInput { type Cart { itemsV2(pageSize: Int = 20, currentPage: Int = 1, sort: QuoteItemsSortInput): CartItems + @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/CartAddress.graphqls b/packages/magento-graphql/schema-247/CartAddress.graphqls index e45e0f0881..bdac78efc0 100644 --- a/packages/magento-graphql/schema-247/CartAddress.graphqls +++ b/packages/magento-graphql/schema-247/CartAddress.graphqls @@ -2,55 +2,55 @@ input CartAddressInput { """ The customer's fax number. """ - fax: String + fax: String @deprecated(reason: "Magento >= 2.4.7") """ The middle name of the person associated with the billing/shipping address. """ - middlename: String + middlename: String @deprecated(reason: "Magento >= 2.4.7") """ An honorific, such as Dr., Mr., or Mrs. """ - prefix: String + prefix: String @deprecated(reason: "Magento >= 2.4.7") """ A value such as Sr., Jr., or III. """ - suffix: String + suffix: String @deprecated(reason: "Magento >= 2.4.7") } type BillingCartAdress { """ The customer's fax number. """ - fax: String + fax: String @deprecated(reason: "Magento >= 2.4.7") """ The middle name of the person associated with the billing/shipping address. """ - middlename: String + middlename: String @deprecated(reason: "Magento >= 2.4.7") """ An honorific, such as Dr., Mr., or Mrs. """ - prefix: String + prefix: String @deprecated(reason: "Magento >= 2.4.7") """ A value such as Sr., Jr., or III. """ - suffix: String + suffix: String @deprecated(reason: "Magento >= 2.4.7") } type ShippingCartAddress { """ The customer's fax number. """ - fax: String + fax: String @deprecated(reason: "Magento >= 2.4.7") """ The middle name of the person associated with the billing/shipping address. """ - middlename: String + middlename: String @deprecated(reason: "Magento >= 2.4.7") """ An honorific, such as Dr., Mr., or Mrs. """ - prefix: String + prefix: String @deprecated(reason: "Magento >= 2.4.7") """ A value such as Sr., Jr., or III. """ - suffix: String + suffix: String @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls b/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls index c64e009195..781ff5c2f9 100644 --- a/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-cancelOrder.graphqls @@ -30,5 +30,5 @@ type Mutation { """ Cancel the specified customer order. """ - cancelOrder(input: CancelOrderInput!): CancelOrderOutput + cancelOrder(input: CancelOrderInput!): CancelOrderOutput @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls b/packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls index 83a9c20f57..abec7d4db8 100644 --- a/packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-confirmEmail.graphqls @@ -51,5 +51,5 @@ type Mutation @doc(description: "Jajaj") { An input object to identify the customer to confirm the email. """ input: ConfirmEmailInput! - ): CustomerOutput + ): CustomerOutput @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls b/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls index b3482327a6..5b584ab204 100644 --- a/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-contactUs.graphqls @@ -36,5 +36,5 @@ type Mutation { An input object that defines shopper information. """ input: ContactUsInput! - ): ContactUsOutput + ): ContactUsOutput @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls b/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls index f2d1ff4764..ea358efbce 100644 --- a/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-createGuestCart.graphqls @@ -17,4 +17,5 @@ type Mutation { Create a new shopping cart """ createGuestCart(input: CreateGuestCartInput): CreateGuestCartOutput + @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls b/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls index b25b85eab6..eac73734b7 100644 --- a/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-estimateShippingMethods.graphqls @@ -40,5 +40,5 @@ type Mutation { An input object that specifies details for estimation of available shipping methods """ input: EstimateTotalsInput! - ): [AvailableShippingMethod] + ): [AvailableShippingMethod] @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls b/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls index 72e402892b..380d2a275d 100644 --- a/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls +++ b/packages/magento-graphql/schema-247/Mutation-estimateTotals.graphqls @@ -17,5 +17,5 @@ type Mutation { An input object that specifies details for cart totals estimation """ input: EstimateTotalsInput! - ): EstimateTotalsOutput! + ): EstimateTotalsOutput! @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Mutation-placeOrder.graphqls b/packages/magento-graphql/schema-247/Mutation-placeOrder.graphqls new file mode 100644 index 0000000000..7997d99e13 --- /dev/null +++ b/packages/magento-graphql/schema-247/Mutation-placeOrder.graphqls @@ -0,0 +1,10 @@ +type PlaceOrderOutput { + """ + The ID of the order. + """ + order: Order + """ + Full order information. + """ + orderV2: CustomerOrder @deprecated(reason: "Magento >= 2.4.7") +} diff --git a/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls b/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls index 3df718fc0f..96cedf4ca9 100644 --- a/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls +++ b/packages/magento-graphql/schema-247/ProductAttributeFilterInput-category_url_path.graphqls @@ -1,3 +1,3 @@ input ProductAttributeFilterInput { - category_url_path: FilterEqualTypeInput + category_url_path: FilterEqualTypeInput @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Query-guestOrder.graphqls b/packages/magento-graphql/schema-247/Query-guestOrder.graphqls index cdadd24472..cf72f9fefe 100644 --- a/packages/magento-graphql/schema-247/Query-guestOrder.graphqls +++ b/packages/magento-graphql/schema-247/Query-guestOrder.graphqls @@ -27,5 +27,5 @@ type Query { """ Retrieve guest order details based on number, email and postcode. """ - guestOrder(input: OrderInformationInput!): CustomerOrder! + guestOrder(input: OrderInformationInput!): CustomerOrder! @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls b/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls index c284b56bd0..8c85743bcb 100644 --- a/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls +++ b/packages/magento-graphql/schema-247/Query-guestOrderByToken.graphqls @@ -26,5 +26,5 @@ type Query { """ Retrieve guest order details based on token. """ - guestOrderByToken(input: OrderTokenInput!): CustomerOrder! + guestOrderByToken(input: OrderTokenInput!): CustomerOrder! @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls b/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls index e3dad83ecc..1062c4adbb 100644 --- a/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls +++ b/packages/magento-graphql/schema-247/Query-recaptchaV3Config.graphqls @@ -35,5 +35,5 @@ type Query { """ Returns details about Google reCAPTCHA V3-Invisible configuration. """ - recaptchaV3Config: ReCaptchaConfigurationV3 + recaptchaV3Config: ReCaptchaConfigurationV3 @deprecated(reason: "Magento >= 2.4.7") } diff --git a/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx b/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx index acd7a0f754..f90b4f20b6 100644 --- a/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx +++ b/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx @@ -1,5 +1,6 @@ import { ApolloErrorSnackbar, + EmailElement, TextFieldElement, useFormGqlMutation, } from '@graphcommerce/ecommerce-ui' @@ -28,15 +29,12 @@ export function GuestNewsletter(props: GuestNewsletterProps) { onSubmit={submit} sx={[(theme) => ({ gap: theme.spacings.xs }), ...(Array.isArray(sx) ? sx : [sx])]} > - diff --git a/packages/magento-store/StoreConfigFragment.graphql b/packages/magento-store/StoreConfigFragment.graphql index a5bd2d9f58..4eed6ee935 100644 --- a/packages/magento-store/StoreConfigFragment.graphql +++ b/packages/magento-store/StoreConfigFragment.graphql @@ -30,4 +30,5 @@ fragment StoreConfigFragment on StoreConfig { grid_per_page grid_per_page_values list_per_page + create_account_confirmation } diff --git a/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap b/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap index aa9f607763..9ddd308c42 100644 --- a/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +++ b/packagesDev/next-config/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap @@ -2,7 +2,6 @@ exports[`parses an env config object 1`] = ` { - "GC_CUSTOMER_REQUIRE_EMAIL_CONFIRMATION": false, "GC_DEMO_MODE": true, "GC_STOREFRONT": [ { @@ -38,7 +37,6 @@ exports[`traverses a schema and returns a list of env variables that match 1`] = "GC_CONFIGURABLE_VARIANT_VALUES_URL", "GC_CROSS_SELLS_HIDE_CART_ITEMS", "GC_CROSS_SELLS_REDIRECT_ITEMS", - "GC_CUSTOMER_REQUIRE_EMAIL_CONFIRMATION", "GC_DATA_LAYER", "GC_DATA_LAYER_CORE_WEB_VITALS", "GC_DEBUG", diff --git a/packagesDev/next-config/__tests__/config/utils/configToImportMeta.ts b/packagesDev/next-config/__tests__/config/utils/configToImportMeta.ts index aab36b1f8c..6634af9757 100644 --- a/packagesDev/next-config/__tests__/config/utils/configToImportMeta.ts +++ b/packagesDev/next-config/__tests__/config/utils/configToImportMeta.ts @@ -2,7 +2,6 @@ import { configToImportMeta } from '../../../src/config/utils/configToImportMeta const configFile = { storefront: [{ locale: 'en', hygraphLocales: ['en'], magentoStoreCode: 'en_us' }], - customerRequireEmailConfirmation: false, demoMode: true, googleTagmanagerKey: 'GTM-XXXXXXX', productFiltersPro: false, @@ -18,7 +17,6 @@ it('flattens a config object', () => { expect(configToImportMeta(configFile)).toMatchInlineSnapshot(` { "import.meta.graphCommerce": "{ __debug: "'import.meta.graphCommerce' can not be destructured, please access deeper properties directly" }", - "import.meta.graphCommerce.customerRequireEmailConfirmation": "false", "import.meta.graphCommerce.deeper": "{ __debug: "'import.meta.graphCommerce.deeper' can not be destructured, please access deeper properties directly" }", "import.meta.graphCommerce.deeper.arrayvalue": "["test"]", "import.meta.graphCommerce.deeper.nested": "{ __debug: "'import.meta.graphCommerce.deeper.nested' can not be destructured, please access deeper properties directly" }", @@ -35,7 +33,6 @@ it('creates keys but does not stringify values', () => { expect(configToImportMeta(configFile, 'graphCommerce', false)).toMatchInlineSnapshot(` { "graphCommerce": { - "customerRequireEmailConfirmation": false, "deeper": { "arrayvalue": [ "test", @@ -57,7 +54,6 @@ it('creates keys but does not stringify values', () => { }, ], }, - "graphCommerce.customerRequireEmailConfirmation": false, "graphCommerce.deeper": { "arrayvalue": [ "test", diff --git a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts index 0e3ffb9ff2..49e065f7fd 100644 --- a/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts +++ b/packagesDev/next-config/__tests__/config/utils/mergeEnvIntoConfig.ts @@ -8,7 +8,6 @@ import { removeColor } from './rewriteLegancyEnv' const env = { GC_ADVANCED_FILTERS: '0', - GC_CUSTOMER_REQUIRE_EMAIL_CONFIRMATION: 'false', GC_DEMO_MODE: '1', GC_SINGLE_PRODUCT_ROUTE: '1', GC_STOREFRONT_0_LOCALE: 'en', diff --git a/packagesDev/next-config/__tests__/config/utils/rewriteLegancyEnv.ts b/packagesDev/next-config/__tests__/config/utils/rewriteLegancyEnv.ts index cc13bc8d78..e987b4edc3 100644 --- a/packagesDev/next-config/__tests__/config/utils/rewriteLegancyEnv.ts +++ b/packagesDev/next-config/__tests__/config/utils/rewriteLegancyEnv.ts @@ -17,13 +17,13 @@ export const removeColor = (str: string) => it('rewrites legacy env', () => { const configFile: GraphCommerceConfig = { storefront: [{ locale: 'en', hygraphLocales: ['en'], magentoStoreCode: 'en_us' }], - customerRequireEmailConfirmation: false, productFiltersPro: false, canonicalBaseUrl: 'https://example.com', hygraphEndpoint: 'https://example.com', magentoEndpoint: 'https://example.com', previewSecret: 'secret', robotsAllow: true, + magentoVersion: 246, } const legacyEnv = { diff --git a/packagesDev/next-config/dist/generated/config.js b/packagesDev/next-config/dist/generated/config.js index a93dc6eb8c..dc1ffb4a18 100644 --- a/packagesDev/next-config/dist/generated/config.js +++ b/packagesDev/next-config/dist/generated/config.js @@ -77,7 +77,6 @@ function GraphCommerceConfigSchema() { configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(), crossSellsHideCartItems: _zod.z.boolean().default(false).nullish(), crossSellsRedirectItems: _zod.z.boolean().default(false).nullish(), - customerRequireEmailConfirmation: _zod.z.boolean().nullish(), dataLayer: DatalayerConfigSchema().nullish(), debug: GraphCommerceDebugConfigSchema().nullish(), demoMode: _zod.z.boolean().default(true).nullish(), diff --git a/packagesDev/next-config/src/generated/config.ts b/packagesDev/next-config/src/generated/config.ts index bee42053ad..b027de7b3e 100644 --- a/packagesDev/next-config/src/generated/config.ts +++ b/packagesDev/next-config/src/generated/config.ts @@ -159,14 +159,6 @@ export type GraphCommerceConfig = { * Default: 'false' */ crossSellsRedirectItems?: InputMaybe; - /** - * Due to a limitation in the GraphQL API of Magento 2, we need to know if the - * customer requires email confirmation. - * - * This value should match Magento 2's configuration value for - * `customer/create_account/confirm` and should be removed once we can query - */ - customerRequireEmailConfirmation?: InputMaybe; dataLayer?: InputMaybe; /** Debug configuration for GraphCommerce */ debug?: InputMaybe; @@ -473,7 +465,6 @@ export function GraphCommerceConfigSchema(): z.ZodObject