@graphcommerce/magento-customer 9.1.0-canary.17 → 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.
Files changed (96) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/components/AccountAddresses/AccountAddresses.tsx +9 -4
  3. package/components/AccountDeleteForm/AccountDeleteForm.tsx +14 -4
  4. package/components/AccountLatestOrder/AccountLatestOrder.tsx +1 -2
  5. package/components/AccountOrders/AccountOrders.tsx +1 -1
  6. package/components/CancelOrder/CancelOrderForm.tsx +2 -2
  7. package/components/CancelOrder/CancelOrderFragment.graphql +5 -0
  8. package/components/ChangeNameForm/ChangeNameForm.tsx +1 -0
  9. package/components/ContactForm/ContactUsConfig.graphql +3 -0
  10. package/components/CreditMemo/CreditMemo.graphql +43 -0
  11. package/components/CreditMemo/CreditMemoCard.graphql +12 -0
  12. package/components/CreditMemo/CreditMemoCard.tsx +66 -0
  13. package/components/CreditMemo/CreditMemoDetails.tsx +94 -0
  14. package/components/CreditMemo/CreditMemoItem.graphql +26 -0
  15. package/components/CreditMemo/CreditMemoItem.tsx +125 -0
  16. package/components/CreditMemo/CreditMemoItems.tsx +78 -0
  17. package/components/CreditMemo/CreditMemoTotals.tsx +122 -0
  18. package/components/CreditMemo/index.ts +8 -0
  19. package/components/CustomerForms/CustomerAttributeField.tsx +112 -0
  20. package/components/CustomerForms/CustomerAttributeMetadata.graphql +9 -0
  21. package/components/CustomerForms/CustomerUpdateForm.tsx +65 -0
  22. package/components/CustomerForms/UseCustomerCreateForm.graphql +7 -0
  23. package/components/CustomerForms/UseCustomerUpdateForm.graphql +7 -0
  24. package/components/CustomerForms/customerAttributeFieldHelpers.ts +127 -0
  25. package/components/CustomerForms/index.ts +8 -0
  26. package/components/CustomerForms/nameFieldset.tsx +32 -0
  27. package/components/CustomerForms/useCustomerCreateForm.ts +83 -0
  28. package/components/CustomerForms/useCustomerUpdateForm.ts +122 -0
  29. package/components/GuestOrderOverview/GuestOrderOverviewForm.tsx +28 -11
  30. package/components/Invoice/Invoice.graphql +13 -0
  31. package/components/Invoice/InvoiceCard.graphql +9 -0
  32. package/components/Invoice/InvoiceCard.tsx +66 -0
  33. package/components/Invoice/InvoiceDetails.tsx +94 -0
  34. package/components/Invoice/InvoiceItem.graphql +25 -0
  35. package/components/Invoice/InvoiceItem.tsx +125 -0
  36. package/components/Invoice/InvoiceItems.tsx +72 -0
  37. package/components/Invoice/InvoiceTotal.graphql +29 -0
  38. package/components/Invoice/InvoiceTotals.tsx +110 -0
  39. package/components/Invoice/index.ts +9 -0
  40. package/components/NameFields/NameFields.tsx +33 -18
  41. package/components/Order/OrderAdditional/OrderAdditional.graphql +16 -0
  42. package/components/Order/OrderAdditional/OrderAdditional.tsx +51 -0
  43. package/components/Order/OrderCard/OrderCard.graphql +13 -0
  44. package/components/{OrderCard → Order/OrderCard}/OrderCard.tsx +22 -18
  45. package/components/{OrderCardItem → Order/OrderCard}/OrderCardItem.graphql +1 -0
  46. package/components/Order/OrderComments/OrderComments.graphql +5 -0
  47. package/components/Order/OrderComments/SalesCommentItem.graphql +4 -0
  48. package/components/Order/OrderComments/SalesComments.tsx +28 -0
  49. package/components/Order/OrderDetails/OrderAddress.graphql +17 -0
  50. package/components/Order/OrderDetails/OrderDetails.graphql +38 -0
  51. package/components/{OrderDetails → Order/OrderDetails}/OrderDetails.tsx +70 -57
  52. package/components/Order/OrderDetails/ShippingHandling.graphql +19 -0
  53. package/components/Order/OrderDetails/TaxItem.graphql +7 -0
  54. package/components/{OrderItem → Order/OrderItem}/OrderItem.graphql +13 -0
  55. package/components/Order/OrderItem/OrderItem.tsx +144 -0
  56. package/components/Order/OrderItems/OrderItems.tsx +81 -0
  57. package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabel.tsx +2 -2
  58. package/components/Order/OrderTotals/OrderTotal.graphql +32 -0
  59. package/components/Order/OrderTotals/OrderTotals.graphql +7 -0
  60. package/components/{OrderDetails → Order/OrderTotals}/OrderTotals.tsx +27 -12
  61. package/components/Order/index.ts +16 -0
  62. package/components/ReorderItems/ReorderItems.tsx +1 -1
  63. package/components/Shipment/Shipment.graphql +14 -0
  64. package/components/Shipment/ShipmentCard.graphql +8 -0
  65. package/components/Shipment/ShipmentCard.tsx +71 -0
  66. package/components/Shipment/ShipmentDetails.tsx +100 -0
  67. package/components/Shipment/ShipmentItem.graphql +19 -0
  68. package/components/Shipment/ShipmentItem.tsx +117 -0
  69. package/components/Shipment/ShipmentItems.tsx +72 -0
  70. package/components/Shipment/index.ts +7 -0
  71. package/components/SignUpForm/SignUpForm.tsx +51 -46
  72. package/components/WaitForCustomer/WaitForCustomer.tsx +12 -3
  73. package/components/index.ts +5 -8
  74. package/graphql/{AccountDashboardQueryFragment.graphql → fragments/AccountDashboardQueryFragment.graphql} +8 -3
  75. package/graphql/index.ts +10 -0
  76. package/graphql/queries/CreditMemoDetailPage.graphql +14 -0
  77. package/graphql/queries/InvoiceDetailPage.graphql +14 -0
  78. package/graphql/queries/OrderDetailPage.graphql +14 -0
  79. package/graphql/queries/ShipmentDetailPage.graphql +12 -0
  80. package/hooks/CustomerInfo.graphql +3 -3
  81. package/index.ts +1 -4
  82. package/package.json +14 -14
  83. package/utils/orderState.ts +1 -2
  84. package/components/OrderCard/OrderCard.graphql +0 -29
  85. package/components/OrderDetails/OrderDetails.graphql +0 -77
  86. package/components/OrderItem/OrderItem.tsx +0 -176
  87. package/components/OrderItems/OrderItems.tsx +0 -70
  88. package/graphql/OrderDetailPage.graphql +0 -10
  89. /package/components/{OrderItems → Order/OrderItems}/OrderItems.graphql +0 -0
  90. /package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabel.graphql +0 -0
  91. /package/components/{OrderStateLabel → Order/OrderStateLabel}/OrderStateLabelInline.tsx +0 -0
  92. /package/graphql/{CustomerStoreConfig.graphql → inject/CustomerStoreConfig.graphql} +0 -0
  93. /package/graphql/{AccountDashboard.graphql → queries/AccountDashboard.graphql} +0 -0
  94. /package/graphql/{AccountDashboardAddresses.graphql → queries/AccountDashboardAddresses.graphql} +0 -0
  95. /package/graphql/{AccountDashboardCustomer.graphql → queries/AccountDashboardCustomer.graphql} +0 -0
  96. /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={<>&nbsp;</>}
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
+ }
@@ -0,0 +1,7 @@
1
+ export * from './Shipment.gql'
2
+ export * from './ShipmentCard'
3
+ export * from './ShipmentCard.gql'
4
+ export * from './ShipmentDetails'
5
+ export * from './ShipmentItem.gql'
6
+ export * from './ShipmentItem'
7
+ export * from './ShipmentItems'
@@ -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 { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
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 { FormPersist, useFormGqlMutation } from '@graphcommerce/react-hook-form'
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 = useFormGqlMutation<SignUpMutation, SignUpFormValues>(
32
- SignUpDocument,
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
- return { ...values, email: email ?? '' }
39
+
40
+ values.input.email = email
41
+ return values
44
42
  },
45
43
  onComplete: async (result, variables) => {
46
- if (!result.errors && !storeConfig.data?.storeConfig?.create_account_confirmation) {
47
- signIn.setValue('email', variables.email)
48
- signIn.setValue('password', variables.password)
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
- form.formState.isSubmitSuccessful
63
+ formState.isSubmitSuccessful
65
64
  ) {
66
65
  return (
67
66
  <Alert>
68
- <Trans
69
- id='Registration successful. Please check your inbox to confirm your email address ({email})'
70
- values={{ email }}
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
- error={!!formState.errors.password || !!inputError}
84
- label={<Trans id='Password' />}
81
+ label={<Trans id='Password'>Password</Trans>}
85
82
  autoFocus={!!email}
86
83
  autoComplete='new-password'
87
- required={required.password}
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
- error={!!formState.errors.confirmPassword || !!inputError}
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
- <NameFields form={form} prefix />
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='isSubscribed'
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={remainingError} />
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<SignUpFormValues>
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 { waitFor = [], children, fallback, unauthenticated, ...rest } = props
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 && error && <ApolloCustomerErrorFullPage error={error} />}
85
- {session.loggedIn && !error && children}
93
+ {session.loggedIn && hasError && <ApolloCustomerErrorFullPage error={error} />}
94
+ {session.loggedIn && !hasError && children}
86
95
  </WaitForQueries>
87
96
  )
88
97
  }
@@ -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 './OrderCard/OrderCard'
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
- items {
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
  }
@@ -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 CreditMemoDetailPage($orderNumber: String!) {
2
+ customer {
3
+ orders(filter: { number: { eq: $orderNumber } }, scope: GLOBAL) {
4
+ items {
5
+ ...OrderDetails
6
+ id
7
+ number
8
+ credit_memos {
9
+ ...CreditMemo
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ query InvoiceDetailPage($orderNumber: String!) {
2
+ customer {
3
+ orders(filter: { number: { eq: $orderNumber } }, scope: GLOBAL) {
4
+ items {
5
+ ...OrderDetails
6
+ id
7
+ number
8
+ invoices {
9
+ ...Invoice
10
+ }
11
+ }
12
+ }
13
+ }
14
+ }
@@ -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
+ }
@@ -0,0 +1,12 @@
1
+ query ShipmentDetailPage($orderNumber: String!) {
2
+ customer {
3
+ orders(filter: { number: { eq: $orderNumber } }, scope: GLOBAL) {
4
+ items {
5
+ ...OrderDetails
6
+ shipments {
7
+ ...Shipment
8
+ }
9
+ }
10
+ }
11
+ }
12
+ }
@@ -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.17",
5
+ "version": "9.1.0-canary.19",
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.17",
16
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.17",
17
- "@graphcommerce/framer-next-pages": "^9.1.0-canary.17",
18
- "@graphcommerce/framer-utils": "^9.1.0-canary.17",
19
- "@graphcommerce/graphql": "^9.1.0-canary.17",
20
- "@graphcommerce/graphql-mesh": "^9.1.0-canary.17",
21
- "@graphcommerce/image": "^9.1.0-canary.17",
22
- "@graphcommerce/magento-graphql": "^9.1.0-canary.17",
23
- "@graphcommerce/magento-store": "^9.1.0-canary.17",
24
- "@graphcommerce/next-ui": "^9.1.0-canary.17",
25
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.17",
26
- "@graphcommerce/react-hook-form": "^9.1.0-canary.17",
27
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.17",
15
+ "@graphcommerce/ecommerce-ui": "^9.1.0-canary.19",
16
+ "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.19",
17
+ "@graphcommerce/framer-next-pages": "^9.1.0-canary.19",
18
+ "@graphcommerce/framer-utils": "^9.1.0-canary.19",
19
+ "@graphcommerce/graphql": "^9.1.0-canary.19",
20
+ "@graphcommerce/graphql-mesh": "^9.1.0-canary.19",
21
+ "@graphcommerce/image": "^9.1.0-canary.19",
22
+ "@graphcommerce/magento-graphql": "^9.1.0-canary.19",
23
+ "@graphcommerce/magento-store": "^9.1.0-canary.19",
24
+ "@graphcommerce/next-ui": "^9.1.0-canary.19",
25
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.19",
26
+ "@graphcommerce/react-hook-form": "^9.1.0-canary.19",
27
+ "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.19",
28
28
  "@lingui/core": "^4.2.1",
29
29
  "@lingui/macro": "^4.2.1",
30
30
  "@lingui/react": "^4.2.1",
@@ -1,6 +1,5 @@
1
1
  import { filterNonNullableKeys } from '@graphcommerce/next-ui'
2
- import type { OrderDetailsFragment } from '../components/OrderDetails/OrderDetails.gql'
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
- }