@graphcommerce/magento-customer 10.0.0-canary.66 → 10.0.0-canary.68
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/AccountAddress/AccountAddress.tsx +10 -5
- package/components/AccountAddresses/AccountAddresses.tsx +6 -2
- package/components/AccountDeleteForm/AccountDeleteForm.tsx +14 -4
- package/components/AccountMenu/AccountMenu.tsx +2 -2
- package/components/AccountMenuItem/AccountMenuItem.tsx +19 -16
- package/components/CancelOrder/CancelOrderForm.tsx +12 -19
- package/components/ConfirmCustomer/ConfirmCustomerForm.tsx +1 -5
- package/components/CreditMemo/CreditMemoCard.tsx +6 -6
- package/components/CreditMemo/CreditMemoDetails.tsx +12 -12
- package/components/CreditMemo/CreditMemoItems.tsx +5 -4
- package/components/CreditMemo/CreditMemoTotals.tsx +7 -8
- package/components/EditAddressForm/EditAddressForm.tsx +21 -13
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +0 -2
- package/components/Invoice/InvoiceCard.tsx +6 -6
- package/components/Invoice/InvoiceDetails.tsx +12 -12
- package/components/Invoice/InvoiceItems.tsx +5 -4
- package/components/Invoice/InvoiceTotals.tsx +7 -8
- package/components/NoOrdersFound/NoOrdersFound.tsx +2 -5
- package/components/Order/OrderCard/OrderCard.tsx +6 -7
- package/components/Order/OrderDetails/OrderDetails.tsx +9 -12
- package/components/Order/OrderItems/OrderItems.tsx +5 -4
- package/components/Order/OrderStateLabel/OrderStateLabelInline.tsx +12 -13
- package/components/Order/OrderTotals/OrderTotals.tsx +7 -8
- package/components/Shipment/ShipmentCard.tsx +6 -6
- package/components/Shipment/ShipmentDetails.tsx +12 -12
- package/components/Shipment/ShipmentItems.tsx +5 -4
- package/components/SignInForm/SignInForm.tsx +0 -2
- package/components/SignInForm/SignInFormInline.tsx +8 -5
- package/components/SignUpForm/SignUpForm.tsx +2 -2
- package/components/SignUpForm/SignUpFormInline.tsx +3 -1
- package/components/TrackingLink/TrackingLink.tsx +5 -5
- package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +4 -0
- package/graphql/Config.graphqls +9 -0
- package/hooks/index.ts +2 -1
- package/hooks/useBillingAddressPermission.tsx +8 -0
- package/package.json +16 -15
- package/utils/billingAddressPermission.tsx +10 -0
- package/utils/index.ts +1 -0
|
@@ -3,6 +3,7 @@ import { Trans } from '@lingui/react/macro'
|
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
4
4
|
import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material'
|
|
5
5
|
import React, { useEffect, useMemo } from 'react'
|
|
6
|
+
import { useBillingAddressPermission } from '../../hooks'
|
|
6
7
|
import type { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
7
8
|
import { UpdateDefaultAddressDocument } from '../AccountAddresses/UpdateDefaultAddress.gql'
|
|
8
9
|
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
@@ -33,6 +34,8 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
|
|
|
33
34
|
|
|
34
35
|
const submit = handleSubmit(() => {})
|
|
35
36
|
|
|
37
|
+
const billingAddressReadonly = useBillingAddressPermission() === 'READONLY'
|
|
38
|
+
|
|
36
39
|
useEffect(() => {
|
|
37
40
|
reset(defaultValues)
|
|
38
41
|
}, [defaultValues, reset])
|
|
@@ -74,6 +77,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
|
|
|
74
77
|
onBlur={onBlur}
|
|
75
78
|
name={name}
|
|
76
79
|
onChange={(e) => onChange((e as React.ChangeEvent<HTMLInputElement>).target.checked)}
|
|
80
|
+
disabled={billingAddressReadonly}
|
|
77
81
|
/>
|
|
78
82
|
|
|
79
83
|
{formState.errors.defaultBilling?.message && (
|
package/graphql/Config.graphqls
CHANGED
|
@@ -4,9 +4,18 @@ enum CustomerAccountPermissions {
|
|
|
4
4
|
DISABLED
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
enum BillingAddressPermissions {
|
|
8
|
+
EDITABLE
|
|
9
|
+
READONLY
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
extend input GraphCommercePermissions {
|
|
8
13
|
"""
|
|
9
14
|
Enables / disabled the account section of the website. DISABLE_REGISTRATION will only disable the registration page.
|
|
10
15
|
"""
|
|
11
16
|
customerAccount: CustomerAccountPermissions
|
|
17
|
+
"""
|
|
18
|
+
Allows customers to change their billing address or locks it down.
|
|
19
|
+
"""
|
|
20
|
+
billingAddress: BillingAddressPermissions
|
|
12
21
|
}
|
package/hooks/index.ts
CHANGED
|
@@ -4,12 +4,13 @@ export * from './CustomerToken.gql'
|
|
|
4
4
|
export * from './IsEmailAvailable.gql'
|
|
5
5
|
export * from './OrderCardItemImage.gql'
|
|
6
6
|
export * from './OrderCardItemImages.gql'
|
|
7
|
-
export * from './UseOrderCardItemImages.gql'
|
|
8
7
|
export * from './useAccountSignInUpForm'
|
|
9
8
|
export * from './useCustomerPermissions'
|
|
10
9
|
export * from './useCustomerQuery'
|
|
11
10
|
export * from './useCustomerSession'
|
|
12
11
|
export * from './UseCustomerValidateToken.gql'
|
|
13
12
|
export * from './useGuestQuery'
|
|
13
|
+
export * from './useBillingAddressPermission'
|
|
14
14
|
export { default as useOrderCardItemImages } from './useOrderCardItemImages'
|
|
15
|
+
export * from './UseOrderCardItemImages.gql'
|
|
15
16
|
export * from './useSignInForm'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { permissions } from '@graphcommerce/next-config/config'
|
|
2
|
+
import { useStorefrontConfig } from '@graphcommerce/next-ui'
|
|
3
|
+
|
|
4
|
+
export function useBillingAddressPermission() {
|
|
5
|
+
return (
|
|
6
|
+
useStorefrontConfig().permissions?.billingAddress ?? permissions?.billingAddress ?? 'EDITABLE'
|
|
7
|
+
)
|
|
8
|
+
}
|
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": "10.0.0-canary.
|
|
5
|
+
"version": "10.0.0-canary.68",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -21,23 +21,24 @@
|
|
|
21
21
|
"./plugins/magentoCustomerPrivateQueryContext": "./plugins/magentoCustomerPrivateQueryContext.ts"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@graphcommerce/ecommerce-ui": "^10.0.0-canary.
|
|
25
|
-
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.
|
|
26
|
-
"@graphcommerce/framer-next-pages": "^10.0.0-canary.
|
|
27
|
-
"@graphcommerce/framer-utils": "^10.0.0-canary.
|
|
28
|
-
"@graphcommerce/graphql": "^10.0.0-canary.
|
|
29
|
-
"@graphcommerce/graphql-mesh": "^10.0.0-canary.
|
|
30
|
-
"@graphcommerce/image": "^10.0.0-canary.
|
|
31
|
-
"@graphcommerce/magento-graphql": "^10.0.0-canary.
|
|
32
|
-
"@graphcommerce/magento-store": "^10.0.0-canary.
|
|
33
|
-
"@graphcommerce/next-
|
|
34
|
-
"@graphcommerce/
|
|
35
|
-
"@graphcommerce/
|
|
36
|
-
"@graphcommerce/
|
|
24
|
+
"@graphcommerce/ecommerce-ui": "^10.0.0-canary.68",
|
|
25
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
|
|
26
|
+
"@graphcommerce/framer-next-pages": "^10.0.0-canary.68",
|
|
27
|
+
"@graphcommerce/framer-utils": "^10.0.0-canary.68",
|
|
28
|
+
"@graphcommerce/graphql": "^10.0.0-canary.68",
|
|
29
|
+
"@graphcommerce/graphql-mesh": "^10.0.0-canary.68",
|
|
30
|
+
"@graphcommerce/image": "^10.0.0-canary.68",
|
|
31
|
+
"@graphcommerce/magento-graphql": "^10.0.0-canary.68",
|
|
32
|
+
"@graphcommerce/magento-store": "^10.0.0-canary.68",
|
|
33
|
+
"@graphcommerce/next-config": "^10.0.0-canary.68",
|
|
34
|
+
"@graphcommerce/next-ui": "^10.0.0-canary.68",
|
|
35
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
|
|
36
|
+
"@graphcommerce/react-hook-form": "^10.0.0-canary.68",
|
|
37
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
|
|
37
38
|
"@lingui/core": "^5",
|
|
38
39
|
"@lingui/macro": "^5",
|
|
39
40
|
"@lingui/react": "^5",
|
|
40
|
-
"@mui/material": "^
|
|
41
|
+
"@mui/material": "^7.0.0",
|
|
41
42
|
"framer-motion": "^11.0.0",
|
|
42
43
|
"graphql": "^16.0.0",
|
|
43
44
|
"next": "*",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { permissions } from '@graphcommerce/next-config/config'
|
|
2
|
+
import { storefrontConfig } from '@graphcommerce/next-ui'
|
|
3
|
+
|
|
4
|
+
export function getBillingAddressPermission(locale: string | undefined) {
|
|
5
|
+
return (
|
|
6
|
+
storefrontConfig(locale)?.permissions?.billingAddress ??
|
|
7
|
+
permissions?.billingAddress ??
|
|
8
|
+
'EDITABLE'
|
|
9
|
+
)
|
|
10
|
+
}
|
package/utils/index.ts
CHANGED