@graphcommerce/magento-customer 9.1.0-canary.18 → 9.1.0-canary.20
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 +16 -0
- package/components/AccountAddresses/AccountAddresses.tsx +9 -4
- package/components/AccountDeleteForm/AccountDeleteForm.tsx +14 -4
- package/components/AccountLatestOrder/AccountLatestOrder.tsx +1 -2
- package/components/AccountOrders/AccountOrders.tsx +1 -1
- package/components/CancelOrder/CancelOrderForm.tsx +2 -2
- package/components/CancelOrder/CancelOrderFragment.graphql +5 -0
- package/components/ChangeNameForm/ChangeNameForm.tsx +1 -0
- package/components/ContactForm/ContactUsConfig.graphql +3 -0
- package/components/CreditMemo/CreditMemo.graphql +43 -0
- package/components/CreditMemo/CreditMemoCard.graphql +12 -0
- package/components/CreditMemo/CreditMemoCard.tsx +66 -0
- package/components/CreditMemo/CreditMemoDetails.tsx +94 -0
- package/components/CreditMemo/CreditMemoItem.graphql +26 -0
- package/components/CreditMemo/CreditMemoItem.tsx +125 -0
- package/components/CreditMemo/CreditMemoItems.tsx +78 -0
- package/components/CreditMemo/CreditMemoTotals.tsx +122 -0
- package/components/CreditMemo/index.ts +8 -0
- package/components/CustomerForms/CustomerAttributeField.tsx +112 -0
- package/components/CustomerForms/CustomerAttributeMetadata.graphql +9 -0
- package/components/CustomerForms/CustomerUpdateForm.tsx +65 -0
- package/components/CustomerForms/UseCustomerCreateForm.graphql +7 -0
- package/components/CustomerForms/UseCustomerUpdateForm.graphql +7 -0
- package/components/CustomerForms/customerAttributeFieldHelpers.ts +127 -0
- package/components/CustomerForms/index.ts +8 -0
- package/components/CustomerForms/nameFieldset.tsx +32 -0
- package/components/CustomerForms/useCustomerCreateForm.ts +83 -0
- package/components/CustomerForms/useCustomerUpdateForm.ts +122 -0
- package/components/GuestOrderOverview/GuestOrderOverviewForm.tsx +28 -11
- package/components/Invoice/Invoice.graphql +13 -0
- package/components/Invoice/InvoiceCard.graphql +9 -0
- package/components/Invoice/InvoiceCard.tsx +66 -0
- package/components/Invoice/InvoiceDetails.tsx +94 -0
- package/components/Invoice/InvoiceItem.graphql +25 -0
- package/components/Invoice/InvoiceItem.tsx +125 -0
- package/components/Invoice/InvoiceItems.tsx +72 -0
- package/components/Invoice/InvoiceTotal.graphql +29 -0
- package/components/Invoice/InvoiceTotals.tsx +110 -0
- package/components/Invoice/index.ts +9 -0
- package/components/NameFields/NameFields.tsx +33 -18
- package/components/Order/OrderAdditional/OrderAdditional.graphql +16 -0
- package/components/Order/OrderAdditional/OrderAdditional.tsx +51 -0
- package/components/Order/OrderCard/OrderCard.graphql +13 -0
- package/components/{OrderCard → Order/OrderCard}/OrderCard.tsx +22 -18
- package/components/{OrderCardItem → Order/OrderCard}/OrderCardItem.graphql +1 -0
- package/components/Order/OrderComments/OrderComments.graphql +5 -0
- package/components/Order/OrderComments/SalesCommentItem.graphql +4 -0
- package/components/Order/OrderComments/SalesComments.tsx +28 -0
- package/components/Order/OrderDetails/OrderAddress.graphql +17 -0
- package/components/Order/OrderDetails/OrderDetails.graphql +38 -0
- package/components/{OrderDetails → Order/OrderDetails}/OrderDetails.tsx +70 -57
- package/components/Order/OrderDetails/ShippingHandling.graphql +19 -0
- package/components/Order/OrderDetails/TaxItem.graphql +7 -0
- package/components/{OrderItem → Order/OrderItem}/OrderItem.graphql +13 -0
- package/components/Order/OrderItem/OrderItem.tsx +144 -0
- package/components/Order/OrderItems/OrderItems.tsx +81 -0
- package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabel.tsx +2 -2
- package/components/Order/OrderTotals/OrderTotal.graphql +32 -0
- package/components/Order/OrderTotals/OrderTotals.graphql +7 -0
- package/components/{OrderDetails → Order/OrderTotals}/OrderTotals.tsx +27 -12
- package/components/Order/index.ts +16 -0
- package/components/ReorderItems/ReorderItems.tsx +1 -1
- package/components/Shipment/Shipment.graphql +14 -0
- package/components/Shipment/ShipmentCard.graphql +8 -0
- package/components/Shipment/ShipmentCard.tsx +71 -0
- package/components/Shipment/ShipmentDetails.tsx +100 -0
- package/components/Shipment/ShipmentItem.graphql +19 -0
- package/components/Shipment/ShipmentItem.tsx +117 -0
- package/components/Shipment/ShipmentItems.tsx +72 -0
- package/components/Shipment/index.ts +7 -0
- package/components/SignUpForm/SignUpForm.tsx +51 -46
- package/components/WaitForCustomer/WaitForCustomer.tsx +12 -3
- package/components/index.ts +5 -8
- package/graphql/{AccountDashboardQueryFragment.graphql → fragments/AccountDashboardQueryFragment.graphql} +8 -3
- package/graphql/index.ts +10 -0
- package/graphql/queries/CreditMemoDetailPage.graphql +14 -0
- package/graphql/queries/InvoiceDetailPage.graphql +14 -0
- package/graphql/queries/OrderDetailPage.graphql +14 -0
- package/graphql/queries/ShipmentDetailPage.graphql +12 -0
- package/hooks/CustomerInfo.graphql +3 -3
- package/index.ts +1 -4
- package/package.json +14 -14
- package/utils/orderState.ts +1 -2
- package/components/OrderCard/OrderCard.graphql +0 -29
- package/components/OrderDetails/OrderDetails.graphql +0 -77
- package/components/OrderItem/OrderItem.tsx +0 -176
- package/components/OrderItems/OrderItems.tsx +0 -70
- package/graphql/OrderDetailPage.graphql +0 -10
- /package/components/{OrderItems → Order/OrderItems}/OrderItems.graphql +0 -0
- /package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabel.graphql +0 -0
- /package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabelInline.tsx +0 -0
- /package/graphql/{CustomerStoreConfig.graphql → inject/CustomerStoreConfig.graphql} +0 -0
- /package/graphql/{AccountDashboard.graphql → queries/AccountDashboard.graphql} +0 -0
- /package/graphql/{AccountDashboardAddresses.graphql → queries/AccountDashboardAddresses.graphql} +0 -0
- /package/graphql/{AccountDashboardCustomer.graphql → queries/AccountDashboardCustomer.graphql} +0 -0
- /package/graphql/{AccountDashboardOrders.graphql → queries/AccountDashboardOrders.graphql} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Image } from '@graphcommerce/image'
|
|
2
|
+
import { Money, PriceModifiersList, type PriceModifier } from '@graphcommerce/magento-store'
|
|
3
|
+
import { ActionCard, actionCardImageSizes, type ActionCardProps } from '@graphcommerce/next-ui'
|
|
4
|
+
import { Trans } from '@lingui/react'
|
|
5
|
+
import { Box } from '@mui/material'
|
|
6
|
+
import type { ShipmentItemFragment } from './ShipmentItem.gql'
|
|
7
|
+
|
|
8
|
+
export type ShipmentItemProps = Omit<ActionCardProps, 'value' | 'image' | 'title'> & {
|
|
9
|
+
item: ShipmentItemFragment
|
|
10
|
+
priceModifiers?: PriceModifier[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ShipmentItem(props: ShipmentItemProps) {
|
|
14
|
+
const { item, priceModifiers, size = 'responsive', ...rest } = props
|
|
15
|
+
const { product_name, product_sku, quantity_shipped, product_sale_price, id, order_item } = item
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ActionCard
|
|
19
|
+
{...rest}
|
|
20
|
+
value={id}
|
|
21
|
+
sx={(theme) => ({
|
|
22
|
+
'&.ActionCard-root': {
|
|
23
|
+
px: 0,
|
|
24
|
+
py: theme.spacings.xs,
|
|
25
|
+
},
|
|
26
|
+
'& .ActionCard-rootInner': {
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
alignItems: 'stretch',
|
|
29
|
+
},
|
|
30
|
+
'&.sizeSmall': {
|
|
31
|
+
px: 0,
|
|
32
|
+
},
|
|
33
|
+
'&.sizeResponsive': {
|
|
34
|
+
[theme.breakpoints.down('md')]: { px: 0 },
|
|
35
|
+
},
|
|
36
|
+
'& .ActionCard-end': {
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
},
|
|
39
|
+
'& .ActionCard-action': {
|
|
40
|
+
pr: 0,
|
|
41
|
+
},
|
|
42
|
+
'& .ActionCard-image': {
|
|
43
|
+
alignSelf: 'flex-start',
|
|
44
|
+
},
|
|
45
|
+
'& .ActionCard-secondaryAction': {
|
|
46
|
+
display: 'grid',
|
|
47
|
+
rowGap: theme.spacings.xs,
|
|
48
|
+
justifyItems: 'start',
|
|
49
|
+
},
|
|
50
|
+
'& .ActionCard-price': {
|
|
51
|
+
pr: 0,
|
|
52
|
+
mb: { xs: 0.5, sm: 0 },
|
|
53
|
+
},
|
|
54
|
+
})}
|
|
55
|
+
size={size}
|
|
56
|
+
image={
|
|
57
|
+
order_item?.product?.thumbnail?.url && (
|
|
58
|
+
<Image
|
|
59
|
+
layout='fill'
|
|
60
|
+
src={order_item.product.thumbnail.url}
|
|
61
|
+
alt={order_item.product.thumbnail?.label ?? ''}
|
|
62
|
+
sx={{
|
|
63
|
+
width: actionCardImageSizes[size],
|
|
64
|
+
height: actionCardImageSizes[size],
|
|
65
|
+
display: 'block',
|
|
66
|
+
borderRadius: 1,
|
|
67
|
+
objectFit: 'contain',
|
|
68
|
+
backgroundColor: 'background.image',
|
|
69
|
+
}}
|
|
70
|
+
sizes={actionCardImageSizes[size]}
|
|
71
|
+
/>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
title={product_name}
|
|
75
|
+
price={
|
|
76
|
+
<Money
|
|
77
|
+
currency={product_sale_price.currency}
|
|
78
|
+
value={(product_sale_price.value ?? 0) * (quantity_shipped ?? 1)}
|
|
79
|
+
/>
|
|
80
|
+
}
|
|
81
|
+
action={<> </>}
|
|
82
|
+
secondaryAction={
|
|
83
|
+
<>
|
|
84
|
+
<Box
|
|
85
|
+
sx={{
|
|
86
|
+
display: 'flex',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
color: 'text.secondary',
|
|
89
|
+
mt: 1,
|
|
90
|
+
gap: '10px',
|
|
91
|
+
justifyContent: 'start',
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{quantity_shipped}
|
|
95
|
+
{' ⨉ '}
|
|
96
|
+
<Money {...product_sale_price} />
|
|
97
|
+
</Box>
|
|
98
|
+
|
|
99
|
+
{rest.secondaryAction}
|
|
100
|
+
</>
|
|
101
|
+
}
|
|
102
|
+
details={
|
|
103
|
+
<>
|
|
104
|
+
{priceModifiers && priceModifiers.length > 0 && (
|
|
105
|
+
<PriceModifiersList
|
|
106
|
+
label={<Trans id='Base Price'>Base price</Trans>}
|
|
107
|
+
modifiers={[...priceModifiers]}
|
|
108
|
+
total={product_sale_price.value ?? 0}
|
|
109
|
+
currency={product_sale_price.currency}
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
{rest.details}
|
|
113
|
+
</>
|
|
114
|
+
}
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActionCardLayout,
|
|
3
|
+
breakpointVal,
|
|
4
|
+
extendableComponent,
|
|
5
|
+
nonNullable,
|
|
6
|
+
SectionContainer,
|
|
7
|
+
} from '@graphcommerce/next-ui'
|
|
8
|
+
import { Trans } from '@lingui/macro'
|
|
9
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
10
|
+
import { Box } from '@mui/material'
|
|
11
|
+
import type { ShipmentFragment } from './Shipment.gql'
|
|
12
|
+
import { ShipmentItem } from './ShipmentItem'
|
|
13
|
+
|
|
14
|
+
export type ShipmentItemsProps = {
|
|
15
|
+
shipment: ShipmentFragment
|
|
16
|
+
sx?: SxProps<Theme>
|
|
17
|
+
layout?: 'list' | 'grid'
|
|
18
|
+
size?: 'small' | 'medium' | 'large'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const componentName = 'ShipmentItems'
|
|
22
|
+
const parts = ['root', 'items', 'actionCard'] as const
|
|
23
|
+
const { classes } = extendableComponent(componentName, parts)
|
|
24
|
+
|
|
25
|
+
export function ShipmentItems(props: ShipmentItemsProps) {
|
|
26
|
+
const { shipment, sx = [], layout = 'list', size } = props
|
|
27
|
+
|
|
28
|
+
const items = (shipment.items ?? []).filter(nonNullable)
|
|
29
|
+
if (!items.length) return null
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Box
|
|
33
|
+
className={classes.root}
|
|
34
|
+
sx={[
|
|
35
|
+
(theme) => ({
|
|
36
|
+
my: theme.spacings.md,
|
|
37
|
+
padding: `${theme.spacings.sm} ${theme.spacings.sm}`,
|
|
38
|
+
border: `1px ${theme.palette.divider} solid`,
|
|
39
|
+
...breakpointVal(
|
|
40
|
+
'borderRadius',
|
|
41
|
+
theme.shape.borderRadius * 2,
|
|
42
|
+
theme.shape.borderRadius * 3,
|
|
43
|
+
theme.breakpoints.values,
|
|
44
|
+
),
|
|
45
|
+
}),
|
|
46
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
47
|
+
]}
|
|
48
|
+
>
|
|
49
|
+
<SectionContainer
|
|
50
|
+
sx={{ '& .SectionHeader-root': { mt: 0 } }}
|
|
51
|
+
labelLeft={<Trans>Shipped items</Trans>}
|
|
52
|
+
variantLeft='h6'
|
|
53
|
+
className={classes.items}
|
|
54
|
+
>
|
|
55
|
+
<ActionCardLayout
|
|
56
|
+
sx={(theme) => ({
|
|
57
|
+
marginBottom: theme.spacings.md,
|
|
58
|
+
'&.layoutStack': {
|
|
59
|
+
gap: 0,
|
|
60
|
+
},
|
|
61
|
+
})}
|
|
62
|
+
className={classes.actionCard}
|
|
63
|
+
layout={layout}
|
|
64
|
+
>
|
|
65
|
+
{items.map((item) => (
|
|
66
|
+
<ShipmentItem key={item.id} item={item} size={size} layout={layout} variant='default' />
|
|
67
|
+
))}
|
|
68
|
+
</ActionCardLayout>
|
|
69
|
+
</SectionContainer>
|
|
70
|
+
</Box>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { PasswordRepeatElement, SwitchElement } from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import { FormPersist, PasswordRepeatElement, SwitchElement } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { useQuery } from '@graphcommerce/graphql'
|
|
3
|
-
import {
|
|
4
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
3
|
+
import { AttributesFormAutoLayout, StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
5
4
|
import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
6
5
|
import type { UseFormClearErrors, UseFormSetError } from '@graphcommerce/react-hook-form'
|
|
7
|
-
import {
|
|
8
|
-
import { t } from '@lingui/macro'
|
|
9
|
-
import { Trans } from '@lingui/react'
|
|
6
|
+
import { t, Trans } from '@lingui/macro'
|
|
10
7
|
import { Alert } from '@mui/material'
|
|
11
8
|
import { useSignInForm } from '../../hooks/useSignInForm'
|
|
12
9
|
import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError/ApolloCustomerErrorSnackbar'
|
|
10
|
+
import { CustomerAttributeField } from '../CustomerForms/CustomerAttributeField'
|
|
11
|
+
import { nameFieldset } from '../CustomerForms/nameFieldset'
|
|
12
|
+
import { useCustomerCreateForm } from '../CustomerForms/useCustomerCreateForm'
|
|
13
13
|
import { NameFields } from '../NameFields/NameFields'
|
|
14
14
|
import { ValidatedPasswordElement } from '../ValidatedPasswordElement/ValidatedPasswordElement'
|
|
15
|
-
import type { SignUpMutation, SignUpMutationVariables } from './SignUp.gql'
|
|
16
|
-
import { SignUpDocument } from './SignUp.gql'
|
|
17
15
|
|
|
18
16
|
type SignUpFormProps = {
|
|
19
17
|
email?: string
|
|
@@ -21,17 +19,15 @@ type SignUpFormProps = {
|
|
|
21
19
|
clearErrors: UseFormClearErrors<{ email?: string; requestedMode?: 'signin' | 'signup' }>
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
type SignUpFormValues = SignUpMutationVariables & { confirmPassword?: string }
|
|
25
|
-
|
|
26
22
|
export function SignUpForm(props: SignUpFormProps) {
|
|
27
23
|
const { email, setError, clearErrors } = props
|
|
28
24
|
|
|
29
25
|
const storeConfig = useQuery(StoreConfigDocument)
|
|
26
|
+
|
|
30
27
|
const signIn = useSignInForm({ email })
|
|
31
|
-
const form =
|
|
32
|
-
|
|
28
|
+
const form = useCustomerCreateForm(
|
|
29
|
+
{ exclude: ['email'] },
|
|
33
30
|
{
|
|
34
|
-
defaultValues: { email },
|
|
35
31
|
onBeforeSubmit: (values) => {
|
|
36
32
|
if (!email) {
|
|
37
33
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -40,35 +36,37 @@ export function SignUpForm(props: SignUpFormProps) {
|
|
|
40
36
|
}
|
|
41
37
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
42
38
|
clearErrors()
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
values.input.email = email
|
|
41
|
+
return values
|
|
44
42
|
},
|
|
45
43
|
onComplete: async (result, variables) => {
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
if (
|
|
45
|
+
!result.errors &&
|
|
46
|
+
!storeConfig.data?.storeConfig?.create_account_confirmation &&
|
|
47
|
+
variables.input.password
|
|
48
|
+
) {
|
|
49
|
+
signIn.setValue('email', variables.input.email)
|
|
50
|
+
signIn.setValue('password', variables.input.password)
|
|
49
51
|
await signIn.handleSubmit(() => {})()
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
54
|
},
|
|
53
55
|
{ errorPolicy: 'all' },
|
|
54
56
|
)
|
|
55
|
-
|
|
56
|
-
const { handleSubmit, required, formState, error, control } = form
|
|
57
|
-
const [remainingError, inputError] = graphqlErrorByCategory({ category: 'graphql-input', error })
|
|
58
|
-
|
|
57
|
+
const { handleSubmit, formState, error, control, attributes } = form
|
|
59
58
|
const submitHandler = handleSubmit(() => {})
|
|
60
59
|
|
|
61
60
|
if (
|
|
62
61
|
storeConfig.data?.storeConfig?.create_account_confirmation &&
|
|
63
62
|
!error &&
|
|
64
|
-
|
|
63
|
+
formState.isSubmitSuccessful
|
|
65
64
|
) {
|
|
66
65
|
return (
|
|
67
66
|
<Alert>
|
|
68
|
-
<Trans
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/>
|
|
67
|
+
<Trans id='Registration successful. Please check your inbox to confirm your email address ({email})'>
|
|
68
|
+
Registration successful. Please check your inbox to confirm your email address ({email})
|
|
69
|
+
</Trans>
|
|
72
70
|
</Alert>
|
|
73
71
|
)
|
|
74
72
|
}
|
|
@@ -78,39 +76,50 @@ export function SignUpForm(props: SignUpFormProps) {
|
|
|
78
76
|
<FormRow>
|
|
79
77
|
<ValidatedPasswordElement
|
|
80
78
|
control={control}
|
|
81
|
-
name='password'
|
|
79
|
+
name='input.password'
|
|
82
80
|
variant='outlined'
|
|
83
|
-
|
|
84
|
-
label={<Trans id='Password' />}
|
|
81
|
+
label={<Trans id='Password'>Password</Trans>}
|
|
85
82
|
autoFocus={!!email}
|
|
86
83
|
autoComplete='new-password'
|
|
87
|
-
required
|
|
88
|
-
disabled={formState.isSubmitting}
|
|
89
|
-
helperText={inputError?.message}
|
|
84
|
+
required
|
|
90
85
|
/>
|
|
91
86
|
<PasswordRepeatElement
|
|
92
87
|
control={control}
|
|
93
88
|
name='confirmPassword'
|
|
94
|
-
passwordFieldName='password'
|
|
89
|
+
passwordFieldName='input.password'
|
|
95
90
|
variant='outlined'
|
|
96
|
-
|
|
97
|
-
label={<Trans id='Confirm password' />}
|
|
91
|
+
label={<Trans id='Confirm password'>Confirm password</Trans>}
|
|
98
92
|
autoComplete='new-password'
|
|
99
93
|
required
|
|
100
|
-
disabled={formState.isSubmitting}
|
|
101
94
|
/>
|
|
102
95
|
</FormRow>
|
|
103
96
|
|
|
104
|
-
<
|
|
97
|
+
{import.meta.graphCommerce.magentoVersion < 247 ? (
|
|
98
|
+
<NameFields
|
|
99
|
+
form={form}
|
|
100
|
+
names={{
|
|
101
|
+
firstname: 'input.firstname',
|
|
102
|
+
lastname: 'input.lastname',
|
|
103
|
+
prefix: 'input.prefix',
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
) : (
|
|
107
|
+
<AttributesFormAutoLayout
|
|
108
|
+
attributes={attributes}
|
|
109
|
+
control={control}
|
|
110
|
+
render={CustomerAttributeField}
|
|
111
|
+
fieldsets={[nameFieldset(attributes)]}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
105
114
|
|
|
106
115
|
<SwitchElement
|
|
107
116
|
control={control}
|
|
108
|
-
name='
|
|
117
|
+
name='input.is_subscribed'
|
|
109
118
|
disabled={formState.isSubmitting}
|
|
110
|
-
label={<Trans id='Subscribe to newsletter'
|
|
119
|
+
label={<Trans id='Subscribe to newsletter'>Subscribe to newsletter</Trans>}
|
|
111
120
|
/>
|
|
112
121
|
|
|
113
|
-
<ApolloCustomerErrorSnackbar error={
|
|
122
|
+
<ApolloCustomerErrorSnackbar error={error} />
|
|
114
123
|
|
|
115
124
|
<FormActions>
|
|
116
125
|
<Button
|
|
@@ -121,14 +130,10 @@ export function SignUpForm(props: SignUpFormProps) {
|
|
|
121
130
|
size='large'
|
|
122
131
|
loading={formState.isSubmitting}
|
|
123
132
|
>
|
|
124
|
-
<Trans id='Create Account'
|
|
133
|
+
<Trans id='Create Account'>Create Account</Trans>
|
|
125
134
|
</Button>
|
|
126
135
|
</FormActions>
|
|
127
|
-
<FormPersist
|
|
128
|
-
form={form}
|
|
129
|
-
name='SignUp'
|
|
130
|
-
exclude={['password', 'confirmPassword']}
|
|
131
|
-
/>
|
|
136
|
+
<FormPersist form={form} name='SignUp' exclude={['input.password', 'confirmPassword']} />
|
|
132
137
|
</form>
|
|
133
138
|
)
|
|
134
139
|
}
|
|
@@ -12,6 +12,7 @@ import { ApolloCustomerErrorFullPage } from '../ApolloCustomerError/ApolloCustom
|
|
|
12
12
|
export type WaitForCustomerProps = SetOptional<WaitForQueriesProps, 'waitFor'> &
|
|
13
13
|
SetOptional<FullPageMessageProps, 'title' | 'icon'> & {
|
|
14
14
|
unauthenticated?: React.ReactNode
|
|
15
|
+
allowError?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export function nonNullable<T>(value: T): value is NonNullable<T> {
|
|
@@ -41,7 +42,14 @@ export function nonNullable<T>(value: T): value is NonNullable<T> {
|
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
44
|
export function WaitForCustomer(props: WaitForCustomerProps) {
|
|
44
|
-
const {
|
|
45
|
+
const {
|
|
46
|
+
waitFor = [],
|
|
47
|
+
children,
|
|
48
|
+
fallback,
|
|
49
|
+
unauthenticated,
|
|
50
|
+
allowError: ignoreError,
|
|
51
|
+
...rest
|
|
52
|
+
} = props
|
|
45
53
|
|
|
46
54
|
const session = useCustomerSession()
|
|
47
55
|
const queries = Array.isArray(waitFor) ? waitFor : [waitFor]
|
|
@@ -49,6 +57,7 @@ export function WaitForCustomer(props: WaitForCustomerProps) {
|
|
|
49
57
|
queries.map((query) => (typeof query === 'boolean' ? null : query.error)).filter(nonNullable),
|
|
50
58
|
)
|
|
51
59
|
|
|
60
|
+
const hasError = error && !ignoreError
|
|
52
61
|
return (
|
|
53
62
|
<WaitForQueries
|
|
54
63
|
waitFor={!session.loggedIn ? session.query : queries}
|
|
@@ -81,8 +90,8 @@ export function WaitForCustomer(props: WaitForCustomerProps) {
|
|
|
81
90
|
{...rest}
|
|
82
91
|
/>
|
|
83
92
|
))}
|
|
84
|
-
{session.loggedIn &&
|
|
85
|
-
{session.loggedIn && !
|
|
93
|
+
{session.loggedIn && hasError && <ApolloCustomerErrorFullPage error={error} />}
|
|
94
|
+
{session.loggedIn && !hasError && children}
|
|
86
95
|
</WaitForQueries>
|
|
87
96
|
)
|
|
88
97
|
}
|
package/components/index.ts
CHANGED
|
@@ -19,25 +19,22 @@ export * from './CompanyFields'
|
|
|
19
19
|
export * from './ConfirmCustomer/ConfirmCustomerForm'
|
|
20
20
|
export * from './ContactForm/ContactForm'
|
|
21
21
|
export * from './CreateCustomerAddressForm/CreateCustomerAddressForm'
|
|
22
|
+
export * from './CreditMemo'
|
|
22
23
|
export * from './CustomerFab/CustomerFab'
|
|
24
|
+
export * from './CustomerForms'
|
|
23
25
|
export * from './CustomerMenuFabItem/CustomerMenuFabItem'
|
|
24
26
|
export * from './DeleteCustomerAddressForm/DeleteCustomerAddressForm'
|
|
25
27
|
export * from './EditAddressForm/EditAddressForm'
|
|
26
28
|
export * from './ForgotPasswordForm/ForgotPassword.gql'
|
|
27
29
|
export * from './ForgotPasswordForm/ForgotPasswordForm'
|
|
28
30
|
export * from './GuestOrderOverview/GuestOrderOverviewForm'
|
|
31
|
+
export * from './Invoice'
|
|
29
32
|
export * from './NameFields/NameFields'
|
|
30
33
|
export * from './NoOrdersFound/NoOrdersFound'
|
|
31
|
-
export * from './
|
|
32
|
-
export * from './OrderDetails/OrderDetails'
|
|
33
|
-
export * from './OrderDetails/OrderDetails.gql'
|
|
34
|
-
export * from './OrderDetails/OrderTotals'
|
|
35
|
-
export * from './OrderItem/OrderItem'
|
|
36
|
-
export * from './OrderItems/OrderItems'
|
|
37
|
-
export * from './OrderStateLabel/OrderStateLabel'
|
|
38
|
-
export * from './OrderStateLabel/OrderStateLabelInline'
|
|
34
|
+
export * from './Order'
|
|
39
35
|
export * from './ReorderItems/ReorderItems'
|
|
40
36
|
export * from './ResetPasswordForm/ResetPasswordForm'
|
|
37
|
+
export * from './Shipment'
|
|
41
38
|
export * from './SignInForm/SignIn.gql'
|
|
42
39
|
export * from './SignInForm/SignInForm'
|
|
43
40
|
export * from './SignInForm/SignInFormInline'
|
|
@@ -9,12 +9,17 @@ fragment AccountDashboardQueryFragment on Query {
|
|
|
9
9
|
sort: { sort_direction: DESC, sort_field: CREATED_AT }
|
|
10
10
|
scope: GLOBAL
|
|
11
11
|
) {
|
|
12
|
-
|
|
13
|
-
...OrderCard
|
|
14
|
-
}
|
|
12
|
+
total_count
|
|
15
13
|
page_info {
|
|
14
|
+
current_page
|
|
15
|
+
page_size
|
|
16
16
|
total_pages
|
|
17
17
|
}
|
|
18
|
+
items {
|
|
19
|
+
number
|
|
20
|
+
order_date
|
|
21
|
+
...OrderStateLabel
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
...AccountAddresses
|
|
20
25
|
}
|
package/graphql/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './fragments/AccountDashboardQueryFragment.gql'
|
|
2
|
+
export * from './queries/AccountDashboard.gql'
|
|
3
|
+
export * from './queries/AccountDashboardAddresses.gql'
|
|
4
|
+
export * from './queries/AccountDashboardCustomer.gql'
|
|
5
|
+
export * from './queries/AccountDashboardOrders.gql'
|
|
6
|
+
export * from './queries/CreditMemoDetailPage.gql'
|
|
7
|
+
export * from './queries/InvoiceDetailPage.gql'
|
|
8
|
+
export * from './queries/OrderDetailPage.gql'
|
|
9
|
+
export * from './queries/ShipmentDetailPage.gql'
|
|
10
|
+
export * from './inject/CustomerStoreConfig.gql'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
query OrderDetailPage($orderNumber: String) {
|
|
2
|
+
customer {
|
|
3
|
+
orders(filter: { number: { eq: $orderNumber } }, scope: GLOBAL) {
|
|
4
|
+
items {
|
|
5
|
+
id
|
|
6
|
+
...OrderStateLabel
|
|
7
|
+
...OrderDetails
|
|
8
|
+
...OrderItems
|
|
9
|
+
...OrderTotals
|
|
10
|
+
...OrderAdditional
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -6,16 +6,16 @@ fragment CustomerInfo on Customer {
|
|
|
6
6
|
...CustomerAddress
|
|
7
7
|
}
|
|
8
8
|
email
|
|
9
|
-
|
|
10
9
|
prefix
|
|
11
10
|
firstname
|
|
12
11
|
middlename
|
|
13
12
|
lastname
|
|
14
13
|
suffix
|
|
15
14
|
gender
|
|
16
|
-
|
|
17
15
|
is_subscribed
|
|
18
|
-
|
|
19
16
|
date_of_birth
|
|
20
17
|
taxvat
|
|
18
|
+
custom_attributes {
|
|
19
|
+
...AttributeValueFragment
|
|
20
|
+
}
|
|
21
21
|
}
|
package/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export * from './components'
|
|
2
|
-
export * from './graphql/AccountDashboard.gql'
|
|
3
|
-
export * from './graphql/AccountDashboardAddresses.gql'
|
|
4
|
-
export * from './graphql/AccountDashboardOrders.gql'
|
|
5
|
-
export * from './graphql/OrderDetailPage.gql'
|
|
6
2
|
export * from './hooks'
|
|
7
3
|
export * from './typePolicies'
|
|
8
4
|
export * from './utils'
|
|
5
|
+
export * from './graphql'
|
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": "9.1.0-canary.
|
|
5
|
+
"version": "9.1.0-canary.20",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.1.0-canary.
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.
|
|
17
|
-
"@graphcommerce/framer-next-pages": "^9.1.0-canary.
|
|
18
|
-
"@graphcommerce/framer-utils": "^9.1.0-canary.
|
|
19
|
-
"@graphcommerce/graphql": "^9.1.0-canary.
|
|
20
|
-
"@graphcommerce/graphql-mesh": "^9.1.0-canary.
|
|
21
|
-
"@graphcommerce/image": "^9.1.0-canary.
|
|
22
|
-
"@graphcommerce/magento-graphql": "^9.1.0-canary.
|
|
23
|
-
"@graphcommerce/magento-store": "^9.1.0-canary.
|
|
24
|
-
"@graphcommerce/next-ui": "^9.1.0-canary.
|
|
25
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
|
26
|
-
"@graphcommerce/react-hook-form": "^9.1.0-canary.
|
|
27
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.1.0-canary.20",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.20",
|
|
17
|
+
"@graphcommerce/framer-next-pages": "^9.1.0-canary.20",
|
|
18
|
+
"@graphcommerce/framer-utils": "^9.1.0-canary.20",
|
|
19
|
+
"@graphcommerce/graphql": "^9.1.0-canary.20",
|
|
20
|
+
"@graphcommerce/graphql-mesh": "^9.1.0-canary.20",
|
|
21
|
+
"@graphcommerce/image": "^9.1.0-canary.20",
|
|
22
|
+
"@graphcommerce/magento-graphql": "^9.1.0-canary.20",
|
|
23
|
+
"@graphcommerce/magento-store": "^9.1.0-canary.20",
|
|
24
|
+
"@graphcommerce/next-ui": "^9.1.0-canary.20",
|
|
25
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.20",
|
|
26
|
+
"@graphcommerce/react-hook-form": "^9.1.0-canary.20",
|
|
27
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.20",
|
|
28
28
|
"@lingui/core": "^4.2.1",
|
|
29
29
|
"@lingui/macro": "^4.2.1",
|
|
30
30
|
"@lingui/react": "^4.2.1",
|
package/utils/orderState.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
2
|
-
import type { OrderDetailsFragment } from '../components/
|
|
3
|
-
import type { OrderStateLabelFragment } from '../components/OrderStateLabel/OrderStateLabel.gql'
|
|
2
|
+
import type { OrderDetailsFragment, OrderStateLabelFragment } from '../components/Order'
|
|
4
3
|
|
|
5
4
|
export type OrderState = 'pending' | 'processing' | 'complete' | 'closed'
|
|
6
5
|
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
fragment OrderCard on CustomerOrder {
|
|
2
|
-
number
|
|
3
|
-
shipments {
|
|
4
|
-
id
|
|
5
|
-
tracking {
|
|
6
|
-
...TrackingLink
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
total {
|
|
11
|
-
grand_total {
|
|
12
|
-
...Money
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
items {
|
|
16
|
-
...OrderCardItem
|
|
17
|
-
}
|
|
18
|
-
...OrderStateLabel
|
|
19
|
-
order_date
|
|
20
|
-
shipping_address {
|
|
21
|
-
city
|
|
22
|
-
postcode
|
|
23
|
-
firstname
|
|
24
|
-
lastname
|
|
25
|
-
street
|
|
26
|
-
country_code
|
|
27
|
-
region_id
|
|
28
|
-
}
|
|
29
|
-
}
|