@graphcommerce/magento-customer 4.1.3 → 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +252 -461
- package/components/AccountAddress/{index.tsx → AccountAddress.tsx} +4 -4
- package/components/AccountAddresses/{index.tsx → AccountAddresses.tsx} +2 -2
- package/components/AddressFields/{index.tsx → AddressFields.tsx} +3 -1
- package/components/AddressMultiLine/{index.tsx → AddressMultiLine.tsx} +1 -1
- package/components/AddressSingleLine/{index.tsx → AddressSingleLine.tsx} +1 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +1 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorFullPage.tsx +1 -1
- package/components/ChangeNameForm/{index.tsx → ChangeNameForm.tsx} +3 -3
- package/components/ChangePasswordForm/ChangePasswordForm.tsx +2 -2
- package/components/CreateCustomerAddressForm/{index.tsx → CreateCustomerAddressForm.tsx} +4 -4
- package/components/CustomerFab/{index.tsx → CustomerFab.tsx} +1 -1
- package/components/CustomerMenuFabItem/{index.tsx → CustomerMenuFabItem.tsx} +5 -10
- package/components/DeleteCustomerAddressForm/{index.tsx → DeleteCustomerAddressForm.tsx} +1 -1
- package/components/EditAddressForm/{index.tsx → EditAddressForm.tsx} +4 -4
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +3 -3
- package/components/NameFields/{index.tsx → NameFields.tsx} +2 -1
- package/components/ResetPasswordForm/{index.tsx → ResetPasswordForm.tsx} +2 -3
- package/components/SignInForm/SignInForm.tsx +2 -2
- package/components/SignInForm/SignInFormInline.tsx +1 -1
- package/components/SignOutForm/{index.tsx → SignOutForm.tsx} +2 -2
- package/components/SignUpForm/SignUpForm.tsx +3 -3
- package/components/SignUpForm/SignUpFormInline.tsx +1 -1
- package/components/UpdateCustomerEmailForm/{index.tsx → UpdateCustomerEmailForm.tsx} +2 -2
- package/components/UpdateDefaultAddressForm/{index.tsx → UpdateDefaultAddressForm.tsx} +3 -3
- package/components/index.ts +24 -24
- package/hooks/index.ts +3 -4
- package/hooks/useFormIsEmailAvailable.tsx +2 -2
- package/package.json +11 -11
- package/typePolicies.ts +1 -2
|
@@ -2,9 +2,9 @@ import { extendableComponent } from '@graphcommerce/next-ui'
|
|
|
2
2
|
import { Trans } from '@lingui/macro'
|
|
3
3
|
import { Box, Link, SxProps, Theme } from '@mui/material'
|
|
4
4
|
import PageLink from 'next/link'
|
|
5
|
-
import AddressMultiLine from '../AddressMultiLine'
|
|
6
|
-
import DeleteCustomerAddressForm from '../DeleteCustomerAddressForm'
|
|
7
|
-
import UpdateDefaultAddressForm from '../UpdateDefaultAddressForm'
|
|
5
|
+
import { AddressMultiLine } from '../AddressMultiLine/AddressMultiLine'
|
|
6
|
+
import { DeleteCustomerAddressForm } from '../DeleteCustomerAddressForm/DeleteCustomerAddressForm'
|
|
7
|
+
import { UpdateDefaultAddressForm } from '../UpdateDefaultAddressForm/UpdateDefaultAddressForm'
|
|
8
8
|
import { AccountAddressFragment } from './AccountAddress.gql'
|
|
9
9
|
|
|
10
10
|
export type AccountAddressProps = AccountAddressFragment & { sx?: SxProps<Theme> }
|
|
@@ -13,7 +13,7 @@ const name = 'AccountAddress'
|
|
|
13
13
|
const parts = ['root', 'address', 'switches', 'actions'] as const
|
|
14
14
|
const { classes } = extendableComponent(name, parts)
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export function AccountAddress(props: AccountAddressProps) {
|
|
17
17
|
const { id, sx = [], ...addressProps } = props
|
|
18
18
|
|
|
19
19
|
return (
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { Trans } from '@lingui/macro'
|
|
9
9
|
import { Skeleton, Button, Box, Theme, SxProps } from '@mui/material'
|
|
10
10
|
import Link from 'next/link'
|
|
11
|
-
import AccountAddress from '../AccountAddress'
|
|
11
|
+
import { AccountAddress } from '../AccountAddress/AccountAddress'
|
|
12
12
|
import { AccountAddressesFragment } from './AccountAddresses.gql'
|
|
13
13
|
|
|
14
14
|
export type AccountAddressesProps = AccountAddressesFragment & {
|
|
@@ -20,7 +20,7 @@ const name = 'AccountAddresses' as const
|
|
|
20
20
|
const parts = ['root', 'addresses', 'button', 'link'] as const
|
|
21
21
|
const { classes } = extendableComponent(name, parts)
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export function AccountAddresses(props: AccountAddressesProps) {
|
|
24
24
|
const { addresses, loading, sx = [] } = props
|
|
25
25
|
|
|
26
26
|
if (loading) {
|
|
@@ -20,9 +20,10 @@ type AddressFieldValues = {
|
|
|
20
20
|
city?: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
24
|
type AddressFieldsProps = { form: UseFormReturn<any>; readOnly?: boolean }
|
|
24
25
|
|
|
25
|
-
export
|
|
26
|
+
export function AddressFields(props: AddressFieldsProps) {
|
|
26
27
|
const { form, readOnly } = props
|
|
27
28
|
const countries = useQuery(CountryRegionsDocument).data?.countries
|
|
28
29
|
assertFormGqlOperation<AddressFieldValues>(form)
|
|
@@ -143,6 +144,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
143
144
|
endAdornment: <InputCheckmark show={valid.countryCode} select />,
|
|
144
145
|
}}
|
|
145
146
|
>
|
|
147
|
+
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
|
|
146
148
|
<option value='' />
|
|
147
149
|
{countryList.map((c) => {
|
|
148
150
|
if (!c?.two_letter_abbreviation) return null
|
|
@@ -18,7 +18,7 @@ const name = 'AddressMultiLine'
|
|
|
18
18
|
const parts = ['root', 'title'] as const
|
|
19
19
|
const { classes } = extendableComponent(name, parts)
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export function AddressMultiLine(props: AddressMultiLineProps) {
|
|
22
22
|
const {
|
|
23
23
|
company,
|
|
24
24
|
prefix,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFindCountry } from '@graphcommerce/magento-store'
|
|
2
2
|
import { CustomerAddressFragment } from '../CreateCustomerAddressForm/CustomerAddress.gql'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function AddressSingleLine(props: CustomerAddressFragment) {
|
|
5
5
|
const {
|
|
6
6
|
company,
|
|
7
7
|
prefix,
|
|
@@ -6,7 +6,7 @@ import { useExtractCustomerErrors } from '../../hooks/useExtractCustomerErrors'
|
|
|
6
6
|
|
|
7
7
|
type MagentoErrorAlertProps = ApolloErrorAlertProps
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export function ApolloCustomerErrorAlert(props: MagentoErrorAlertProps) {
|
|
10
10
|
const { error, unauthorized } = useExtractCustomerErrors(props)
|
|
11
11
|
|
|
12
12
|
const action = unauthorized && (
|
|
@@ -10,7 +10,7 @@ type ApolloCustomerErrorFullPageProps = {
|
|
|
10
10
|
signUpHref: string
|
|
11
11
|
} & ApolloErrorAlertProps
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFullPageProps) {
|
|
14
14
|
const { signInHref, signUpHref } = props
|
|
15
15
|
const { error, unauthorized } = useExtractCustomerErrors(props)
|
|
16
16
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Form, FormActions, FormDivider, MessageSnackbar, Button } from '@graphcommerce/next-ui'
|
|
2
2
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
3
3
|
import { Trans } from '@lingui/macro'
|
|
4
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
5
|
-
import NameFields from '../NameFields'
|
|
4
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
5
|
+
import { NameFields } from '../NameFields/NameFields'
|
|
6
6
|
import { UpdateCustomerNameDocument } from './UpdateCustomerName.gql'
|
|
7
7
|
|
|
8
8
|
type ChangeNameFormProps = {
|
|
@@ -11,7 +11,7 @@ type ChangeNameFormProps = {
|
|
|
11
11
|
lastname: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export function ChangeNameForm(props: ChangeNameFormProps) {
|
|
15
15
|
const { prefix, firstname, lastname } = props
|
|
16
16
|
const form = useFormGqlMutation(
|
|
17
17
|
UpdateCustomerNameDocument,
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
10
10
|
import { Trans, t } from '@lingui/macro'
|
|
11
11
|
import { TextField } from '@mui/material'
|
|
12
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
12
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
13
13
|
import {
|
|
14
14
|
ChangePasswordDocument,
|
|
15
15
|
ChangePasswordMutation,
|
|
16
16
|
ChangePasswordMutationVariables,
|
|
17
17
|
} from './ChangePassword.gql'
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export function ChangePasswordForm() {
|
|
20
20
|
const form = useFormGqlMutation<
|
|
21
21
|
ChangePasswordMutation,
|
|
22
22
|
ChangePasswordMutationVariables & { confirmPassword?: string }
|
|
@@ -12,12 +12,12 @@ import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form
|
|
|
12
12
|
import { Trans, t } from '@lingui/macro'
|
|
13
13
|
import { TextField } from '@mui/material'
|
|
14
14
|
import { useRouter } from 'next/router'
|
|
15
|
-
import AddressFields from '../AddressFields'
|
|
16
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
17
|
-
import NameFields from '../NameFields'
|
|
15
|
+
import { AddressFields } from '../AddressFields/AddressFields'
|
|
16
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
17
|
+
import { NameFields } from '../NameFields/NameFields'
|
|
18
18
|
import { CreateCustomerAddressDocument } from './CreateCustomerAddress.gql'
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export function CreateCustomerAddressForm() {
|
|
21
21
|
const countries = useQuery(CountryRegionsDocument).data?.countries
|
|
22
22
|
const router = useRouter()
|
|
23
23
|
|
|
@@ -51,7 +51,7 @@ function CustomerFabContent(props: CustomerFabContentProps) {
|
|
|
51
51
|
)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export
|
|
54
|
+
export function CustomerFab(props: CustomerFabContentProps) {
|
|
55
55
|
const { data } = useQuery(CustomerTokenDocument)
|
|
56
56
|
|
|
57
57
|
return (
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
DesktopHeaderBadge,
|
|
5
|
-
iconPerson,
|
|
6
|
-
IconSvg,
|
|
7
|
-
} from '@graphcommerce/next-ui'
|
|
8
|
-
import { NoSsr, SxProps, Theme } from '@mui/material'
|
|
2
|
+
import { MenuFabSecondaryItem, iconPerson, IconSvg } from '@graphcommerce/next-ui'
|
|
3
|
+
import { Badge, NoSsr, SxProps, Theme } from '@mui/material'
|
|
9
4
|
import React from 'react'
|
|
10
5
|
import { CustomerTokenDocument, CustomerTokenQuery } from '../../hooks'
|
|
11
6
|
|
|
@@ -25,14 +20,14 @@ function CustomerMenuFabItemContent(props: CustomerMenuFabItemProps) {
|
|
|
25
20
|
<MenuFabSecondaryItem
|
|
26
21
|
sx={sx}
|
|
27
22
|
icon={
|
|
28
|
-
<
|
|
23
|
+
<Badge
|
|
29
24
|
badgeContent={customerToken?.token ? 1 : 0}
|
|
30
25
|
color={customerToken?.valid ? 'primary' : 'error'}
|
|
31
26
|
variant='dot'
|
|
32
27
|
overlap='circular'
|
|
33
28
|
>
|
|
34
29
|
{icon ?? <IconSvg src={iconPerson} size='medium' />}
|
|
35
|
-
</
|
|
30
|
+
</Badge>
|
|
36
31
|
}
|
|
37
32
|
href={requireAuth ? guestHref : authHref}
|
|
38
33
|
>
|
|
@@ -41,7 +36,7 @@ function CustomerMenuFabItemContent(props: CustomerMenuFabItemProps) {
|
|
|
41
36
|
)
|
|
42
37
|
}
|
|
43
38
|
|
|
44
|
-
export
|
|
39
|
+
export function CustomerMenuFabItem(props: CustomerMenuFabItemProps) {
|
|
45
40
|
const { data } = useQuery(CustomerTokenDocument)
|
|
46
41
|
|
|
47
42
|
return (
|
|
@@ -8,7 +8,7 @@ export type DeleteCustomerAddressFormProps = {
|
|
|
8
8
|
addressId?: number
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export function DeleteCustomerAddressForm(props: DeleteCustomerAddressFormProps) {
|
|
12
12
|
const { addressId } = props
|
|
13
13
|
const { handleSubmit, error } = useFormGqlMutation(
|
|
14
14
|
DeleteCustomerAddressFormDocument,
|
|
@@ -13,14 +13,14 @@ import { t, Trans } from '@lingui/macro'
|
|
|
13
13
|
import { SxProps, TextField, Theme } from '@mui/material'
|
|
14
14
|
import { useRouter } from 'next/router'
|
|
15
15
|
import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
16
|
-
import AddressFields from '../AddressFields'
|
|
17
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
18
|
-
import NameFields from '../NameFields'
|
|
16
|
+
import { AddressFields } from '../AddressFields/AddressFields'
|
|
17
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
18
|
+
import { NameFields } from '../NameFields/NameFields'
|
|
19
19
|
import { UpdateCustomerAddressDocument } from './UpdateCustomerAddress.gql'
|
|
20
20
|
|
|
21
21
|
type EditAddressFormProps = { address?: AccountAddressFragment; sx?: SxProps<Theme> }
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export function EditAddressForm(props: EditAddressFormProps) {
|
|
24
24
|
const countries = useQuery(CountryRegionsDocument).data?.countries
|
|
25
25
|
const { address, sx } = props
|
|
26
26
|
const router = useRouter()
|
|
@@ -2,14 +2,14 @@ import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
|
2
2
|
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
3
3
|
import { t, Trans } from '@lingui/macro'
|
|
4
4
|
import { TextField, Alert, SxProps, Theme } from '@mui/material'
|
|
5
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
5
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
6
6
|
import {
|
|
7
7
|
ForgotPasswordDocument,
|
|
8
8
|
ForgotPasswordMutation,
|
|
9
9
|
ForgotPasswordMutationVariables,
|
|
10
10
|
} from './ForgotPassword.gql'
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
|
|
13
13
|
const { sx = [] } = props
|
|
14
14
|
const form = useFormGqlMutation<ForgotPasswordMutation, ForgotPasswordMutationVariables>(
|
|
15
15
|
ForgotPasswordDocument,
|
|
@@ -27,7 +27,7 @@ export default function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
|
|
|
27
27
|
marginBottom: theme.spacings.sm,
|
|
28
28
|
})}
|
|
29
29
|
>
|
|
30
|
-
<Trans>We
|
|
30
|
+
<Trans>We’ve send a password reset link to your email address!</Trans>
|
|
31
31
|
</Alert>
|
|
32
32
|
)
|
|
33
33
|
}
|
|
@@ -11,13 +11,14 @@ type NameFieldValues = {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
type NameFieldProps = {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
15
|
form: UseFormReturn<any>
|
|
15
16
|
readOnly?: boolean
|
|
16
17
|
prefix?: boolean
|
|
17
18
|
prefixes?: string[]
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
+
export function NameFields(props: NameFieldProps) {
|
|
21
22
|
const { prefix, form, readOnly, prefixes = [t`Mr`, t`Mrs`, t`Other`] } = props
|
|
22
23
|
assertFormGqlOperation<NameFieldValues>(form)
|
|
23
24
|
|
|
@@ -3,8 +3,7 @@ import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
|
3
3
|
import { Trans } from '@lingui/macro'
|
|
4
4
|
import { TextField } from '@mui/material'
|
|
5
5
|
import { useRouter } from 'next/router'
|
|
6
|
-
import
|
|
7
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
6
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
8
7
|
import {
|
|
9
8
|
ResetPasswordDocument,
|
|
10
9
|
ResetPasswordMutation,
|
|
@@ -15,7 +14,7 @@ type ResetPasswordFormProps = {
|
|
|
15
14
|
token: string
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
export
|
|
17
|
+
export function ResetPasswordForm(props: ResetPasswordFormProps) {
|
|
19
18
|
const { token } = props
|
|
20
19
|
|
|
21
20
|
const form = useFormGqlMutation<
|
|
@@ -4,12 +4,12 @@ import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
|
4
4
|
import { Trans } from '@lingui/macro'
|
|
5
5
|
import { Box, FormControl, Link, SxProps, TextField, Theme } from '@mui/material'
|
|
6
6
|
import PageLink from 'next/link'
|
|
7
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
8
8
|
import { SignInDocument } from './SignIn.gql'
|
|
9
9
|
|
|
10
10
|
type SignInFormProps = { email: string; sx?: SxProps<Theme> }
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export function SignInForm(props: SignInFormProps) {
|
|
13
13
|
const { email, sx } = props
|
|
14
14
|
const form = useFormGqlMutation(
|
|
15
15
|
SignInDocument,
|
|
@@ -10,7 +10,7 @@ type InlineSignInFormProps = Omit<SignInMutationVariables, 'password'> & { sx?:
|
|
|
10
10
|
|
|
11
11
|
const { classes } = extendableComponent('SignInFormInline', ['form', 'button'] as const)
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function SignInFormInline(props: PropsWithChildren<InlineSignInFormProps>) {
|
|
14
14
|
const { email, sx = [] } = props
|
|
15
15
|
const form = useFormGqlMutation(
|
|
16
16
|
SignInDocument,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FormState, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
2
2
|
import { useRouter } from 'next/router'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
4
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
5
5
|
import { SignOutFormDocument } from './SignOutForm.gql'
|
|
6
6
|
|
|
7
7
|
type SignOutFormProps = { button: (props: { formState: FormState<unknown> }) => React.ReactNode }
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export function SignOutForm(props: SignOutFormProps) {
|
|
10
10
|
const { button } = props
|
|
11
11
|
const router = useRouter()
|
|
12
12
|
const { handleSubmit, formState, error } = useFormGqlMutation(
|
|
@@ -3,15 +3,15 @@ import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
|
3
3
|
import { useFormGqlMutation, useFormPersist } from '@graphcommerce/react-hook-form'
|
|
4
4
|
import { t, Trans } from '@lingui/macro'
|
|
5
5
|
import { FormControlLabel, Switch, TextField } from '@mui/material'
|
|
6
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
-
import NameFields from '../NameFields'
|
|
6
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
+
import { NameFields } from '../NameFields/NameFields'
|
|
8
8
|
import { SignUpDocument, SignUpMutation, SignUpMutationVariables } from './SignUp.gql'
|
|
9
9
|
|
|
10
10
|
type SignUpFormProps = {
|
|
11
11
|
email?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export function SignUpForm(props: SignUpFormProps) {
|
|
15
15
|
const { email } = props
|
|
16
16
|
const form = useFormGqlMutation<
|
|
17
17
|
SignUpMutation,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
10
10
|
import { t, Trans } from '@lingui/macro'
|
|
11
11
|
import { TextField } from '@mui/material'
|
|
12
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
12
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
13
13
|
import {
|
|
14
14
|
UpdateCustomerEmailDocument,
|
|
15
15
|
UpdateCustomerEmailMutation,
|
|
@@ -20,7 +20,7 @@ type UpdateCustomerEmailFormProps = {
|
|
|
20
20
|
email: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
|
|
24
24
|
const { email } = props
|
|
25
25
|
|
|
26
26
|
const form = useFormGqlMutation<
|
|
@@ -4,14 +4,14 @@ import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/mate
|
|
|
4
4
|
import React, { useEffect, useMemo } from 'react'
|
|
5
5
|
import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
6
6
|
import { UpdateDefaultAddressDocument } from '../AccountAddresses/UpdateDefaultAddress.gql'
|
|
7
|
-
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type UpdateDefaultAddressFormProps = Pick<
|
|
10
10
|
AccountAddressFragment,
|
|
11
11
|
'id' | 'default_shipping' | 'default_billing'
|
|
12
12
|
>
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
|
|
15
15
|
const { id, default_shipping, default_billing } = props
|
|
16
16
|
const defaultValues = useMemo(
|
|
17
17
|
() => ({
|
package/components/index.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './AccountAddress/AccountAddress'
|
|
2
|
+
export * from './AccountAddresses/AccountAddresses'
|
|
3
|
+
export * from './AddressFields/AddressFields'
|
|
4
|
+
export * from './AddressMultiLine/AddressMultiLine'
|
|
5
|
+
export * from './AddressSingleLine/AddressSingleLine'
|
|
6
|
+
export * from './ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
+
export * from './ApolloCustomerError/ApolloCustomerErrorFullPage'
|
|
8
|
+
export * from './ChangeNameForm/ChangeNameForm'
|
|
5
9
|
export * from './ChangePasswordForm/ChangePassword.gql'
|
|
6
|
-
export
|
|
10
|
+
export * from './ChangePasswordForm/ChangePasswordForm'
|
|
11
|
+
export * from './CreateCustomerAddressForm/CreateCustomerAddressForm'
|
|
12
|
+
export * from './CustomerFab/CustomerFab'
|
|
13
|
+
export * from './CustomerMenuFabItem/CustomerMenuFabItem'
|
|
14
|
+
export * from './DeleteCustomerAddressForm/DeleteCustomerAddressForm'
|
|
15
|
+
export * from './EditAddressForm/EditAddressForm'
|
|
7
16
|
export * from './ForgotPasswordForm/ForgotPassword.gql'
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export { default as EditAddressForm } from './EditAddressForm'
|
|
12
|
-
export { default as AddressMultiLine } from './AddressMultiLine'
|
|
13
|
-
export { default as AddressSingleLine } from './AddressSingleLine'
|
|
14
|
-
export { default as ResetPasswordForm } from './ResetPasswordForm'
|
|
15
|
-
export { default as AddressFields } from './AddressFields'
|
|
16
|
-
export { default as NameFields } from './NameFields'
|
|
17
|
-
export { default as CustomerMenuFabItem } from './CustomerMenuFabItem'
|
|
18
|
-
export { default as ChangeNameForm } from './ChangeNameForm'
|
|
19
|
-
export { default as UpdateCustomerEmailForm } from './UpdateCustomerEmailForm'
|
|
20
|
-
export { default as ApolloCustomerErrorAlert } from './ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
21
|
-
export { default as ApolloCustomerErrorFullPage } from './ApolloCustomerError/ApolloCustomerErrorFullPage'
|
|
22
|
-
export { default as UpdateDefaultAddressForm } from './UpdateDefaultAddressForm'
|
|
23
|
-
export { default as SignInForm } from './SignInForm/SignInForm'
|
|
24
|
-
export { default as SignInFormInline } from './SignInForm/SignInFormInline'
|
|
25
|
-
export { default as SignUpForm } from './SignUpForm/SignUpForm'
|
|
26
|
-
export { default as SignUpFormInline } from './SignUpForm/SignUpFormInline'
|
|
17
|
+
export * from './ForgotPasswordForm/ForgotPasswordForm'
|
|
18
|
+
export * from './NameFields/NameFields'
|
|
19
|
+
export * from './ResetPasswordForm/ResetPasswordForm'
|
|
27
20
|
export * from './SignInForm/SignIn.gql'
|
|
21
|
+
export * from './SignInForm/SignInForm'
|
|
22
|
+
export * from './SignInForm/SignInFormInline'
|
|
23
|
+
export * from './SignOutForm/SignOutForm'
|
|
28
24
|
export * from './SignUpForm/SignUp.gql'
|
|
25
|
+
export * from './SignUpForm/SignUpForm'
|
|
26
|
+
export * from './SignUpForm/SignUpFormInline'
|
|
27
|
+
export * from './UpdateCustomerEmailForm/UpdateCustomerEmailForm'
|
|
28
|
+
export * from './UpdateDefaultAddressForm/UpdateDefaultAddressForm'
|
package/hooks/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { default as useFormIsEmailAvailable } from './useFormIsEmailAvailable'
|
|
2
|
-
export * from './useExtractCustomerErrors'
|
|
3
|
-
|
|
4
1
|
export * from './Customer.gql'
|
|
5
|
-
export * from './CustomerToken.gql'
|
|
6
2
|
export * from './CustomerInfo.gql'
|
|
3
|
+
export * from './CustomerToken.gql'
|
|
7
4
|
export * from './IsEmailAvailable.gql'
|
|
5
|
+
export * from './useExtractCustomerErrors'
|
|
6
|
+
export * from './useFormIsEmailAvailable'
|
|
@@ -5,12 +5,12 @@ import { CustomerDocument } from './Customer.gql'
|
|
|
5
5
|
import { CustomerTokenDocument } from './CustomerToken.gql'
|
|
6
6
|
import { IsEmailAvailableDocument } from './IsEmailAvailable.gql'
|
|
7
7
|
|
|
8
|
-
type
|
|
8
|
+
export type UseFormIsEmailAvailableProps = {
|
|
9
9
|
email?: string | null
|
|
10
10
|
onSubmitted?: (data: { email: string }) => void
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function useFormIsEmailAvailable(props: UseFormIsEmailAvailableProps) {
|
|
14
14
|
const { email, onSubmitted } = props
|
|
15
15
|
const { data: token } = useQuery(CustomerTokenDocument)
|
|
16
16
|
const customerQuery = useQuery(CustomerDocument, {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-customer",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "4.1.
|
|
5
|
+
"version": "4.1.6",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^4.
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.2",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.3",
|
|
17
17
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
18
|
-
"@playwright/test": "^1.19.
|
|
18
|
+
"@playwright/test": "^1.19.2"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@graphcommerce/ecommerce-ui": "^1.0.
|
|
22
|
-
"@graphcommerce/graphql": "^3.0.
|
|
23
|
-
"@graphcommerce/image": "^3.1.
|
|
24
|
-
"@graphcommerce/magento-graphql": "^3.0.
|
|
25
|
-
"@graphcommerce/magento-store": "^4.
|
|
26
|
-
"@graphcommerce/next-ui": "^4.
|
|
27
|
-
"@graphcommerce/react-hook-form": "^3.0.
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "^1.0.3",
|
|
22
|
+
"@graphcommerce/graphql": "^3.0.4",
|
|
23
|
+
"@graphcommerce/image": "^3.1.1",
|
|
24
|
+
"@graphcommerce/magento-graphql": "^3.0.4",
|
|
25
|
+
"@graphcommerce/magento-store": "^4.1.3",
|
|
26
|
+
"@graphcommerce/next-ui": "^4.4.0",
|
|
27
|
+
"@graphcommerce/react-hook-form": "^3.0.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@lingui/macro": "^3.13.2",
|
package/typePolicies.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FieldPolicy } from '@graphcommerce/graphql'
|
|
2
|
-
import { CustomerToken, MigrateCache, Mutation, TypedTypePolicies } from '@graphcommerce/graphql'
|
|
1
|
+
import { FieldPolicy , CustomerToken, MigrateCache, Mutation, TypedTypePolicies } from '@graphcommerce/graphql'
|
|
3
2
|
import { CustomerTokenDocument } from './hooks/CustomerToken.gql'
|
|
4
3
|
import { IsEmailAvailableDocument } from './hooks/IsEmailAvailable.gql'
|
|
5
4
|
|