@graphcommerce/magento-customer 3.0.7 → 3.0.11

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.9](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-customer@3.0.8...@graphcommerce/magento-customer@3.0.9) (2021-09-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * dependency cycle issues causes release version issues ([f9d82e3](https://github.com/ho-nl/m2-pwa/commit/f9d82e3bf152acaf90f9d5328bc3d020ca1c53d8))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.0.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-customer@3.0.0...@graphcommerce/magento-customer@3.0.1) (2021-09-27)
7
18
 
8
19
  **Note:** Version bump only for package @graphcommerce/magento-customer
@@ -6,7 +6,6 @@ export * from './ChangePasswordForm/ChangePassword.gql'
6
6
  export { default as ForgotPasswordForm } from './ForgotPasswordForm/ForgotPasswordForm'
7
7
  export * from './ForgotPasswordForm/ForgotPassword.gql'
8
8
  export { default as SignOutForm } from './SignOutForm'
9
- export { default as InlineAccount } from './InlineAccount'
10
9
  export { default as CreateCustomerAddressForm } from './CreateCustomerAddressForm'
11
10
  export { default as DeleteCustomerAddressForm } from './DeleteCustomerAddressForm'
12
11
  export { default as EditAddressForm } from './EditAddressForm'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/magento-customer",
3
- "version": "3.0.7",
3
+ "version": "3.0.11",
4
4
  "sideEffects": false,
5
5
  "prettier": "@graphcommerce/prettier-config-pwa",
6
6
  "browserslist": [
@@ -23,11 +23,9 @@
23
23
  "@apollo/client": "^3.3.21",
24
24
  "@graphcommerce/graphql": "^2.103.4",
25
25
  "@graphcommerce/image": "^2.104.5",
26
- "@graphcommerce/magento-cart": "^3.0.7",
27
26
  "@graphcommerce/magento-graphql": "^2.103.4",
28
- "@graphcommerce/magento-product": "^3.0.7",
29
- "@graphcommerce/magento-store": "^3.0.7",
30
- "@graphcommerce/next-ui": "^3.0.6",
27
+ "@graphcommerce/magento-store": "^3.0.9",
28
+ "@graphcommerce/next-ui": "^3.1.1",
31
29
  "@graphcommerce/react-hook-form": "^2.102.4",
32
30
  "@graphql-typed-document-node/core": "^3.1.0",
33
31
  "@material-ui/core": "^4.12.3",
@@ -38,5 +36,5 @@
38
36
  "react": "^17.0.2",
39
37
  "react-dom": "^17.0.2"
40
38
  },
41
- "gitHead": "e22e75eb7fb075dece93b268a9b3799c4e1e9cea"
39
+ "gitHead": "d543ebfabe185d01354c9aed619ab83ec816944f"
42
40
  }
@@ -1,10 +0,0 @@
1
- query InlineAccount($cartId: String!) {
2
- cart(cart_id: $cartId) {
3
- __typename
4
- id
5
- shipping_addresses {
6
- ...CartAddress
7
- }
8
- email
9
- }
10
- }
@@ -1,149 +0,0 @@
1
- import { useQuery } from '@apollo/client'
2
- import { useCartQuery } from '@graphcommerce/magento-cart'
3
- import Button from '@graphcommerce/next-ui/Button'
4
- import FormRow from '@graphcommerce/next-ui/Form/FormRow'
5
- import { UseStyles } from '@graphcommerce/next-ui/Styles'
6
- import { makeStyles, TextField, Theme, Typography } from '@material-ui/core'
7
- import React, { useState } from 'react'
8
- import { CustomerTokenDocument, IsEmailAvailableDocument } from '../../hooks'
9
- import SignUpFormInline from '../SignUpForm/SignUpFormInline'
10
- import { InlineAccountDocument } from './InlineAccount.gql'
11
-
12
- const useStyles = makeStyles(
13
- (theme: Theme) => ({
14
- root: {
15
- borderRadius: 4,
16
- border: `1px solid ${theme.palette.divider}`,
17
- padding: theme.spacings.md,
18
- },
19
- innerContainer: {
20
- display: 'flex',
21
- justifyContent: 'space-between',
22
- flexDirection: 'column',
23
- alignItems: 'flex-start',
24
- gap: 32,
25
- [theme.breakpoints.up('sm')]: {
26
- alignItems: 'flex-end',
27
- flexDirection: 'unset',
28
- gap: 0,
29
- },
30
- },
31
- form: {
32
- marginTop: theme.spacings.sm,
33
- },
34
- button: {
35
- minWidth: 160,
36
- },
37
- title: {
38
- paddingBottom: 8,
39
- },
40
- }),
41
- { name: 'InlineAccount' },
42
- )
43
-
44
- type InlineAccountProps = {
45
- title?: React.ReactNode
46
- description?: React.ReactNode
47
- accountHref: string
48
- } & UseStyles<typeof useStyles>
49
-
50
- export default function InlineAccount(props: InlineAccountProps) {
51
- const { title, description, accountHref } = props
52
- const classes = useStyles(props)
53
-
54
- const [toggled, setToggled] = useState<boolean>(false)
55
-
56
- const { loading, data } = useCartQuery(InlineAccountDocument)
57
- const cart = data?.cart
58
-
59
- const { data: customerTokenData } = useQuery(CustomerTokenDocument)
60
- const { data: isEmailAvailableData } = useQuery(IsEmailAvailableDocument, {
61
- variables: {
62
- email: cart?.email ?? '',
63
- },
64
- })
65
-
66
- const { firstname, lastname } = cart?.shipping_addresses?.[0] ?? {}
67
- const signedIn = Boolean(
68
- customerTokenData?.customerToken && customerTokenData?.customerToken.valid,
69
- )
70
- const canSignUp = isEmailAvailableData?.isEmailAvailable?.is_email_available === true
71
-
72
- if (!canSignUp) return <></>
73
-
74
- return (
75
- <div>
76
- <div key='signupaccount' className={classes.root}>
77
- {!signedIn && canSignUp && (
78
- <>
79
- <div className={classes.innerContainer}>
80
- <div>
81
- <Typography variant='h4' className={classes.title}>
82
- {title ?? 'No account yet?'}
83
- </Typography>
84
- {description ?? 'You can track your order status and much more!'}
85
- </div>
86
- <div>
87
- {!toggled && (
88
- <Button
89
- variant='pill'
90
- color='secondary'
91
- text='bold'
92
- loading={loading}
93
- onClick={() => setToggled(!toggled)}
94
- className={classes.button}
95
- >
96
- Create an account
97
- </Button>
98
- )}
99
- </div>
100
- </div>
101
- {cart?.email && toggled && (
102
- <div className={classes.form}>
103
- <FormRow>
104
- <TextField
105
- variant='outlined'
106
- type='email'
107
- label='Email'
108
- value={cart?.email}
109
- InputProps={{
110
- readOnly: true,
111
- }}
112
- />
113
- </FormRow>
114
- <SignUpFormInline
115
- firstname={firstname ?? ''}
116
- lastname={lastname}
117
- email={cart?.email}
118
- onSubmitted={() => setToggled(false)}
119
- />
120
- </div>
121
- )}
122
- </>
123
- )}
124
-
125
- {signedIn && (
126
- <div className={classes.innerContainer}>
127
- <div>
128
- <Typography variant='h4' className={classes.title}>
129
- {title ?? 'Have an account?'}
130
- </Typography>
131
- {description ?? 'You can find your order history in your account!'}
132
- </div>
133
- <div>
134
- <Button
135
- variant='pill'
136
- color='secondary'
137
- text='bold'
138
- href={accountHref}
139
- className={classes.button}
140
- >
141
- My account
142
- </Button>
143
- </div>
144
- </div>
145
- )}
146
- </div>
147
- </div>
148
- )
149
- }