@graphcommerce/magento-customer 9.1.0-canary.18 → 9.1.0-canary.19
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 +14 -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,19 @@
|
|
|
1
|
+
fragment ShippingHandling on ShippingHandling {
|
|
2
|
+
amount_excluding_tax {
|
|
3
|
+
...Money
|
|
4
|
+
}
|
|
5
|
+
amount_including_tax {
|
|
6
|
+
...Money
|
|
7
|
+
}
|
|
8
|
+
discounts {
|
|
9
|
+
amount {
|
|
10
|
+
...Money
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
taxes {
|
|
14
|
+
...TaxItem
|
|
15
|
+
}
|
|
16
|
+
total_amount {
|
|
17
|
+
...Money
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
fragment OrderItem on OrderItemInterface {
|
|
2
|
+
__typename
|
|
2
3
|
id
|
|
3
4
|
product_sku
|
|
4
5
|
product_url_key
|
|
@@ -8,10 +9,12 @@ fragment OrderItem on OrderItemInterface {
|
|
|
8
9
|
value
|
|
9
10
|
}
|
|
10
11
|
product {
|
|
12
|
+
__typename
|
|
11
13
|
uid
|
|
12
14
|
thumbnail {
|
|
13
15
|
...ProductImage
|
|
14
16
|
}
|
|
17
|
+
url_key
|
|
15
18
|
}
|
|
16
19
|
quantity_invoiced
|
|
17
20
|
quantity_ordered
|
|
@@ -22,4 +25,14 @@ fragment OrderItem on OrderItemInterface {
|
|
|
22
25
|
product_sale_price {
|
|
23
26
|
...Money
|
|
24
27
|
}
|
|
28
|
+
discounts {
|
|
29
|
+
amount {
|
|
30
|
+
...Money
|
|
31
|
+
}
|
|
32
|
+
label
|
|
33
|
+
}
|
|
34
|
+
entered_options {
|
|
35
|
+
label
|
|
36
|
+
value
|
|
37
|
+
}
|
|
25
38
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Image } from '@graphcommerce/image'
|
|
2
|
+
import { Money, PriceModifiersList, type PriceModifier } from '@graphcommerce/magento-store'
|
|
3
|
+
import {
|
|
4
|
+
ActionCard,
|
|
5
|
+
actionCardImageSizes,
|
|
6
|
+
filterNonNullableKeys,
|
|
7
|
+
type ActionCardProps,
|
|
8
|
+
} from '@graphcommerce/next-ui'
|
|
9
|
+
import { Trans } from '@lingui/react'
|
|
10
|
+
import { Box } from '@mui/material'
|
|
11
|
+
import type { OrderItemFragment } from './OrderItem.gql'
|
|
12
|
+
|
|
13
|
+
export type OrderItemProps = Omit<ActionCardProps, 'value' | 'image' | 'title'> & {
|
|
14
|
+
item: OrderItemFragment
|
|
15
|
+
priceModifiers?: PriceModifier[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function OrderItem(props: OrderItemProps) {
|
|
19
|
+
const { item, priceModifiers: incomingPriceModifiers, size = 'responsive', ...rest } = props
|
|
20
|
+
const {
|
|
21
|
+
selected_options,
|
|
22
|
+
entered_options,
|
|
23
|
+
product_sale_price,
|
|
24
|
+
quantity_ordered,
|
|
25
|
+
product_name,
|
|
26
|
+
product,
|
|
27
|
+
id,
|
|
28
|
+
} = item
|
|
29
|
+
|
|
30
|
+
const priceModifiers: PriceModifier[] = [
|
|
31
|
+
...(incomingPriceModifiers ?? []),
|
|
32
|
+
...filterNonNullableKeys(selected_options).map((option) => ({
|
|
33
|
+
key: option.label,
|
|
34
|
+
label: option.label,
|
|
35
|
+
items: [{ key: option.value, label: option.value }],
|
|
36
|
+
})),
|
|
37
|
+
...filterNonNullableKeys(entered_options).map((option) => ({
|
|
38
|
+
key: option.label,
|
|
39
|
+
label: option.label,
|
|
40
|
+
items: [{ key: option.value, label: option.value }],
|
|
41
|
+
})),
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<ActionCard
|
|
46
|
+
{...rest}
|
|
47
|
+
value={id}
|
|
48
|
+
sx={(theme) => ({
|
|
49
|
+
'&.ActionCard-root': {
|
|
50
|
+
px: 0,
|
|
51
|
+
py: theme.spacings.xs,
|
|
52
|
+
},
|
|
53
|
+
'& .ActionCard-rootInner': {
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
alignItems: 'stretch',
|
|
56
|
+
},
|
|
57
|
+
'&.sizeSmall': {
|
|
58
|
+
px: 0,
|
|
59
|
+
},
|
|
60
|
+
'&.sizeResponsive': {
|
|
61
|
+
[theme.breakpoints.down('md')]: { px: 0 },
|
|
62
|
+
},
|
|
63
|
+
'& .ActionCard-end': {
|
|
64
|
+
justifyContent: 'space-between',
|
|
65
|
+
},
|
|
66
|
+
'& .ActionCard-action': {
|
|
67
|
+
pr: 0,
|
|
68
|
+
},
|
|
69
|
+
'& .ActionCard-image': {
|
|
70
|
+
alignSelf: 'flex-start',
|
|
71
|
+
},
|
|
72
|
+
'& .ActionCard-secondaryAction': {
|
|
73
|
+
display: 'grid',
|
|
74
|
+
rowGap: theme.spacings.xs,
|
|
75
|
+
justifyItems: 'start',
|
|
76
|
+
},
|
|
77
|
+
'& .ActionCard-price': {
|
|
78
|
+
pr: 0,
|
|
79
|
+
mb: { xs: 0.5, sm: 0 },
|
|
80
|
+
},
|
|
81
|
+
})}
|
|
82
|
+
size={size}
|
|
83
|
+
image={
|
|
84
|
+
product?.thumbnail?.url && (
|
|
85
|
+
<Image
|
|
86
|
+
layout='fill'
|
|
87
|
+
src={product.thumbnail.url}
|
|
88
|
+
alt={product.thumbnail?.label ?? ''}
|
|
89
|
+
sx={{
|
|
90
|
+
width: actionCardImageSizes[size],
|
|
91
|
+
height: actionCardImageSizes[size],
|
|
92
|
+
display: 'block',
|
|
93
|
+
borderRadius: 1,
|
|
94
|
+
objectFit: 'contain',
|
|
95
|
+
backgroundColor: 'background.image',
|
|
96
|
+
}}
|
|
97
|
+
sizes={actionCardImageSizes[size]}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
title={product_name}
|
|
102
|
+
price={
|
|
103
|
+
<Money
|
|
104
|
+
currency={product_sale_price.currency}
|
|
105
|
+
value={(product_sale_price.value ?? 0) * (quantity_ordered ?? 1)}
|
|
106
|
+
/>
|
|
107
|
+
}
|
|
108
|
+
action={<> </>}
|
|
109
|
+
secondaryAction={
|
|
110
|
+
<>
|
|
111
|
+
<Box
|
|
112
|
+
sx={{
|
|
113
|
+
display: 'flex',
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
color: 'text.secondary',
|
|
116
|
+
mt: 1,
|
|
117
|
+
gap: '10px',
|
|
118
|
+
justifyContent: 'start',
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
{quantity_ordered}
|
|
122
|
+
{' ⨉ '}
|
|
123
|
+
<Money {...product_sale_price} />
|
|
124
|
+
</Box>
|
|
125
|
+
|
|
126
|
+
{rest.secondaryAction}
|
|
127
|
+
</>
|
|
128
|
+
}
|
|
129
|
+
details={
|
|
130
|
+
<>
|
|
131
|
+
{priceModifiers && priceModifiers.length > 0 && (
|
|
132
|
+
<PriceModifiersList
|
|
133
|
+
label={<Trans id='Base Price'>Base price</Trans>}
|
|
134
|
+
modifiers={priceModifiers}
|
|
135
|
+
total={product_sale_price.value ?? 0}
|
|
136
|
+
currency={product_sale_price.currency}
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
{rest.details}
|
|
140
|
+
</>
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActionCardLayout,
|
|
3
|
+
breakpointVal,
|
|
4
|
+
extendableComponent,
|
|
5
|
+
nonNullable,
|
|
6
|
+
SectionContainer,
|
|
7
|
+
} from '@graphcommerce/next-ui'
|
|
8
|
+
import { Trans } from '@lingui/react'
|
|
9
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
10
|
+
import { Box } from '@mui/material'
|
|
11
|
+
import type { OrderItemProps } from '../OrderItem/OrderItem'
|
|
12
|
+
import { OrderItem } from '../OrderItem/OrderItem'
|
|
13
|
+
import type { OrderItemsFragment } from './OrderItems.gql'
|
|
14
|
+
|
|
15
|
+
export type OrderItemsProps = {
|
|
16
|
+
order: OrderItemsFragment
|
|
17
|
+
sx?: SxProps<Theme>
|
|
18
|
+
layout?: 'list' | 'grid'
|
|
19
|
+
size?: 'small' | 'medium' | 'large'
|
|
20
|
+
itemProps?: Omit<OrderItemProps, 'cartItem'>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const name = 'OrderItems'
|
|
24
|
+
const parts = ['root', 'items', 'actionCard'] as const
|
|
25
|
+
const { classes } = extendableComponent(name, parts)
|
|
26
|
+
|
|
27
|
+
export function OrderItems(props: OrderItemsProps) {
|
|
28
|
+
const { order, sx = [], layout = 'list', size, itemProps = {} } = props
|
|
29
|
+
|
|
30
|
+
const items = (order.items ?? []).filter(nonNullable)
|
|
31
|
+
if (!items.length) return null
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Box
|
|
35
|
+
className={classes.root}
|
|
36
|
+
sx={[
|
|
37
|
+
(theme) => ({
|
|
38
|
+
my: theme.spacings.md,
|
|
39
|
+
padding: `${theme.spacings.sm} ${theme.spacings.sm}`,
|
|
40
|
+
border: `1px ${theme.palette.divider} solid`,
|
|
41
|
+
...breakpointVal(
|
|
42
|
+
'borderRadius',
|
|
43
|
+
theme.shape.borderRadius * 2,
|
|
44
|
+
theme.shape.borderRadius * 3,
|
|
45
|
+
theme.breakpoints.values,
|
|
46
|
+
),
|
|
47
|
+
}),
|
|
48
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
49
|
+
]}
|
|
50
|
+
>
|
|
51
|
+
<SectionContainer
|
|
52
|
+
sx={{ '& .SectionHeader-root': { mt: 0 } }}
|
|
53
|
+
labelLeft={<Trans id='Ordered items' />}
|
|
54
|
+
variantLeft='h6'
|
|
55
|
+
className={classes.items}
|
|
56
|
+
>
|
|
57
|
+
<ActionCardLayout
|
|
58
|
+
sx={(theme) => ({
|
|
59
|
+
marginBottom: theme.spacings.md,
|
|
60
|
+
'&.layoutStack': {
|
|
61
|
+
gap: 0,
|
|
62
|
+
},
|
|
63
|
+
})}
|
|
64
|
+
className={classes.actionCard}
|
|
65
|
+
layout={layout}
|
|
66
|
+
>
|
|
67
|
+
{items.map((orderItem) => (
|
|
68
|
+
<OrderItem
|
|
69
|
+
key={orderItem.id}
|
|
70
|
+
item={orderItem}
|
|
71
|
+
variant='default'
|
|
72
|
+
{...itemProps}
|
|
73
|
+
size={size}
|
|
74
|
+
layout={layout}
|
|
75
|
+
/>
|
|
76
|
+
))}
|
|
77
|
+
</ActionCardLayout>
|
|
78
|
+
</SectionContainer>
|
|
79
|
+
</Box>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
@@ -2,8 +2,8 @@ import { extendableComponent } from '@graphcommerce/next-ui'
|
|
|
2
2
|
import { Trans } from '@lingui/macro'
|
|
3
3
|
import type { SxProps, Theme } from '@mui/material'
|
|
4
4
|
import { Box } from '@mui/material'
|
|
5
|
-
import type { OrderState, OrderStateProps } from '
|
|
6
|
-
import { getOrderState } from '
|
|
5
|
+
import type { OrderState, OrderStateProps } from '../../../utils'
|
|
6
|
+
import { getOrderState } from '../../../utils'
|
|
7
7
|
|
|
8
8
|
type OrderStateLabelPropsBase = OrderStateProps
|
|
9
9
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
fragment OrderTotal on OrderTotal {
|
|
2
|
+
subtotal {
|
|
3
|
+
...Money
|
|
4
|
+
}
|
|
5
|
+
total_shipping {
|
|
6
|
+
...Money
|
|
7
|
+
}
|
|
8
|
+
shipping_handling {
|
|
9
|
+
...ShippingHandling
|
|
10
|
+
}
|
|
11
|
+
discounts {
|
|
12
|
+
amount {
|
|
13
|
+
...Money
|
|
14
|
+
}
|
|
15
|
+
label
|
|
16
|
+
}
|
|
17
|
+
base_grand_total {
|
|
18
|
+
...Money
|
|
19
|
+
}
|
|
20
|
+
grand_total {
|
|
21
|
+
...Money
|
|
22
|
+
}
|
|
23
|
+
total_tax {
|
|
24
|
+
...Money
|
|
25
|
+
}
|
|
26
|
+
taxes {
|
|
27
|
+
...TaxItem
|
|
28
|
+
}
|
|
29
|
+
total_shipping {
|
|
30
|
+
...Money
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Money } from '@graphcommerce/magento-store'
|
|
2
|
-
import { breakpointVal, extendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
+
import { breakpointVal, extendableComponent, sxx } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Trans } from '@lingui/react'
|
|
4
4
|
import type { SxProps, Theme } from '@mui/material'
|
|
5
|
-
import { Box, Divider, Typography } from '@mui/material'
|
|
6
|
-
import type {
|
|
5
|
+
import { Box, Divider, lighten, Typography } from '@mui/material'
|
|
6
|
+
import type { OrderTotalsFragment } from './OrderTotals.gql'
|
|
7
7
|
|
|
8
|
-
export type OrderTotalsProps =
|
|
8
|
+
export type OrderTotalsProps = {
|
|
9
|
+
order: OrderTotalsFragment
|
|
9
10
|
sx?: SxProps<Theme>
|
|
11
|
+
additionalSubtotals?: React.ReactNode
|
|
12
|
+
additionalGrandTotals?: React.ReactNode
|
|
13
|
+
additionalTaxes?: React.ReactNode
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
const componentName = 'OrderTotals'
|
|
@@ -14,25 +18,29 @@ const parts = ['totalsContainer', 'totalsRow', 'totalsDivider', 'totalsVat'] as
|
|
|
14
18
|
const { classes } = extendableComponent(componentName, parts)
|
|
15
19
|
|
|
16
20
|
export function OrderTotals(props: OrderTotalsProps) {
|
|
17
|
-
const {
|
|
21
|
+
const { order, sx = [], additionalSubtotals, additionalGrandTotals, additionalTaxes } = props
|
|
22
|
+
const { total, carrier, shipping_method } = order
|
|
18
23
|
|
|
19
24
|
return (
|
|
20
25
|
<Box
|
|
21
26
|
className={classes.totalsContainer}
|
|
22
|
-
sx={
|
|
27
|
+
sx={sxx(
|
|
23
28
|
(theme) => ({
|
|
24
|
-
|
|
25
|
-
marginBottom: theme.spacings.md,
|
|
26
|
-
p: theme.spacings.sm,
|
|
29
|
+
my: theme.spacings.md,
|
|
27
30
|
...breakpointVal(
|
|
28
31
|
'borderRadius',
|
|
29
|
-
theme.shape.borderRadius * 2,
|
|
30
32
|
theme.shape.borderRadius * 3,
|
|
33
|
+
theme.shape.borderRadius * 5,
|
|
31
34
|
theme.breakpoints.values,
|
|
32
35
|
),
|
|
36
|
+
background:
|
|
37
|
+
theme.palette.mode === 'light'
|
|
38
|
+
? theme.palette.background.default
|
|
39
|
+
: lighten(theme.palette.background.default, 0.15),
|
|
40
|
+
padding: `${theme.spacings.xs} ${theme.spacings.sm}`,
|
|
33
41
|
}),
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
sx,
|
|
43
|
+
)}
|
|
36
44
|
>
|
|
37
45
|
<Box className={classes.totalsRow} sx={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
38
46
|
<Typography>
|
|
@@ -66,6 +74,8 @@ export function OrderTotals(props: OrderTotalsProps) {
|
|
|
66
74
|
</Box>
|
|
67
75
|
)}
|
|
68
76
|
|
|
77
|
+
{additionalSubtotals}
|
|
78
|
+
|
|
69
79
|
<Divider sx={(theme) => ({ my: theme.spacings.xxs })} />
|
|
70
80
|
|
|
71
81
|
<Box
|
|
@@ -81,6 +91,9 @@ export function OrderTotals(props: OrderTotalsProps) {
|
|
|
81
91
|
</Typography>
|
|
82
92
|
<Money {...total?.grand_total} />
|
|
83
93
|
</Box>
|
|
94
|
+
|
|
95
|
+
{additionalGrandTotals}
|
|
96
|
+
|
|
84
97
|
{total?.taxes?.map((tax) => (
|
|
85
98
|
<Box
|
|
86
99
|
key={tax?.title}
|
|
@@ -97,6 +110,8 @@ export function OrderTotals(props: OrderTotalsProps) {
|
|
|
97
110
|
<Money {...tax?.amount} />
|
|
98
111
|
</Box>
|
|
99
112
|
))}
|
|
113
|
+
|
|
114
|
+
{additionalTaxes}
|
|
100
115
|
</Box>
|
|
101
116
|
)
|
|
102
117
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './OrderAdditional/OrderAdditional'
|
|
2
|
+
export * from './OrderAdditional/OrderAdditional.gql'
|
|
3
|
+
export * from './OrderCard/OrderCard'
|
|
4
|
+
export * from './OrderCard/OrderCard.gql'
|
|
5
|
+
export * from './OrderCard/OrderCardItem.gql'
|
|
6
|
+
export * from './OrderComments/SalesComments'
|
|
7
|
+
export * from './OrderDetails/OrderDetails'
|
|
8
|
+
export * from './OrderDetails/OrderDetails.gql'
|
|
9
|
+
export * from './OrderItem/OrderItem'
|
|
10
|
+
export * from './OrderItem/OrderItem.gql'
|
|
11
|
+
export * from './OrderItems/OrderItems'
|
|
12
|
+
export * from './OrderItems/OrderItems.gql'
|
|
13
|
+
export * from './OrderStateLabel/OrderStateLabel'
|
|
14
|
+
export * from './OrderStateLabel/OrderStateLabel.gql'
|
|
15
|
+
export * from './OrderTotals/OrderTotals'
|
|
16
|
+
export * from './OrderTotals/OrderTotals.gql'
|
|
@@ -4,7 +4,7 @@ import { AddProductsToCartSnackbarMessage } from '@graphcommerce/magento-product
|
|
|
4
4
|
import { iconChevronRight, IconSvg, LinkOrButton, nonNullable } from '@graphcommerce/next-ui'
|
|
5
5
|
import { Trans } from '@lingui/macro'
|
|
6
6
|
import { Box } from '@mui/material'
|
|
7
|
-
import type { OrderItemsFragment } from '../
|
|
7
|
+
import type { OrderItemsFragment } from '../Order'
|
|
8
8
|
import type { ReorderItemsMutation, ReorderItemsMutationVariables } from './ReorderItems.gql'
|
|
9
9
|
import { ReorderItemsDocument } from './ReorderItems.gql'
|
|
10
10
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Money } from '@graphcommerce/magento-store'
|
|
2
|
+
import {
|
|
3
|
+
breakpointVal,
|
|
4
|
+
filterNonNullableKeys,
|
|
5
|
+
iconChevronRight,
|
|
6
|
+
IconSvg,
|
|
7
|
+
NextLink,
|
|
8
|
+
sxx,
|
|
9
|
+
} from '@graphcommerce/next-ui'
|
|
10
|
+
import { Trans } from '@lingui/macro'
|
|
11
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
12
|
+
import { Box, lighten } from '@mui/material'
|
|
13
|
+
import { TrackingLink } from '../TrackingLink/TrackingLink'
|
|
14
|
+
import type { ShipmentCardFragment } from './ShipmentCard.gql'
|
|
15
|
+
|
|
16
|
+
export type ShipmentCardProps = {
|
|
17
|
+
orderNumber: string
|
|
18
|
+
shipment: ShipmentCardFragment
|
|
19
|
+
sx?: SxProps<Theme>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function ShipmentCard(props: ShipmentCardProps) {
|
|
23
|
+
const { orderNumber, shipment, sx = [] } = props
|
|
24
|
+
const { number } = shipment
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Box
|
|
28
|
+
component={NextLink}
|
|
29
|
+
href={`/account/orders/shipment?orderNumber=${orderNumber}&shipmentNumber=${number}`}
|
|
30
|
+
sx={sxx(
|
|
31
|
+
(theme) => ({
|
|
32
|
+
textDecoration: 'none',
|
|
33
|
+
color: 'text.primary',
|
|
34
|
+
px: theme.spacings.xxs,
|
|
35
|
+
py: theme.spacings.xxs,
|
|
36
|
+
gap: theme.spacings.sm,
|
|
37
|
+
background:
|
|
38
|
+
theme.palette.mode === 'light'
|
|
39
|
+
? theme.palette.background.default
|
|
40
|
+
: lighten(theme.palette.background.default, 0.15),
|
|
41
|
+
...breakpointVal(
|
|
42
|
+
'borderRadius',
|
|
43
|
+
theme.shape.borderRadius * 2,
|
|
44
|
+
theme.shape.borderRadius * 3,
|
|
45
|
+
theme.breakpoints.values,
|
|
46
|
+
),
|
|
47
|
+
// '&:hover': {
|
|
48
|
+
// backgroundColor: theme.palette.action.hover,
|
|
49
|
+
// },
|
|
50
|
+
display: 'grid',
|
|
51
|
+
gridTemplate: `
|
|
52
|
+
"number action" / 1fr auto
|
|
53
|
+
`,
|
|
54
|
+
rowGap: 0.5,
|
|
55
|
+
columnGap: 1,
|
|
56
|
+
}),
|
|
57
|
+
sx,
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
<Box sx={{ gridArea: 'number', typography: 'body1' }}>
|
|
61
|
+
<Trans>Shipment #{number}</Trans>
|
|
62
|
+
</Box>
|
|
63
|
+
|
|
64
|
+
<IconSvg
|
|
65
|
+
src={iconChevronRight}
|
|
66
|
+
size='medium'
|
|
67
|
+
sx={{ gridArea: 'action', alignSelf: 'center' }}
|
|
68
|
+
/>
|
|
69
|
+
</Box>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
breakpointVal,
|
|
3
|
+
DateTimeFormat,
|
|
4
|
+
extendableComponent,
|
|
5
|
+
filterNonNullableKeys,
|
|
6
|
+
SectionContainer,
|
|
7
|
+
} from '@graphcommerce/next-ui'
|
|
8
|
+
import { Trans } from '@lingui/macro'
|
|
9
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
10
|
+
import { Box, lighten, Typography } from '@mui/material'
|
|
11
|
+
import { TrackingLink } from '../TrackingLink/TrackingLink'
|
|
12
|
+
import type { ShipmentFragment } from './Shipment.gql'
|
|
13
|
+
|
|
14
|
+
export type ShipmentDetailsProps = {
|
|
15
|
+
shipment: ShipmentFragment
|
|
16
|
+
sx?: SxProps<Theme>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const componentName = 'ShipmentDetails'
|
|
20
|
+
const parts = [
|
|
21
|
+
'sectionContainer',
|
|
22
|
+
'shipmentDetailTitle',
|
|
23
|
+
'shipmentDetailContainer',
|
|
24
|
+
'shipmentDetailRow',
|
|
25
|
+
] as const
|
|
26
|
+
const { classes } = extendableComponent(componentName, parts)
|
|
27
|
+
|
|
28
|
+
export function ShipmentDetails(props: ShipmentDetailsProps) {
|
|
29
|
+
const { shipment, sx = [] } = props
|
|
30
|
+
const { number, tracking } = shipment
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SectionContainer
|
|
34
|
+
labelLeft={<Trans>Shipment details</Trans>}
|
|
35
|
+
sx={[
|
|
36
|
+
(theme) => ({
|
|
37
|
+
padding: theme.spacings.sm,
|
|
38
|
+
marginBottom: theme.spacings.md,
|
|
39
|
+
background:
|
|
40
|
+
theme.palette.mode === 'light'
|
|
41
|
+
? theme.palette.background.default
|
|
42
|
+
: lighten(theme.palette.background.default, 0.15),
|
|
43
|
+
...breakpointVal(
|
|
44
|
+
'borderRadius',
|
|
45
|
+
theme.shape.borderRadius * 2,
|
|
46
|
+
theme.shape.borderRadius * 3,
|
|
47
|
+
theme.breakpoints.values,
|
|
48
|
+
),
|
|
49
|
+
'& .SectionHeader-root': {
|
|
50
|
+
mt: 0,
|
|
51
|
+
mb: theme.spacings.xs,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
55
|
+
]}
|
|
56
|
+
>
|
|
57
|
+
<Box
|
|
58
|
+
className={classes.shipmentDetailContainer}
|
|
59
|
+
sx={[
|
|
60
|
+
(theme) => ({
|
|
61
|
+
gridColumnGap: theme.spacings.xxl,
|
|
62
|
+
gridRowGap: theme.spacings.md,
|
|
63
|
+
display: 'grid',
|
|
64
|
+
[theme.breakpoints.up('sm')]: {
|
|
65
|
+
gridTemplateColumns: '1fr 1fr',
|
|
66
|
+
marginTop: theme.spacings.xxs,
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
70
|
+
]}
|
|
71
|
+
>
|
|
72
|
+
<Box className={classes.shipmentDetailRow}>
|
|
73
|
+
<SectionContainer
|
|
74
|
+
variantLeft='h5'
|
|
75
|
+
labelLeft={<Trans>Shipment number</Trans>}
|
|
76
|
+
className={classes.shipmentDetailTitle}
|
|
77
|
+
sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '4px' } }}
|
|
78
|
+
>
|
|
79
|
+
<Typography>{number}</Typography>
|
|
80
|
+
</SectionContainer>
|
|
81
|
+
</Box>
|
|
82
|
+
|
|
83
|
+
{tracking && tracking.length > 0 && (
|
|
84
|
+
<Box className={classes.shipmentDetailRow}>
|
|
85
|
+
<SectionContainer
|
|
86
|
+
variantLeft='h5'
|
|
87
|
+
labelLeft={<Trans>Tracking</Trans>}
|
|
88
|
+
className={classes.shipmentDetailTitle}
|
|
89
|
+
sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '4px' } }}
|
|
90
|
+
>
|
|
91
|
+
{filterNonNullableKeys(tracking).map((track) => (
|
|
92
|
+
<TrackingLink key={track.number} {...track} />
|
|
93
|
+
))}
|
|
94
|
+
</SectionContainer>
|
|
95
|
+
</Box>
|
|
96
|
+
)}
|
|
97
|
+
</Box>
|
|
98
|
+
</SectionContainer>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
fragment ShipmentItem on ShipmentItemInterface {
|
|
2
|
+
__typename
|
|
3
|
+
id
|
|
4
|
+
product_name
|
|
5
|
+
product_sku
|
|
6
|
+
quantity_shipped
|
|
7
|
+
product_sale_price {
|
|
8
|
+
...Money
|
|
9
|
+
}
|
|
10
|
+
order_item {
|
|
11
|
+
id
|
|
12
|
+
product {
|
|
13
|
+
uid
|
|
14
|
+
thumbnail {
|
|
15
|
+
...ProductImage
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|