@graphcommerce/magento-customer 9.0.0-canary.99 → 9.0.0
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 +221 -1174
- package/components/AccountAddress/AccountAddress.tsx +3 -2
- package/components/AccountAddresses/AccountAddresses.tsx +7 -8
- package/components/AccountDeleteForm/AccountDeleteForm.tsx +1 -1
- package/components/AccountLatestOrder/AccountLatestOrder.tsx +5 -1
- package/components/AccountMenu/AccountMenu.tsx +2 -1
- package/components/AccountMenuItem/AccountMenuItem.tsx +7 -6
- package/components/AccountOrders/AccountOrders.tsx +3 -2
- package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +17 -7
- package/components/AddressFields/AddressAddition.tsx +4 -2
- package/components/AddressFields/AddressCity.tsx +4 -2
- package/components/AddressFields/AddressCountryRegion.tsx +6 -9
- package/components/AddressFields/AddressFields.tsx +2 -2
- package/components/AddressFields/AddressHouseNumber.tsx +4 -7
- package/components/AddressFields/AddressPostcode.tsx +4 -2
- package/components/AddressFields/AddressStreet.tsx +3 -2
- package/components/AddressFields/useAddressFieldsForm.tsx +2 -6
- package/components/AddressMultiLine/AddressMultiLine.tsx +4 -3
- package/components/AddressSingleLine/AddressSingleLine.tsx +1 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +2 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorFullPage.tsx +3 -2
- package/components/ApolloCustomerError/ApolloCustomerErrorSnackbar.tsx +2 -1
- package/components/ApolloCustomerError/useAuthorizationErrorMasked.ts +1 -1
- package/components/CancelOrder/CancelOrderForm.tsx +16 -23
- package/components/ChangeNameForm/ChangeNameForm.tsx +2 -2
- package/components/ChangePasswordForm/ChangePasswordForm.tsx +4 -7
- package/components/CompanyFields/CompanyFields.tsx +6 -3
- package/components/CompanyFields/CompanyName.tsx +4 -2
- package/components/CompanyFields/CompanyVAT.tsx +5 -3
- package/components/CompanyFields/useCompanyFieldsForm.tsx +2 -6
- package/components/ConfirmCustomer/ConfirmCustomerForm.tsx +3 -16
- package/components/ContactForm/ContactForm.tsx +2 -1
- package/components/CreateCustomerAddressForm/CreateCustomerAddressForm.tsx +2 -2
- package/components/CustomerFab/CustomerFab.tsx +9 -9
- package/components/CustomerMenuFabItem/CustomerMenuFabItem.tsx +8 -5
- package/components/EditAddressForm/EditAddressForm.tsx +3 -7
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +11 -8
- package/components/GuestOrderOverview/GuestOrderOverviewForm.tsx +2 -1
- package/components/NameFields/NameFields.tsx +4 -2
- package/components/NoOrdersFound/NoOrdersFound.tsx +4 -3
- package/components/OrderCard/OrderCard.tsx +7 -6
- package/components/OrderCardItem/OrderCardItem.tsx +4 -0
- package/components/OrderCardItemImage/OrderCardItemImage.tsx +4 -3
- package/components/OrderDetails/OrderDetails.tsx +11 -10
- package/components/OrderDetails/OrderTotals.tsx +6 -4
- package/components/OrderItem/OrderItem.tsx +5 -5
- package/components/OrderItems/OrderItems.tsx +5 -4
- package/components/OrderStateLabel/OrderStateLabel.tsx +4 -2
- package/components/OrderStateLabel/OrderStateLabelInline.tsx +4 -3
- package/components/ReorderItems/ReorderItems.tsx +2 -2
- package/components/ResetPasswordForm/ResetPasswordForm.tsx +7 -8
- package/components/SignInForm/SignInForm.tsx +26 -5
- package/components/SignInForm/SignInFormInline.tsx +5 -3
- package/components/SignOutForm/SignOutForm.tsx +3 -2
- package/components/SignOutForm/signOut.ts +3 -2
- package/components/SignUpForm/SignUpForm.tsx +20 -4
- package/components/SignUpForm/SignUpFormInline.tsx +4 -3
- package/components/TrackingLink/TrackingLink.tsx +3 -2
- package/components/UpdateCustomerEmailForm/UpdateCustomerEmailForm.tsx +4 -4
- package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +1 -1
- package/components/ValidatedPasswordElement/ValidatedPasswordElement.tsx +3 -2
- package/components/WaitForCustomer/WaitForCustomer.tsx +5 -3
- package/components/index.ts +1 -0
- package/hooks/index.ts +1 -0
- package/hooks/useAccountSignInUpForm.tsx +4 -7
- package/hooks/useCustomerQuery.ts +4 -4
- package/hooks/useCustomerSession.ts +4 -6
- package/hooks/useGuestQuery.ts +4 -4
- package/hooks/useOrderCardItemImages.ts +2 -2
- package/hooks/useSignInForm.ts +9 -9
- package/link/customerLink.ts +6 -11
- package/link/xMagentoCacheIdHeader.ts +2 -1
- package/package.json +15 -15
- package/plugins/MagentoCustomerGraphqlProvider.tsx +2 -2
- package/plugins/SessionDebuggerPlugin.tsx +2 -2
- package/plugins/XMagentoCacheIdGraphQLProvider.tsx +1 -1
- package/plugins/{magentoCustomerGetInContext.ts → magentoCustomerPrivateQueryContext.ts} +7 -4
- package/test/authentication.playwright.ts +5 -5
- package/typePolicies.ts +3 -1
- package/utils/orderState.ts +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IconSvg, iconLocation } from '@graphcommerce/next-ui'
|
|
2
2
|
import { Trans } from '@lingui/react'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
4
|
+
import { Box, Link, Typography } from '@mui/material'
|
|
5
|
+
import type { TrackingLinkFragment } from './TrackingLink.gql'
|
|
5
6
|
|
|
6
7
|
export type TrackingLinkProps = TrackingLinkFragment & { sx?: SxProps<Theme> }
|
|
7
8
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
1
2
|
import { PasswordElement, TextFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
2
3
|
import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
|
|
3
4
|
import {
|
|
@@ -11,15 +12,14 @@ import {
|
|
|
11
12
|
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
12
13
|
import { i18n } from '@lingui/core'
|
|
13
14
|
import { Trans } from '@lingui/react'
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
15
15
|
import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError'
|
|
16
|
-
import {
|
|
17
|
-
UpdateCustomerEmailDocument,
|
|
16
|
+
import type {
|
|
18
17
|
UpdateCustomerEmailMutation,
|
|
19
18
|
UpdateCustomerEmailMutationVariables,
|
|
20
19
|
} from './UpdateCustomerEmail.gql'
|
|
20
|
+
import { UpdateCustomerEmailDocument } from './UpdateCustomerEmail.gql'
|
|
21
21
|
|
|
22
|
-
type UpdateCustomerEmailFormProps = {
|
|
22
|
+
export type UpdateCustomerEmailFormProps = {
|
|
23
23
|
email: string
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -3,7 +3,7 @@ import { Trans } from '@lingui/react'
|
|
|
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 { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
6
|
+
import type { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
7
7
|
import { UpdateDefaultAddressDocument } from '../AccountAddresses/UpdateDefaultAddress.gql'
|
|
8
8
|
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
9
9
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PasswordElementProps } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { PasswordElement } from '@graphcommerce/ecommerce-ui'
|
|
2
3
|
import { useQuery } from '@graphcommerce/graphql'
|
|
3
4
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
4
|
-
import { FieldValues } from '@graphcommerce/react-hook-form'
|
|
5
|
+
import type { FieldValues } from '@graphcommerce/react-hook-form'
|
|
5
6
|
import { i18n } from '@lingui/core'
|
|
6
7
|
|
|
7
8
|
export type ValidatedPasswordElementProps<T extends FieldValues> = PasswordElementProps<T>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { WaitForQueriesProps } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { WaitForQueries, mergeErrors } from '@graphcommerce/ecommerce-ui'
|
|
3
|
+
import type { FullPageMessageProps } from '@graphcommerce/next-ui'
|
|
4
|
+
import { FullPageMessage, IconSvg, iconPerson } from '@graphcommerce/next-ui'
|
|
3
5
|
import { Trans } from '@lingui/react'
|
|
4
6
|
import { Button, CircularProgress } from '@mui/material'
|
|
5
7
|
import React from 'react'
|
|
6
8
|
import { useCustomerSession } from '../../hooks/useCustomerSession'
|
|
7
9
|
import { ApolloCustomerErrorFullPage } from '../ApolloCustomerError/ApolloCustomerErrorFullPage'
|
|
8
10
|
|
|
9
|
-
type WaitForCustomerProps = Omit<WaitForQueriesProps, 'fallback' | 'waitFor'> &
|
|
11
|
+
export type WaitForCustomerProps = Omit<WaitForQueriesProps, 'fallback' | 'waitFor'> &
|
|
10
12
|
Pick<FullPageMessageProps, 'disableMargin'> & {
|
|
11
13
|
waitFor?: WaitForQueriesProps['waitFor']
|
|
12
14
|
fallback?: React.ReactNode
|
package/components/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './OrderCard/OrderCard'
|
|
|
32
32
|
export * from './OrderCardItem/OrderCardItem'
|
|
33
33
|
export * from './OrderCardItemImage/OrderCardItemImage'
|
|
34
34
|
export * from './OrderDetails/OrderDetails'
|
|
35
|
+
export * from './OrderDetails/OrderDetails.gql'
|
|
35
36
|
export * from './OrderDetails/OrderTotals'
|
|
36
37
|
export * from './OrderItem/OrderItem'
|
|
37
38
|
export * from './OrderItems/OrderItems'
|
package/hooks/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './useAccountSignInUpForm'
|
|
|
9
9
|
export * from './useCustomerPermissions'
|
|
10
10
|
export * from './useCustomerQuery'
|
|
11
11
|
export * from './useCustomerSession'
|
|
12
|
+
export * from './UseCustomerValidateToken.gql'
|
|
12
13
|
export * from './useGuestQuery'
|
|
13
14
|
export { default as useOrderCardItemImages } from './useOrderCardItemImages'
|
|
14
15
|
export * from './useSignInForm'
|
|
@@ -3,12 +3,9 @@ import { useQuery } from '@graphcommerce/graphql'
|
|
|
3
3
|
import { useUrlQuery } from '@graphcommerce/next-ui'
|
|
4
4
|
import { useFormGqlQuery } from '@graphcommerce/react-hook-form'
|
|
5
5
|
import { useEffect } from 'react'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
IsEmailAvailableQuery,
|
|
10
|
-
IsEmailAvailableQueryVariables,
|
|
11
|
-
} from './IsEmailAvailable.gql'
|
|
6
|
+
import type { IsEmailAvailableQuery, IsEmailAvailableQueryVariables } from './IsEmailAvailable.gql'
|
|
7
|
+
import { IsEmailAvailableDocument } from './IsEmailAvailable.gql'
|
|
8
|
+
import { UseCustomerValidateTokenDocument } from './UseCustomerValidateToken.gql'
|
|
12
9
|
import { useCustomerAccountCanSignUp } from './useCustomerPermissions'
|
|
13
10
|
import { useCustomerSession } from './useCustomerSession'
|
|
14
11
|
|
|
@@ -27,7 +24,7 @@ export function useAccountSignInUpForm(props: UseFormIsEmailAvailableProps = {})
|
|
|
27
24
|
|
|
28
25
|
const [queryState, setRouterQuery] = useUrlQuery<{ email?: string | null }>()
|
|
29
26
|
|
|
30
|
-
const customerQuery = useQuery(
|
|
27
|
+
const customerQuery = useQuery(UseCustomerValidateTokenDocument, { fetchPolicy: 'cache-only' })
|
|
31
28
|
const cachedEmail = customerQuery?.data?.customer?.email
|
|
32
29
|
|
|
33
30
|
const form = useFormGqlQuery<
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
TypedDocumentNode,
|
|
1
|
+
import type {
|
|
2
|
+
OperationVariables,
|
|
4
3
|
QueryHookOptions,
|
|
5
4
|
QueryResult,
|
|
6
|
-
|
|
5
|
+
TypedDocumentNode,
|
|
7
6
|
} from '@graphcommerce/graphql'
|
|
7
|
+
import { useQuery } from '@graphcommerce/graphql'
|
|
8
8
|
import { useCustomerSession } from './useCustomerSession'
|
|
9
9
|
|
|
10
10
|
/** Will only execute when the customer is signed in. */
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { QueryResult
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
CustomerTokenQueryVariables,
|
|
6
|
-
} from './CustomerToken.gql'
|
|
1
|
+
import type { QueryResult } from '@graphcommerce/graphql'
|
|
2
|
+
import { useQuery } from '@graphcommerce/graphql'
|
|
3
|
+
import type { CustomerTokenQuery, CustomerTokenQueryVariables } from './CustomerToken.gql'
|
|
4
|
+
import { CustomerTokenDocument } from './CustomerToken.gql'
|
|
7
5
|
|
|
8
6
|
export type UseCustomerSessionOptions = Record<string, unknown>
|
|
9
7
|
|
package/hooks/useGuestQuery.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useQuery,
|
|
3
|
-
TypedDocumentNode,
|
|
4
|
-
QueryHookOptions,
|
|
1
|
+
import type {
|
|
5
2
|
OperationVariables,
|
|
3
|
+
QueryHookOptions,
|
|
4
|
+
TypedDocumentNode,
|
|
6
5
|
} from '@graphcommerce/graphql'
|
|
6
|
+
import { useQuery } from '@graphcommerce/graphql'
|
|
7
7
|
import { useCustomerSession } from './useCustomerSession'
|
|
8
8
|
|
|
9
9
|
/** Will only execute when the customer is not signed in. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
|
-
import { OrderCardItemImageFragment } from './OrderCardItemImage.gql'
|
|
2
|
+
import type { OrderCardItemImageFragment } from './OrderCardItemImage.gql'
|
|
3
3
|
import { OrderCardItemImagesDocument } from './OrderCardItemImages.gql'
|
|
4
|
-
import { UseOrderCardItemImagesFragment } from './UseOrderCardItemImages.gql'
|
|
4
|
+
import type { UseOrderCardItemImagesFragment } from './UseOrderCardItemImages.gql'
|
|
5
5
|
|
|
6
6
|
type UseOrderCardItemImagesProps = UseOrderCardItemImagesFragment | null
|
|
7
7
|
|
package/hooks/useSignInForm.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { useApolloClient } from '@graphcommerce/graphql'
|
|
2
2
|
import { setCssFlag } from '@graphcommerce/next-ui'
|
|
3
|
-
import { UseFormGraphQlOptions
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
SignInMutationVariables,
|
|
8
|
-
} from '../components/SignInForm/SignIn.gql'
|
|
3
|
+
import type { UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
4
|
+
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
5
|
+
import type { SignInMutation, SignInMutationVariables } from '../components/SignInForm/SignIn.gql'
|
|
6
|
+
import { SignInDocument } from '../components/SignInForm/SignIn.gql'
|
|
9
7
|
import { signOut } from '../components/SignOutForm/signOut'
|
|
10
8
|
import { CustomerDocument } from './Customer.gql'
|
|
11
9
|
|
|
@@ -14,9 +12,11 @@ type UseSignInFormProps = {
|
|
|
14
12
|
} & UseFormGraphQlOptions<SignInMutation, SignInMutationVariables>
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
* To extend the actions that happen after a successful sign in, you can use the `onComplete`
|
|
15
|
+
* To extend the actions that happen after a successful sign in, you can use the `onComplete`
|
|
16
|
+
* option.
|
|
18
17
|
*
|
|
19
|
-
* @example
|
|
18
|
+
* @example
|
|
19
|
+
* @graphcommerce/magento-cart/plugins/useSignInFormMergeCart
|
|
20
20
|
*/
|
|
21
21
|
export function useSignInForm({ email, ...options }: UseSignInFormProps) {
|
|
22
22
|
const client = useApolloClient()
|
|
@@ -39,7 +39,7 @@ export function useSignInForm({ email, ...options }: UseSignInFormProps) {
|
|
|
39
39
|
return options?.onBeforeSubmit ? options.onBeforeSubmit(newValues) : newValues
|
|
40
40
|
},
|
|
41
41
|
onComplete: (...args) => {
|
|
42
|
-
setCssFlag('
|
|
42
|
+
setCssFlag('private-query', true)
|
|
43
43
|
return options.onComplete?.(...args)
|
|
44
44
|
},
|
|
45
45
|
},
|
package/link/customerLink.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { globalApolloClient } from '@graphcommerce/graphql'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
setContext,
|
|
8
|
-
} from '@graphcommerce/graphql/apollo'
|
|
9
|
-
import { ErrorCategory } from '@graphcommerce/magento-graphql'
|
|
10
|
-
import { GraphQLError } from 'graphql'
|
|
11
|
-
import { NextRouter } from 'next/router'
|
|
2
|
+
import type { ApolloCache } from '@graphcommerce/graphql/apollo'
|
|
3
|
+
import { ApolloLink, fromPromise, onError, setContext } from '@graphcommerce/graphql/apollo'
|
|
4
|
+
import type { ErrorCategory } from '@graphcommerce/magento-graphql'
|
|
5
|
+
import type { GraphQLFormattedError } from 'graphql'
|
|
6
|
+
import type { NextRouter } from 'next/router'
|
|
12
7
|
import { signOut } from '../components/SignOutForm/signOut'
|
|
13
8
|
import { CustomerTokenDocument } from '../hooks'
|
|
14
9
|
|
|
@@ -50,7 +45,7 @@ export async function pushWithPromise(router: Pick<NextRouter, 'push' | 'events'
|
|
|
50
45
|
})
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
function isErrorCategory(err:
|
|
48
|
+
function isErrorCategory(err: GraphQLFormattedError, category: ErrorCategory) {
|
|
54
49
|
return err.extensions?.category === category
|
|
55
50
|
}
|
|
56
51
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DefaultContext } from '@graphcommerce/graphql'
|
|
2
|
+
import { ApolloLink } from '@graphcommerce/graphql'
|
|
2
3
|
import { CustomerTokenDocument } from '../hooks'
|
|
3
4
|
|
|
4
5
|
export const xMagentoCacheIdHeader = new ApolloLink((operation, forward) => {
|
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.0.0
|
|
5
|
+
"version": "9.0.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0
|
|
17
|
-
"@graphcommerce/framer-next-pages": "^9.0.0
|
|
18
|
-
"@graphcommerce/framer-utils": "^9.0.0
|
|
19
|
-
"@graphcommerce/graphql": "^9.0.0
|
|
20
|
-
"@graphcommerce/graphql-mesh": "^9.0.0
|
|
21
|
-
"@graphcommerce/image": "^9.0.0
|
|
22
|
-
"@graphcommerce/magento-graphql": "^9.0.0
|
|
23
|
-
"@graphcommerce/magento-store": "^9.0.0
|
|
24
|
-
"@graphcommerce/next-ui": "^9.0.0
|
|
25
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0
|
|
26
|
-
"@graphcommerce/react-hook-form": "^9.0.0
|
|
27
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0",
|
|
17
|
+
"@graphcommerce/framer-next-pages": "^9.0.0",
|
|
18
|
+
"@graphcommerce/framer-utils": "^9.0.0",
|
|
19
|
+
"@graphcommerce/graphql": "^9.0.0",
|
|
20
|
+
"@graphcommerce/graphql-mesh": "^9.0.0",
|
|
21
|
+
"@graphcommerce/image": "^9.0.0",
|
|
22
|
+
"@graphcommerce/magento-graphql": "^9.0.0",
|
|
23
|
+
"@graphcommerce/magento-store": "^9.0.0",
|
|
24
|
+
"@graphcommerce/next-ui": "^9.0.0",
|
|
25
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0",
|
|
26
|
+
"@graphcommerce/react-hook-form": "^9.0.0",
|
|
27
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0",
|
|
28
28
|
"@lingui/core": "^4.2.1",
|
|
29
29
|
"@lingui/macro": "^4.2.1",
|
|
30
30
|
"@lingui/react": "^4.2.1",
|
|
31
31
|
"@mui/material": "^5.10.16",
|
|
32
|
-
"framer-motion": "^
|
|
32
|
+
"framer-motion": "^11.0.0",
|
|
33
33
|
"graphql": "^16.0.0",
|
|
34
34
|
"next": "*",
|
|
35
35
|
"react": "^18.2.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GraphQLProviderProps } from '@graphcommerce/graphql'
|
|
1
|
+
import type { GraphQLProviderProps } from '@graphcommerce/graphql'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useEventCallback } from '@mui/material'
|
|
4
|
-
import { NextRouter } from 'next/router'
|
|
4
|
+
import type { NextRouter } from 'next/router'
|
|
5
5
|
import { useMemo } from 'react'
|
|
6
6
|
import { customerLink } from '../link/customerLink'
|
|
7
7
|
import { customerTypePolicies, migrateCustomer } from '../typePolicies'
|
|
@@ -25,9 +25,9 @@ export function FramerNextPages(props: PluginProps<PagesProps>) {
|
|
|
25
25
|
onClick={() => {
|
|
26
26
|
const currentToken = client.readQuery({ query: CustomerTokenDocument })
|
|
27
27
|
if (!currentToken?.customerToken?.token) {
|
|
28
|
-
console.
|
|
28
|
+
console.warn('No customerToken available, nothing to break')
|
|
29
29
|
} else {
|
|
30
|
-
console.
|
|
30
|
+
console.warn('Changing current token to a random one')
|
|
31
31
|
|
|
32
32
|
client.writeQuery({
|
|
33
33
|
query: CustomerTokenDocument,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLProviderProps } from '@graphcommerce/graphql'
|
|
1
|
+
import type { GraphQLProviderProps } from '@graphcommerce/graphql'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { xMagentoCacheIdHeader } from '../link/xMagentoCacheIdHeader'
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type
|
|
3
|
-
type
|
|
2
|
+
type getPrivateQueryContext as getPrivateQueryContextType,
|
|
3
|
+
type usePrivateQueryContext as usePrivateQueryContextType,
|
|
4
4
|
} from '@graphcommerce/graphql'
|
|
5
5
|
import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
|
|
6
6
|
import { CustomerTokenDocument } from '../hooks/CustomerToken.gql'
|
|
@@ -11,7 +11,7 @@ export const config: PluginConfig = {
|
|
|
11
11
|
module: '@graphcommerce/graphql',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const getPrivateQueryContext: FunctionPlugin<typeof getPrivateQueryContextType> = (
|
|
15
15
|
prev,
|
|
16
16
|
client,
|
|
17
17
|
...args
|
|
@@ -23,7 +23,10 @@ export const getInContextInput: FunctionPlugin<typeof getInContextInputType> = (
|
|
|
23
23
|
return { ...res, loggedIn: true }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const
|
|
26
|
+
export const usePrivateQueryContext: FunctionPlugin<typeof usePrivateQueryContextType> = (
|
|
27
|
+
prev,
|
|
28
|
+
...args
|
|
29
|
+
) => {
|
|
27
30
|
const { loggedIn } = useCustomerSession()
|
|
28
31
|
const res = prev(...args)
|
|
29
32
|
if (!loggedIn) return res
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3
4
|
import { waitForGraphQlResponse } from '@graphcommerce/graphql/test/apolloClient.fixture'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '@graphcommerce/magento-customer/components/SignUpForm/SignUpConfirm.gql'
|
|
5
|
+
import type { SignUpMutation } from '@graphcommerce/magento-customer/components'
|
|
6
|
+
import { SignUpDocument } from '@graphcommerce/magento-customer/components'
|
|
7
|
+
import type { SignUpConfirmMutation } from '@graphcommerce/magento-customer/components/SignUpForm/SignUpConfirm.gql'
|
|
8
|
+
import { SignUpConfirmDocument } from '@graphcommerce/magento-customer/components/SignUpForm/SignUpConfirm.gql'
|
|
9
9
|
import { test } from '@playwright/test'
|
|
10
10
|
|
|
11
11
|
function isSignUp(
|
package/typePolicies.ts
CHANGED
|
@@ -31,5 +31,7 @@ export const customerTypePolicies: StrictTypedTypePolicies = {
|
|
|
31
31
|
|
|
32
32
|
export const migrateCustomer: MigrateCache = (oldCache, newCache) => {
|
|
33
33
|
const token = oldCache.readQuery({ query: CustomerTokenDocument })
|
|
34
|
-
|
|
34
|
+
if (token) {
|
|
35
|
+
newCache.writeQuery({ query: CustomerTokenDocument, data: token, broadcast: true })
|
|
36
|
+
}
|
|
35
37
|
}
|
package/utils/orderState.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
2
|
-
import { OrderDetailsFragment } from '../components/OrderDetails/OrderDetails.gql'
|
|
3
|
-
import { OrderStateLabelFragment } from '../components/OrderStateLabel/OrderStateLabel.gql'
|
|
2
|
+
import type { OrderDetailsFragment } from '../components/OrderDetails/OrderDetails.gql'
|
|
3
|
+
import type { OrderStateLabelFragment } from '../components/OrderStateLabel/OrderStateLabel.gql'
|
|
4
4
|
|
|
5
5
|
export type OrderState = 'pending' | 'processing' | 'complete' | 'closed'
|
|
6
6
|
|